Bug#1078068: accerciser: Broken with Python 3.12: ModuleNotFoundError: No module named 'imp'
Sudip Mukherjee
sudipm.mukherjee at gmail.com
Sun Aug 11 00:28:19 BST 2024
The attached patch should fix the issue.
--
Regards
Sudip
-------------- next part --------------
diff -Nru accerciser-3.42.0/debian/changelog accerciser-3.42.0/debian/changelog
--- accerciser-3.42.0/debian/changelog 2023-10-08 11:27:48.000000000 +0100
+++ accerciser-3.42.0/debian/changelog 2024-08-11 00:20:38.000000000 +0100
@@ -1,3 +1,10 @@
+accerciser (3.42.0-1.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Remove use of imp module to fix crash. (Closes: #1078068)
+
+ -- Sudip Mukherjee <sudipm.mukherjee at gmail.com> Sun, 11 Aug 2024 00:20:38 +0100
+
accerciser (3.42.0-1) unstable; urgency=medium
* New upstream release
diff -Nru accerciser-3.42.0/debian/patches/remove-imp.patch accerciser-3.42.0/debian/patches/remove-imp.patch
--- accerciser-3.42.0/debian/patches/remove-imp.patch 1970-01-01 01:00:00.000000000 +0100
+++ accerciser-3.42.0/debian/patches/remove-imp.patch 2024-08-11 00:20:38.000000000 +0100
@@ -0,0 +1,71 @@
+Description: Don't use the imp module
+
+Origin: upstream, https://gitlab.gnome.org/GNOME/accerciser/-/commit/dbf092596f3a5204a6c666f52f2c1c76d10c32df and https://gitlab.gnome.org/GNOME/accerciser/-/commit/a1c00649d2ca74c99c4e28d058ef5791d79e32f3
+Bug-Debian: https://bugs.debian.org/1078068
+Last-Update: 2024-08-10
+---
+
+--- accerciser-3.42.0.orig/plugins/validate.py
++++ accerciser-3.42.0/plugins/validate.py
+@@ -20,7 +20,7 @@ import os
+ import traceback
+ import sys
+ import glob
+-import imp
++import importlib
+ import webbrowser
+ from accerciser.plugin import ViewportPlugin
+ from accerciser.i18n import _, N_, DOMAIN
+@@ -68,15 +68,16 @@ class ValidatorManager(type):
+ '''
+ for path in [USER_SCHEMA_PATH, SYS_SCHEMA_PATH]:
+ for fn in glob.glob(os.path.join(path, '*.py')):
+- module = os.path.basename(fn)[:-3]
+- params = imp.find_module(module, [path])
+- schema = imp.load_module(module, *params)
++ module_name = os.path.basename(fn)[:-3]
++ spec = importlib.util.spec_from_file_location(module_name, fn)
++ module = importlib.util.module_from_spec(spec)
++ spec.loader.exec_module(module)
+ try:
+ # try to get descriptive fields from the module
+- SCHEMA_METADATA[module] = schema.__metadata__
++ SCHEMA_METADATA[module_name] = module.__metadata__
+ except AttributeError:
+ # default to usinf file name as description
+- SCHEMA_METADATA[module] = {'name' : module,
++ SCHEMA_METADATA[module_name] = {'name' : module,
+ 'description' : _('No description')}
+
+ @staticmethod
+--- accerciser-3.42.0.orig/src/lib/accerciser/plugin/plugin_manager.py
++++ accerciser-3.42.0/src/lib/accerciser/plugin/plugin_manager.py
+@@ -23,7 +23,7 @@ from accerciser.tools import ToolsAccess
+ from .message import MessageManager
+ import os
+ import sys
+-import imp
++import importlib
+ import traceback
+ from accerciser.i18n import _, N_, C_
+
+@@ -136,8 +136,7 @@ class PluginManager(gtk.ListStore, Tools
+ '''
+ sys.path.insert(0, plugin_dir)
+ try:
+- params = imp.find_module(plugin_fn, [plugin_dir])
+- plugin = imp.load_module(plugin_fn, *params)
++ plugin = importlib.import_module(plugin_fn)
+ plugin_locals = plugin.__dict__
+ except Exception as e:
+ self.message_manager.newModuleError(plugin_fn, plugin_dir,
+--- accerciser-3.42.0.orig/src/lib/accerciser/plugin/view.py
++++ accerciser-3.42.0/src/lib/accerciser/plugin/view.py
+@@ -20,7 +20,6 @@ from accerciser.tools import *
+ from .message import MessageManager
+ import os
+ import sys
+-import imp
+ from accerciser.i18n import _, N_
+ import gc
+ from accerciser import ui_manager
diff -Nru accerciser-3.42.0/debian/patches/series accerciser-3.42.0/debian/patches/series
--- accerciser-3.42.0/debian/patches/series 2022-08-03 08:50:52.000000000 +0100
+++ accerciser-3.42.0/debian/patches/series 2024-08-11 00:20:24.000000000 +0100
@@ -1 +1,2 @@
01_remove_site_package_version.patch
+remove-imp.patch
More information about the Pkg-a11y-devel
mailing list