Date: Fri, 05 Jun 2026 20:03:08 +0000 From: Kurt Jaeger <pi@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Cc: Christian Ullrich <chris@chrullrich.net> Subject: git: 72e62f44217f - main - textproc/dblatex: fix build with python 3.12 (and probably newer versions) Message-ID: <6a232b7c.368b8.618da6c3@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by pi: URL: https://cgit.FreeBSD.org/ports/commit/?id=72e62f44217ffa80f8845512b4ea09c34e0fbc5f commit 72e62f44217ffa80f8845512b4ea09c34e0fbc5f Author: Christian Ullrich <chris@chrullrich.net> AuthorDate: 2026-06-05 19:58:38 +0000 Commit: Kurt Jaeger <pi@FreeBSD.org> CommitDate: 2026-06-05 20:02:59 +0000 textproc/dblatex: fix build with python 3.12 (and probably newer versions) Patches used: - https://sourceforge.net/p/dblatex/patches/12/ by Miro HronĨok - https://sourceforge.net/p/dblatex/patches/13/ by Michael J Gruber PR: 291803 Reported-by: D'Arcy J.M. Cain <darcy@druid.net> Obtained-from: https://sourceforge.net/projects/dblatex/ Author: Christian Ullrich <chris@chrullrich.net> --- .../dblatex/files/patch-lib_dbtexmf_core_dbtex.py | 36 ++++++++++++++++++++ .../patch-lib_dbtexmf_dblatex_grubber_plugins.py | 38 ++++++++++++++++++++++ .../dblatex/files/patch-lib_dbtexmf_xslt_xslt.py | 36 ++++++++++++++++++++ 3 files changed, 110 insertions(+) diff --git a/textproc/dblatex/files/patch-lib_dbtexmf_core_dbtex.py b/textproc/dblatex/files/patch-lib_dbtexmf_core_dbtex.py new file mode 100644 index 000000000000..c28d09d6b0a6 --- /dev/null +++ b/textproc/dblatex/files/patch-lib_dbtexmf_core_dbtex.py @@ -0,0 +1,36 @@ +--- lib/dbtexmf/core/dbtex.py.orig 2025-12-19 19:39:32 UTC ++++ lib/dbtexmf/core/dbtex.py +@@ -15,7 +15,8 @@ import glob + except ImportError: + from urllib.request import pathname2url + import glob +-import imp ++import importlib.machinery ++import importlib.util + from optparse import OptionParser + from io import open + +@@ -540,15 +541,14 @@ class DbTexCommand: + + def load_plugin(self, pathname): + moddir, modname = os.path.split(pathname) +- try: +- filemod, path, descr = imp.find_module(modname, [moddir]) +- except ImportError: +- try: +- filemod, path, descr = imp.find_module(modname) +- except ImportError: +- failed_exit("Error: '%s' module not found" % modname) +- mod = imp.load_module(modname, filemod, path, descr) +- filemod.close() ++ spec = importlib.machinery.PathFinder.find_spec(modname, [moddir]) ++ if not spec: ++ spec = importlib.machinery.PathFinder.find_spec(modname) ++ if not spec: ++ failed_exit("Error: '%s' module not found" % modname) ++ mod = importlib.util.module_from_spec(spec) ++ spec.loader.exec_module(mod) ++ sys.modules[modname] = mod + return mod + + def run_setup(self, options): diff --git a/textproc/dblatex/files/patch-lib_dbtexmf_dblatex_grubber_plugins.py b/textproc/dblatex/files/patch-lib_dbtexmf_dblatex_grubber_plugins.py new file mode 100644 index 000000000000..ac232a848b87 --- /dev/null +++ b/textproc/dblatex/files/patch-lib_dbtexmf_dblatex_grubber_plugins.py @@ -0,0 +1,38 @@ +--- lib/dbtexmf/dblatex/grubber/plugins.py.orig 2025-12-19 19:39:46 UTC ++++ lib/dbtexmf/dblatex/grubber/plugins.py +@@ -4,7 +4,8 @@ All the modules must be derived from the TexModule cla + Mechanisms to dynamically load extra modules to help the LaTeX compilation. + All the modules must be derived from the TexModule class. + """ +-import imp ++import importlib.machinery ++import importlib.util + + from os.path import * + from dbtexmf.dblatex.grubber.msg import _, msg +@@ -108,17 +109,16 @@ class Plugins (object): + """ + if name in self.modules: + return 2 +- try: +- file, path, descr = imp.find_module(name, [""]) +- except ImportError: ++ spec = importlib.machinery.PathFinder.find_spec(name, [""]) ++ if not spec: + if not self.path: + return 0 +- try: +- file, path, descr = imp.find_module(name, self.path) +- except ImportError: +- return 0 +- module = imp.load_module(name, file, path, descr) +- file.close() ++ spec = importlib.machinery.PathFinder.find_spec(name, self.path) ++ if not spec: ++ return 0 ++ module = importlib.util.module_from_spec(spec) ++ spec.loader.exec_module(module) ++ sys.modules[name] = module + self.modules[name] = module + return 1 + diff --git a/textproc/dblatex/files/patch-lib_dbtexmf_xslt_xslt.py b/textproc/dblatex/files/patch-lib_dbtexmf_xslt_xslt.py new file mode 100644 index 000000000000..a04eac49e36f --- /dev/null +++ b/textproc/dblatex/files/patch-lib_dbtexmf_xslt_xslt.py @@ -0,0 +1,36 @@ +--- lib/dbtexmf/xslt/xslt.py.orig 2025-12-19 19:39:14 UTC ++++ lib/dbtexmf/xslt/xslt.py +@@ -2,20 +2,22 @@ import os + # Very simple plugin loader for Xslt classes + # + import os +-import imp ++import importlib.machinery ++import importlib.util + import glob ++import sys + + def load(modname): +- try: +- file, path, descr = imp.find_module(modname, [""]) +- except ImportError: +- try: +- file, path, descr = imp.find_module(modname, +- [os.path.dirname(__file__)]) +- except ImportError: +- raise ValueError("Xslt '%s' not found" % modname) +- mod = imp.load_module(modname, file, path, descr) +- file.close() ++ spec = importlib.machinery.PathFinder.find_spec(modname, [""]) ++ if not spec: ++ spec = importlib.machinery.PathFinder.find_spec(modname, ++ [os.path.dirname(__file__)]) ++ if not spec: ++ raise ValueError("Xslt '%s' not found" % modname) ++ ++ mod = importlib.util.module_from_spec(spec) ++ spec.loader.exec_module(mod) ++ sys.modules[modname] = mod + o = mod.Xslt() + return o +home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a232b7c.368b8.618da6c3>
