From f8100d020e64eb91fd330a7b28e67370c737fb25 Mon Sep 17 00:00:00 2001 From: Pacho Ramos Date: Mon, 15 Jul 2024 20:54:58 +0200 Subject: app-accessibility/accerciser: Fix compat with python 3.12 Thanks-to: tusooa Thanks-to: Sam James Bug: https://bugs.gentoo.org/936018 Signed-off-by: Pacho Ramos --- .../accerciser/accerciser-3.42.0-r1.ebuild | 54 ++++++++++++++ .../files/accerciser-3.42.0-imp-module.patch | 83 ++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 app-accessibility/accerciser/accerciser-3.42.0-r1.ebuild create mode 100644 app-accessibility/accerciser/files/accerciser-3.42.0-imp-module.patch (limited to 'app-accessibility') diff --git a/app-accessibility/accerciser/accerciser-3.42.0-r1.ebuild b/app-accessibility/accerciser/accerciser-3.42.0-r1.ebuild new file mode 100644 index 000000000000..5da9754126c5 --- /dev/null +++ b/app-accessibility/accerciser/accerciser-3.42.0-r1.ebuild @@ -0,0 +1,54 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) +PYTHON_REQ_USE="xml(+)" + +inherit gnome2 python-single-r1 + +DESCRIPTION="Interactive Python accessibility explorer" +HOMEPAGE="https://wiki.gnome.org/Apps/Accerciser https://gitlab.gnome.org/GNOME/accerciser" + +LICENSE="BSD CC-BY-SA-3.0" +SLOT="0" +KEYWORDS="~amd64 ~x86" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +RDEPEND=" + >=app-accessibility/at-spi2-core-2.5.2:2 + >=x11-libs/gtk+-3.24.0:3[introspection] + $(python_gen_cond_dep ' + >=dev-python/pygobject-2.90.3:3[${PYTHON_USEDEP}] + >=dev-python/ipython-0.11[${PYTHON_USEDEP}] + >=dev-python/pyatspi-2.1.5[${PYTHON_USEDEP}] + dev-python/pycairo[${PYTHON_USEDEP}] + dev-python/python-xlib[${PYTHON_USEDEP}] + ') + + dev-libs/atk[introspection] + >=dev-libs/glib-2.28:2 + dev-libs/gobject-introspection:= + x11-libs/gdk-pixbuf[introspection] + x11-libs/libwnck:3[introspection] + x11-libs/pango[introspection] + gnome-base/librsvg[introspection] + ${PYTHON_DEPS} +" +DEPEND="${RDEPEND}" +BDEPEND=" + dev-util/itstool + >=sys-devel/gettext-0.19.8 + virtual/pkgconfig +" + +PATCHES=( + # Port from imp to importlib (from 'master') + "${FILESDIR}/${P}-imp-module.patch" +) + +src_install() { + gnome2_src_install + python_optimize +} diff --git a/app-accessibility/accerciser/files/accerciser-3.42.0-imp-module.patch b/app-accessibility/accerciser/files/accerciser-3.42.0-imp-module.patch new file mode 100644 index 000000000000..abcba67386c8 --- /dev/null +++ b/app-accessibility/accerciser/files/accerciser-3.42.0-imp-module.patch @@ -0,0 +1,83 @@ +diff '--color=auto' -ur accerciser-3.42.0.orig/plugins/validate.py accerciser-3.42.0/plugins/validate.py +--- accerciser-3.42.0.orig/plugins/validate.py 2024-07-15 20:46:50.173168139 +0200 ++++ accerciser-3.42.0/plugins/validate.py 2024-07-15 20:50:07.974258909 +0200 +@@ -20,7 +20,7 @@ + import traceback + import sys + import glob +-import imp ++import importlib + import webbrowser + from accerciser.plugin import ViewportPlugin + from accerciser.i18n import _, N_, DOMAIN +@@ -68,16 +68,18 @@ + ''' + 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, +- 'description' : _('No description')} ++ SCHEMA_METADATA[module_name] = {'name' : module, ++ 'description' : _('No description')} + + @staticmethod + def getValidators(name): +diff '--color=auto' -ur accerciser-3.42.0.orig/pyreqs.py accerciser-3.42.0/pyreqs.py +--- accerciser-3.42.0.orig/pyreqs.py 2024-07-15 20:46:50.170168156 +0200 ++++ accerciser-3.42.0/pyreqs.py 2024-07-15 20:50:27.235354799 +0200 +@@ -11,7 +11,7 @@ + this distribution, and is available at + U{http://www.opensource.org/licenses/bsd-license.php} + ''' +-import sys, os, imp ++import sys, os + + PYGTK_REQ = '2.0' + PYATSPI_REQ = (2, 23, 3) +Sólo en accerciser-3.42.0: pyreqs.py.orig +diff '--color=auto' -ur accerciser-3.42.0.orig/src/lib/accerciser/plugin/plugin_manager.py accerciser-3.42.0/src/lib/accerciser/plugin/plugin_manager.py +--- accerciser-3.42.0.orig/src/lib/accerciser/plugin/plugin_manager.py 2024-07-15 20:46:50.169168161 +0200 ++++ accerciser-3.42.0/src/lib/accerciser/plugin/plugin_manager.py 2024-07-15 20:47:28.027960768 +0200 +@@ -23,7 +23,7 @@ + from .message import MessageManager + import os + import sys +-import imp ++import importlib + import traceback + from accerciser.i18n import _, N_, C_ + +@@ -136,8 +136,7 @@ + ''' + 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, +diff '--color=auto' -ur accerciser-3.42.0.orig/src/lib/accerciser/plugin/view.py accerciser-3.42.0/src/lib/accerciser/plugin/view.py +--- accerciser-3.42.0.orig/src/lib/accerciser/plugin/view.py 2024-07-15 20:46:50.170168156 +0200 ++++ accerciser-3.42.0/src/lib/accerciser/plugin/view.py 2024-07-15 20:47:28.028960763 +0200 +@@ -20,7 +20,6 @@ + from .message import MessageManager + import os + import sys +-import imp + from accerciser.i18n import _, N_ + import gc + from accerciser import ui_manager -- cgit v1.2.3-65-gdbad