[neon/snap-packaging/kde-qt5-core-sdk/work.core24] /: Add patches to replace depreciated imp with importlib.

Scarlett Moore null at kde.org
Fri Oct 18 13:05:39 BST 2024


Git commit 0c681902617dedd2beedaa2475aaa0ccbdbda287 by Scarlett Moore.
Committed on 18/10/2024 at 12:04.
Pushed by scarlettmoore into branch 'work.core24'.

Add patches to replace depreciated imp with importlib.

A  +49   -0    patches/remove_depreciated_imp.patch
A  +58   -0    patches/replace_imp_with_importlib.patch
M  +2    -1    patches/series
M  +5    -0    snapcraft.yaml

https://invent.kde.org/neon/snap-packaging/kde-qt5-core-sdk/-/commit/0c681902617dedd2beedaa2475aaa0ccbdbda287

diff --git a/patches/remove_depreciated_imp.patch b/patches/remove_depreciated_imp.patch
new file mode 100644
index 0000000..50ed1aa
--- /dev/null
+++ b/patches/remove_depreciated_imp.patch
@@ -0,0 +1,49 @@
+From 3664134f749f4851a14ab1953a9ee460a1fe0b68 Mon Sep 17 00:00:00 2001
+From: Bruno Pitrus <brunopitrus at hotmail.com>
+Date: Tue, 25 Jul 2023 18:34:09 +0000
+Subject: [PATCH] Remove unused python import
+
+The `imp` module has been removed in Python 3.12 causing these scripts to error out.
+
+Task-number: QTBUG-121555
+Change-Id: Ic7c038d21b86052bdda13015f80934db52a2143e
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4714859
+Auto-Submit: Bruno Pitrus <brunopitrus at hotmail.com>
+Reviewed-by: Ken Rockot <rockot at google.com>
+Commit-Queue: Ken Rockot <rockot at google.com>
+Cr-Commit-Position: refs/heads/main@{#1174966}
+NOKEYCHECK=True
+GitOrigin-RevId: f5f6e361d037c31630661186e7bd7b31d2784cb8
+Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/534568
+Reviewed-by: Michal Klocek <michal.klocek at qt.io>
+---
+ chromium/mojo/public/tools/mojom/mojom/fileutil.py    | 1 -
+ chromium/mojo/public/tools/mojom/mojom/parse/lexer.py | 1 -
+ 2 files changed, 2 deletions(-)
+
+diff --git a/chromium/mojo/public/tools/mojom/mojom/fileutil.py b/chromium/mojo/public/tools/mojom/mojom/fileutil.py
+index 29daec367c5..124f12c134b 100644
+--- a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/fileutil.py
++++ b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/fileutil.py
+@@ -3,7 +3,6 @@
+ # found in the LICENSE file.
+ 
+ import errno
+-import imp
+ import os.path
+ import sys
+ 
+diff --git a/chromium/mojo/public/tools/mojom/mojom/parse/lexer.py b/chromium/mojo/public/tools/mojom/mojom/parse/lexer.py
+index 73ca15df94c..1083a1af7bb 100644
+--- a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/parse/lexer.py
++++ b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/parse/lexer.py
+@@ -2,7 +2,6 @@
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+ 
+-import imp
+ import os.path
+ import sys
+ 
+-- 
+2.32.0
diff --git a/patches/replace_imp_with_importlib.patch b/patches/replace_imp_with_importlib.patch
new file mode 100644
index 0000000..bfc0438
--- /dev/null
+++ b/patches/replace_imp_with_importlib.patch
@@ -0,0 +1,58 @@
+Patch-Source: https://sources.debian.org/data/main/q/qtwebengine-opensource-src/5.15.16+dfsg-3/debian/patches/python3.12-six.patch
+--
+Description: implement find_spec() for _SixMetaPathImporter
+Origin: upstream, https://github.com/benjaminp/six/commit/25916292d96f5f09
+Last-Update: 2024-03-17
+
+--- a/src/3rdparty/chromium/third_party/protobuf/third_party/six/six.py
++++ b/src/3rdparty/chromium/third_party/protobuf/third_party/six/six.py
+@@ -71,6 +71,11 @@ else:
+             MAXSIZE = int((1 << 63) - 1)
+         del X
+ 
++if PY34:
++    from importlib.util import spec_from_loader
++else:
++    spec_from_loader = None
++
+ 
+ def _add_doc(func, doc):
+     """Add documentation to a function."""
+@@ -186,6 +191,11 @@ class _SixMetaPathImporter(object):
+             return self
+         return None
+ 
++    def find_spec(self, fullname, path, target=None):
++        if fullname in self.known_modules:
++            return spec_from_loader(fullname, self)
++        return None
++
+     def __get_module(self, fullname):
+         try:
+             return self.known_modules[fullname]
+--- a/src/3rdparty/chromium/tools/grit/third_party/six/__init__.py
++++ b/src/3rdparty/chromium/tools/grit/third_party/six/__init__.py
+@@ -71,6 +71,11 @@ else:
+             MAXSIZE = int((1 << 63) - 1)
+         del X
+ 
++if PY34:
++    from importlib.util import spec_from_loader
++else:
++    spec_from_loader = None
++
+ 
+ def _add_doc(func, doc):
+     """Add documentation to a function."""
+@@ -186,6 +191,11 @@ class _SixMetaPathImporter(object):
+             return self
+         return None
+ 
++    def find_spec(self, fullname, path, target=None):
++        if fullname in self.known_modules:
++            return spec_from_loader(fullname, self)
++        return None
++
+     def __get_module(self, fullname):
+         try:
+             return self.known_modules[fullname]
diff --git a/patches/series b/patches/series
index d26775f..401b08b 100644
--- a/patches/series
+++ b/patches/series
@@ -1 +1,2 @@
-force_libzstd_shared.patch
+remove_depreciated_imp.patch
+replace_imp_with_importlib.patch
diff --git a/snapcraft.yaml b/snapcraft.yaml
index e83fceb..beaf86a 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -1105,6 +1105,11 @@ parts:
     build-environment:
       - LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
       - PATH: $CRAFT_STAGE/usr/bin${PATH:+:$PATH}
+    override-pull: |
+      craftctl default
+        while read -r PATCHFILE ; do
+          patch -p1 < "$CRAFT_PROJECT_DIR/patches/$PATCHFILE"
+        done < $CRAFT_PROJECT_DIR/patches/series
     override-build: |
       # Setting number of build jobs to a safe number to prevent running out of memory during QtWebengine build
       memtotal=$(cat /proc/meminfo | awk '{print $2}' | head -n1)


More information about the Neon-commits mailing list