From 1ec32297e211be31c7a1bbb810f838b3efe7a082 Mon Sep 17 00:00:00 2001 From: Tim Sandquist Date: Fri, 9 Feb 2024 08:12:05 -0600 Subject: [PATCH] gramps: Replace deprecated imp by importlib --- srcpkgs/gramps/patches/1411.patch | 47 +++++++++++++++++++++++++++++++ srcpkgs/gramps/template | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/gramps/patches/1411.patch diff --git a/srcpkgs/gramps/patches/1411.patch b/srcpkgs/gramps/patches/1411.patch new file mode 100644 index 0000000000000..3179f76c70a67 --- /dev/null +++ b/srcpkgs/gramps/patches/1411.patch @@ -0,0 +1,47 @@ +https://github.com/gramps-project/gramps/pull/1411 +From 47f392ef70618cfece86e5210c19c2c1a768a4e0 Mon Sep 17 00:00:00 2001 +From: David Straub +Date: Mon, 6 Feb 2023 17:12:28 +0100 +Subject: [PATCH] Replace deprecated imp by importlib + +--- + gramps/gen/plug/_manager.py | 10 +++------- + gramps/plugins/importer/importgedcom.py | 4 ++-- + 2 files changed, 5 insertions(+), 9 deletions(-) + +diff --git a/gramps/gen/plug/_manager.py b/gramps/gen/plug/_manager.py +index 1077de0cdb..16474d5b6e 100644 +--- a/gramps/gen/plug/_manager.py ++++ b/gramps/gen/plug/_manager.py +@@ -372,13 +372,9 @@ def reload(self, module, pdata): + Reloads modules that might not be in the path. + """ + try: +- import imp +- fp, pathname, description = imp.find_module(pdata.mod_name, [pdata.fpath]) +- try: +- module = imp.load_module(pdata.mod_name, fp, pathname,description) +- finally: +- if fp: +- fp.close() ++ spec = importlib.util.find_spec(pdata.mod_name, [pdata.fpath]) ++ module = importlib.util.module_from_spec(spec) ++ spec.loader.exec_module(module) + except: + if pdata.mod_name in sys.modules: + del sys.modules[pdata.mod_name] +diff --git a/gramps/plugins/importer/importgedcom.py b/gramps/plugins/importer/importgedcom.py +index ac2c604447..f2fa7fd5a4 100644 +--- a/gramps/plugins/importer/importgedcom.py ++++ b/gramps/plugins/importer/importgedcom.py +@@ -47,8 +47,8 @@ + # a quick turnround, without having to restart Gramps. + module = __import__("gramps.plugins.lib.libgedcom", + fromlist=["gramps.plugins.lib"]) # why o why ?? as above! +-import imp +-imp.reload(module) ++import importlib ++importlib.reload(module) + + from gramps.gen.config import config + diff --git a/srcpkgs/gramps/template b/srcpkgs/gramps/template index 375d995c94a89..25d28d1d7a2f4 100644 --- a/srcpkgs/gramps/template +++ b/srcpkgs/gramps/template @@ -1,7 +1,7 @@ # Template file for 'gramps' pkgname=gramps version=5.1.6 -revision=1 +revision=2 build_style=python3-module hostmakedepends="pkg-config intltool python3-setuptools" depends="gtk+3 python3-gobject python3-bsddb3 python3-PyICU python3-jsonschema python3-lxml"