diff options
Diffstat (limited to 'community/gpodder-adaptive/0001-Replace-the-removed-imp-module-with-importlib.patch')
-rw-r--r-- | community/gpodder-adaptive/0001-Replace-the-removed-imp-module-with-importlib.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/community/gpodder-adaptive/0001-Replace-the-removed-imp-module-with-importlib.patch b/community/gpodder-adaptive/0001-Replace-the-removed-imp-module-with-importlib.patch new file mode 100644 index 00000000000..46ccd7159f0 --- /dev/null +++ b/community/gpodder-adaptive/0001-Replace-the-removed-imp-module-with-importlib.patch @@ -0,0 +1,47 @@ +From dd9b594d24a541c0f1d3b096e47b6d7f1c11ca7e Mon Sep 17 00:00:00 2001 +From: auouymous <au@qzx.com> +Date: Fri, 20 Oct 2023 03:03:01 -0600 +Subject: [PATCH] Replace the removed imp module with importlib. + +--- + src/gpodder/extensions.py | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/src/gpodder/extensions.py b/src/gpodder/extensions.py +index 8f50ff31..44fc35d5 100644 +--- a/src/gpodder/extensions.py ++++ b/src/gpodder/extensions.py +@@ -31,7 +31,7 @@ For an example extension see share/gpodder/examples/extensions.py + + import functools + import glob +-import imp ++import importlib + import logging + import os + import re +@@ -291,15 +291,16 @@ class ExtensionContainer(object): + self.name, self.metadata.only_for) + return + +- basename, extension = os.path.splitext(os.path.basename(self.filename)) +- fp = open(self.filename, 'r') ++ basename, _ = os.path.splitext(os.path.basename(self.filename)) + try: +- module_file = imp.load_module(basename, fp, self.filename, +- (extension, 'r', imp.PY_SOURCE)) ++ # from load_source() on https://docs.python.org/dev/whatsnew/3.12.html ++ loader = importlib.machinery.SourceFileLoader(basename, self.filename) ++ spec = importlib.util.spec_from_file_location(basename, self.filename, loader=loader) ++ module_file = importlib.util.module_from_spec(spec) ++ loader.exec_module(module_file) + finally: + # Remove the .pyc file if it was created during import + util.delete_file(self.filename + 'c') +- fp.close() + + self.default_config = getattr(module_file, 'DefaultConfig', {}) + if self.default_config: +-- +2.45.0 + |