diff --git a/debian/changelog b/debian/changelog index ee04792848e19e9573b256a59cd895d34a9eb1f2..44b823ee955a22c94971b61175ad11f6f68398a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +glueviz (1.0.1+dfsg-4) unstable; urgency=medium + + * Migrate from package imp to importlib for Python 3.12 (Closes: #1061799) + + -- Pushkar Kulkarni <pushkar.kulkarni@canonical.com> Sun, 04 Feb 2024 14:33:00 +0530 + glueviz (1.0.1+dfsg-3) unstable; urgency=medium * Team upload. diff --git a/debian/patches/Replace-imp-by-importlib.patch b/debian/patches/Replace-imp-by-importlib.patch new file mode 100644 index 0000000000000000000000000000000000000000..fd5a5a03871469572ac45e9fbd61548ccbd315f3 --- /dev/null +++ b/debian/patches/Replace-imp-by-importlib.patch @@ -0,0 +1,37 @@ +Author: Pushkar Kulkarni <pushkar.kulkarni@canonical.com> +Description: The "imp" package lets users implement the import statement, + enabling dynamic loading of Python modules. The "imp" package was + deprecated in an earlier version and removed in Python 3.12. The + Python3 docs recommend moving to package "importlib" as a replacement. +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1061799 +--- a/glue/config.py ++++ b/glue/config.py +@@ -1,8 +1,10 @@ + import os +-import imp ++import importlib + import sys ++import types + import warnings + from collections import namedtuple ++from importlib.machinery import SourceFileLoader + + from glue.utils import format_choices + +@@ -994,13 +996,14 @@ + Exception, if no module was found + """ + search_order = search_path or _default_search_order() +- result = imp.new_module('config') ++ # Create a new, empty module ++ result = types.ModuleType('config') + + for config_file in search_order: + dir = os.path.dirname(config_file) + try: + sys.path.append(dir) +- config = imp.load_source('config', config_file) ++ config = SourceFileLoader('config', config_file).load_module() + result = config + except IOError: + pass diff --git a/debian/patches/series b/debian/patches/series index 14a4a22b936d43cb74d01e2822700f9ba614fffa..9e89a04281522e017f22bf2a5e9faf0f4d36f14e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,3 +4,4 @@ Install-in-proper-directory-.txt-file.patch Add-Keywords-to-desktop-file.patch Install-under-the-right-directory-the-package-data.patch Pass-int-argument-to-QProgressBar.setValue.patch +Replace-imp-by-importlib.patch