[Git][debian-gis-team/mapnik][master] Add patch to fix FTBFS with Python 3.12. (closes: #1067163)

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Tue Mar 19 17:13:50 GMT 2024



Bas Couwenberg pushed to branch master at Debian GIS Project / mapnik


Commits:
95704ee4 by Bas Couwenberg at 2024-03-19T18:13:32+01:00
Add patch to fix FTBFS with Python 3.12. (closes: #1067163)

- - - - -


3 changed files:

- debian/changelog
- + debian/patches/python3.12-imp.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+mapnik (3.1.0+ds-8) UNRELEASED; urgency=medium
+
+  * Add patch to fix FTBFS with Python 3.12.
+    (closes: #1067163)
+
+ -- Bas Couwenberg <sebastic at debian.org>  Tue, 19 Mar 2024 18:13:04 +0100
+
 mapnik (3.1.0+ds-7) unstable; urgency=medium
 
   * Add dpkg-dev (>= 1.22.5) to build dependencies for t64 changes.


=====================================
debian/patches/python3.12-imp.patch
=====================================
@@ -0,0 +1,127 @@
+Description: Fix FTBFS with Python 3.12.
+Author: Mats Wichmann <mats at linux.com>
+Origin: https://github.com/SCons/scons/commit/97c7246f5efb311b007d7aa6b585aa6b47a17230
+
+--- a/scons/scons-local-3.0.1/SCons/Platform/__init__.py
++++ b/scons/scons-local-3.0.1/SCons/Platform/__init__.py
+@@ -47,7 +47,7 @@ __revision__ = "src/engine/SCons/Platfor
+ 
+ import SCons.compat
+ 
+-import imp
++import importlib
+ import os
+ import sys
+ import tempfile
+@@ -100,13 +100,8 @@ def platform_module(name = platform_defa
+             eval(full_name)
+         else:
+             try:
+-                file, path, desc = imp.find_module(name,
+-                                        sys.modules['SCons.Platform'].__path__)
+-                try:
+-                    mod = imp.load_module(full_name, file, path, desc)
+-                finally:
+-                    if file:
+-                        file.close()
++                # the specific platform module is a relative import
++                mod = importlib.import_module("." + name, __name__)
+             except ImportError:
+                 try:
+                     import zipimport
+--- a/scons/scons-local-3.0.1/SCons/Tool/__init__.py
++++ b/scons/scons-local-3.0.1/SCons/Tool/__init__.py
+@@ -37,12 +37,11 @@ tool definition.
+ 
+ __revision__ = "src/engine/SCons/Tool/__init__.py 74b2c53bc42290e911b334a6b44f187da698a668 2017/11/14 13:16:53 bdbaddog"
+ 
+-import imp
+-import importlib
+ import sys
+ import re
+ import os
+ import shutil
++import importlib
+ 
+ 
+ import SCons.Builder
+@@ -122,6 +121,8 @@ class Tool(object):
+             self.options = module.options
+ 
+     def _load_dotted_module_py2(self, short_name, full_name, searchpaths=None):
++        import imp
++
+         splitname = short_name.split('.')
+         index = 0
+         srchpths = searchpaths
+--- a/scons/scons-local-3.0.1/SCons/Tool/cyglink.py
++++ b/scons/scons-local-3.0.1/SCons/Tool/cyglink.py
+@@ -133,7 +133,7 @@ def _versioned_lib_suffix(env, suffix, v
+     if Verbose:
+         print("_versioned_lib_suffix: suffix= ", suffix)
+         print("_versioned_lib_suffix: version= ", version)
+-    cygversion = re.sub('\.', '-', version)
++    cygversion = re.sub(r'\.', '-', version)
+     if not suffix.startswith('-' + cygversion):
+         suffix = '-' + cygversion + suffix
+     if Verbose:
+--- a/scons/scons-local-3.0.1/SCons/Tool/packaging/__init__.py
++++ b/scons/scons-local-3.0.1/SCons/Tool/packaging/__init__.py
+@@ -33,7 +33,7 @@ from SCons.Errors import *
+ from SCons.Util import is_List, make_path_relative
+ from SCons.Warnings import warn, Warning
+ 
+-import os, imp
++import os
+ import SCons.Defaults
+ 
+ __all__ = [ 'src_targz', 'src_tarbz2', 'src_zip', 'tarbz2', 'targz', 'zip', 'rpm', 'msi', 'ipk' ]
+@@ -117,12 +117,12 @@ def Package(env, target=None, source=Non
+     # load the needed packagers.
+     def load_packager(type):
+         try:
+-            file,path,desc=imp.find_module(type, __path__)
+-            return imp.load_module(type, file, path, desc)
++            # the specific packager is a relative import
++            return importlib.import_module("." + type, __name__)
+         except ImportError as e:
+             raise EnvironmentError("packager %s not available: %s"%(type,str(e)))
+ 
+-    packagers=list(map(load_packager, PACKAGETYPE))
++    packagers = list(map(load_packager, PACKAGETYPE))
+ 
+     # set up targets and the PACKAGEROOT
+     try:
+--- a/scons/scons-local-3.0.1/SCons/compat/__init__.py
++++ b/scons/scons-local-3.0.1/SCons/compat/__init__.py
+@@ -61,27 +61,18 @@ __revision__ = "src/engine/SCons/compat/
+ 
+ import os
+ import sys
+-import imp  # Use the "imp" module to protect imports from fixers.
++import importlib
+ 
+ PYPY = hasattr(sys, 'pypy_translation_info')
+ 
+ 
+-def import_as(module, name):
+-    """
+-    Imports the specified module (from our local directory) as the
+-    specified name, returning the loaded module object.
+-    """
+-    dir = os.path.split(__file__)[0]
+-    return imp.load_module(name, *imp.find_module(module, [dir]))
+-
+-
+ def rename_module(new, old):
+     """
+-    Attempts to import the old module and load it under the new name.
++    Attempt to import the old module and load it under the new name.
+     Used for purely cosmetic name changes in Python 3.x.
+     """
+     try:
+-        sys.modules[new] = imp.load_module(old, *imp.find_module(old))
++        sys.modules[new] = importlib.import_module(old)
+         return True
+     except ImportError:
+         return False


=====================================
debian/patches/series
=====================================
@@ -5,3 +5,4 @@ gcc-13.patch
 boost-1.81.patch
 boost-1.83-1.patch
 boost-1.83-2.patch
+python3.12-imp.patch



View it on GitLab: https://salsa.debian.org/debian-gis-team/mapnik/-/commit/95704ee405be16734cb34ab7c0c8af8b43dd022b

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapnik/-/commit/95704ee405be16734cb34ab7c0c8af8b43dd022b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20240319/d0bf48aa/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list