diff -Nru gramps-5.1.6+dfsg/debian/changelog gramps-5.1.6+dfsg/debian/changelog --- gramps-5.1.6+dfsg/debian/changelog 2023-10-11 18:56:55.000000000 +0000 +++ gramps-5.1.6+dfsg/debian/changelog 2024-03-14 20:09:56.000000000 +0000 @@ -1,3 +1,9 @@ +gramps (5.1.6+dfsg-1ubuntu1) noble; urgency=medium + + * Apply patches to fix FTBFS with Python 3.12 (Closes: #1061743) + + -- Ross Gammon Thu, 14 Mar 2024 21:09:56 +0100 + gramps (5.1.6+dfsg-1) unstable; urgency=medium [ IOhannes m zmölnig ] diff -Nru gramps-5.1.6+dfsg/debian/patches/python3_12.patch gramps-5.1.6+dfsg/debian/patches/python3_12.patch --- gramps-5.1.6+dfsg/debian/patches/python3_12.patch 1970-01-01 00:00:00.000000000 +0000 +++ gramps-5.1.6+dfsg/debian/patches/python3_12.patch 2024-03-14 19:47:47.000000000 +0000 @@ -0,0 +1,175 @@ +Description: Fix FTBFS withPython 3.12 + When running in command line mode, the Gedcom and ProGen importers + were being run before the `gi.require_version` method, causing + Gtk 4.0 to be incorrectly loaded. This caused some unit tests to + fail. + Caused Gramps to be removed from Debian Testing and Ubuntu Noble. + Debian Bug - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1061743 + Also needed to backport 2 commits from the Gramps 5.2 branch: + https://github.com/gramps-project/gramps/commit/47f392ef70618cfece86e5210c19c2c1a768a4e0 + https://github.com/gramps-project/gramps/commit/d5dd8d698cdd6cb0ca0e080743fa9b0e2c64a391 +Origin: https://github.com/gramps-project/gramps/pull/1672 +Bug: https://gramps-project.org/bugs/view.php?id=13212 +Last-Update: 2024-03-10 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: gramps-5.1.6+dfsg/gramps/plugins/db/dbapi/dbapi.py +=================================================================== +--- gramps-5.1.6+dfsg.orig/gramps/plugins/db/dbapi/dbapi.py ++++ gramps-5.1.6+dfsg/gramps/plugins/db/dbapi/dbapi.py +@@ -968,7 +968,7 @@ class DBAPI(DbGeneric): + """ + Create secondary columns. + """ +- LOG.info("Creating secondary columns...") ++ LOG.debug("Creating secondary columns...") + for cls in (Person, Family, Event, Place, Repository, Source, + Citation, Media, Note, Tag): + table_name = cls.__name__.lower() +Index: gramps-5.1.6+dfsg/gramps/plugins/importer/importgedcom.py +=================================================================== +--- gramps-5.1.6+dfsg.orig/gramps/plugins/importer/importgedcom.py ++++ gramps-5.1.6+dfsg/gramps/plugins/importer/importgedcom.py +@@ -37,7 +37,6 @@ LOG = logging.getLogger(".GedcomImport") + from gramps.gen.const import GRAMPS_LOCALE as glocale + _ = glocale.translation.gettext + from gramps.gen.errors import DbError, GedcomError +-from gramps.gui.glade import Glade + from gramps.plugins.lib.libmixin import DbMixin + from gramps.plugins.lib import libgedcom + from gramps.gen.utils.libformatting import ImportInfo +@@ -47,8 +46,8 @@ from gramps.gen.utils.libformatting impo + # 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 + +@@ -94,6 +93,8 @@ def importData(database, filename, user) + return + + if not gramps and ansel and user.uistate: ++ from gramps.gui.glade import Glade ++ + top = Glade() + code = top.get_object('codeset') + code.set_active(0) +Index: gramps-5.1.6+dfsg/gramps/plugins/importer/importprogen.py +=================================================================== +--- gramps-5.1.6+dfsg.orig/gramps/plugins/importer/importprogen.py ++++ gramps-5.1.6+dfsg/gramps/plugins/importer/importprogen.py +@@ -26,6 +26,9 @@ + # + #------------------------------------------------------------------------- + import os, time ++import gi ++ ++gi.require_version("Gtk", "3.0") + from gi.repository import Gtk, Gdk + + #------------------------------------------------------------------------ +Index: gramps-5.1.6+dfsg/gramps/gen/plug/_manager.py +=================================================================== +--- gramps-5.1.6+dfsg.orig/gramps/gen/plug/_manager.py ++++ gramps-5.1.6+dfsg/gramps/gen/plug/_manager.py +@@ -372,13 +372,9 @@ class BasePluginManager: + 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] +Index: gramps-5.1.6+dfsg/gramps/gen/utils/grampslocale.py +=================================================================== +--- gramps-5.1.6+dfsg.orig/gramps/gen/utils/grampslocale.py ++++ gramps-5.1.6+dfsg/gramps/gen/utils/grampslocale.py +@@ -264,7 +264,7 @@ class GrampsLocale: + self.lang = loc[0] + self.encoding = loc[1] + else: +- (lang, loc) = _check_mswin_locale(locale.getdefaultlocale()[0]) ++ (lang, loc) = _check_mswin_locale(locale.getlocale()[0]) + if lang: + self.lang = lang + self.encoding = loc[1] +@@ -352,7 +352,7 @@ class GrampsLocale: + _failure = False + try: + locale.setlocale(locale.LC_ALL, '') +- if not _check_locale(locale.getdefaultlocale(envvars=('LC_ALL', 'LANG', 'LANGUAGE'))): ++ if not _check_locale(locale.getlocale(category=locale.LC_MESSAGES)): + LOG.debug("Usable locale not found, localization settings ignored."); + self.lang = 'C' + self.encoding = 'ascii' +@@ -978,22 +978,14 @@ class GrampsLocale: + from ..lib.grampstype import GrampsType + return GrampsType.xml_str(name) + +- def format(self, format, val, grouping=False, monetary=False): +- """ +- Format a number in the current numeric locale. See python's +- locale.format for details. ICU's formatting codes are +- incompatible with locale's, so just use locale.format for now. +- """ +- return locale.format(format, val, grouping, monetary) +- +- def format_string(self, format, val, grouping=False): ++ def format_string(self, fmt, val, grouping=False, monetary=False): + """ + Format a string in the current numeric locale. See python's + locale.format_string for details. ICU's message formatting codes are + incompatible with locale's, so just use locale.format_string + for now. + """ +- return locale.format_string(format, val, grouping) ++ return locale.format_string(fmt, val, grouping, monetary) + + def float(self, val): + """ +Index: gramps-5.1.6+dfsg/gramps/plugins/gramplet/pedigreegramplet.py +=================================================================== +--- gramps-5.1.6+dfsg.orig/gramps/plugins/gramplet/pedigreegramplet.py ++++ gramps-5.1.6+dfsg/gramps/plugins/gramplet/pedigreegramplet.py +@@ -260,13 +260,13 @@ class PedigreeGramplet(Gramplet): + if g == 0: + self.link(_("Generation 1"), 'PersonList', handles, + tooltip=_("Double-click to see people in generation")) +- percent = glocale.format('%.2f', 100) + percent_sign ++ percent = glocale.format_string('%.2f', 100) + percent_sign + self.append_text(_(" has 1 of 1 individual (%(percent)s complete)\n") % {'percent': percent}) + else: + all.extend(handles) + self.link(_("Generation %d") % g, 'PersonList', handles, + tooltip=_("Double-click to see people in generation %d") % g) +- percent = glocale.format('%.2f', float(count)/2**(g-1) * 100) + percent_sign ++ percent = glocale.format_string('%.2f', float(count)/2**(g-1) * 100) + percent_sign + self.append_text( + # translators: leave all/any {...} untranslated + ngettext(" has {count_person} of {max_count_person} " +Index: gramps-5.1.6+dfsg/gramps/plugins/textreport/numberofancestorsreport.py +=================================================================== +--- gramps-5.1.6+dfsg.orig/gramps/plugins/textreport/numberofancestorsreport.py ++++ gramps-5.1.6+dfsg/gramps/plugins/textreport/numberofancestorsreport.py +@@ -115,7 +115,7 @@ class NumberOfAncestorsReport(Report): + gen += 1 + theoretical = math.pow(2, (gen - 1)) + total_theoretical += theoretical +- percent = '(%s%%)' % self._locale.format( ++ percent = '(%s%%)' % self._locale.format_string( + '%3.2f', ((sum(thisgen.values()) / theoretical) * 100)) + + # TC # English return something like: diff -Nru gramps-5.1.6+dfsg/debian/patches/series gramps-5.1.6+dfsg/debian/patches/series --- gramps-5.1.6+dfsg/debian/patches/series 2023-10-11 18:56:55.000000000 +0000 +++ gramps-5.1.6+dfsg/debian/patches/series 2024-03-10 17:57:33.000000000 +0000 @@ -3,3 +3,4 @@ Drop_failing_import_test.patch maps-Switch-to-geocode-glib-2.0.patch Skip_test_one.patch +python3_12.patch