[packages/dblatex/DEVEL-py3] - updated to 0.3.12 + some Fedora patches; requires testing if still works with ancient TexLive

qboosh qboosh at pld-linux.org
Sun Aug 9 12:49:33 CEST 2026


commit d4ee513e2285fd6cce6a3bf94a95f4dcd8e07511
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Aug 9 12:49:20 2026 +0200

    - updated to 0.3.12 + some Fedora patches; requires testing if still works with ancient TexLive

 dblatex-adjust-submodule-imports.patch         |  62 ++++++++++++++
 dblatex-nodebian.patch                         |  14 +--
 dblatex-remove-shebangs-from-non-scripts.patch |  44 ++++++++++
 dblatex-replace-imp-by-importlib.patch         | 113 +++++++++++++++++++++++++
 dblatex-which-shutil.patch                     |  42 +++++++++
 dblatex.spec                                   |  47 +++++-----
 6 files changed, 289 insertions(+), 33 deletions(-)
---
diff --git a/dblatex.spec b/dblatex.spec
index 06a9dc3..0c7378f 100644
--- a/dblatex.spec
+++ b/dblatex.spec
@@ -1,16 +1,21 @@
 Summary:	Convert DocBook to LaTeX, DVI, PostScript, and PDF
 Summary(pl.UTF-8):	Przekształcanie DocBooka do LaTeXa, DVI, PostScriptu i PDF
 Name:		dblatex
-Version:	0.3.9
+Version:	0.3.12
 Release:	1
 License:	GPL v2+
 Group:		Applications/Publishing
-Source0:	https://downloads.sourceforge.net/dblatex/%{name}-%{version}.tar.bz2
-# Source0-md5:	38e9fd93dd37d71e352010ad40e1dfb4
+Source0:	https://downloads.sourceforge.net/dblatex/%{name}3-%{version}.tar.bz2
+# Source0-md5:	550adafd078432ff144b57d90c647714
 Patch0:		%{name}-nodebian.patch
+# from Fedora
+Patch1:		%{name}-which-shutil.patch
+Patch2:		%{name}-replace-imp-by-importlib.patch
+Patch3:		%{name}-adjust-submodule-imports.patch
+Patch4:		%{name}-remove-shebangs-from-non-scripts.patch
 URL:		https://dblatex.sourceforge.net/
-BuildRequires:	python >= 2
-BuildRequires:	python-setuptools
+BuildRequires:	python3 >= 1:3.2
+BuildRequires:	python3-setuptools
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.717
 BuildRequires:	texlive-latex-ams
@@ -20,7 +25,7 @@ BuildRequires:	texlive-latex-extend
 BuildRequires:	texlive-latex-wasysym
 BuildRequires:	texlive-makeindex
 BuildRequires:	transfig
-Requires:	python-modules >= 2
+Requires:	python3-modules >= 1:3.2
 Requires:	texlive-fonts-rsfs
 Requires:	texlive-format-pdflatex
 Requires:	texlive-latex-ams
@@ -44,8 +49,12 @@ najpierw do czystego LaTeXa. Obsługiwane są także znaczniki MathML
 2.0.
 
 %prep
-%setup -q
+%setup -q -n %{name}3-%{version}
 %patch -P0 -p1
+%patch -P1 -p1
+%patch -P2 -p1
+%patch -P3 -p1
+%patch -P4 -p1
 
 %build
 #%%py_build
@@ -56,14 +65,13 @@ rm -rf $RPM_BUILD_ROOT
 
 # dblatex script hackery in setup.py doesn't work with split build/install stages
 # nor "build --build-base ... install" args
-%{__python} setup.py install \
-	%{py_install_opts} \
+%{__python3} setup.py install \
+	%{py3_install_opts} \
 	--root=$RPM_BUILD_ROOT
 
 %py_postclean
 
-# fix #!/usr/bin/env python -> #!/usr/bin/python:
-%{__sed} -i -e '1s,^#!.*python,#!%{__python},' $RPM_BUILD_ROOT%{_bindir}/%{name}
+%{__sed} -i -e '1s,/usr/bin/env python3,%{__python3},' $RPM_BUILD_ROOT%{_bindir}/%{name}
 
 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/doc
 
@@ -74,20 +82,7 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %doc COPYRIGHT docs/{manual,release-notes}.pdf
 %attr(755,root,root) %{_bindir}/dblatex
-%dir %{py_sitescriptdir}/dbtexmf
-%{py_sitescriptdir}/dbtexmf/*.py[co]
-%dir %{py_sitescriptdir}/dbtexmf/core
-%{py_sitescriptdir}/dbtexmf/core/*.py[co]
-%{py_sitescriptdir}/dbtexmf/core/sgmlent.txt
-%dir %{py_sitescriptdir}/dbtexmf/dblatex
-%{py_sitescriptdir}/dbtexmf/dblatex/*.py[co]
-%dir %{py_sitescriptdir}/dbtexmf/dblatex/grubber
-%{py_sitescriptdir}/dbtexmf/dblatex/grubber/*.py[co]
-%{py_sitescriptdir}/dbtexmf/dblatex/grubber/xindylang.xml
-%dir %{py_sitescriptdir}/dbtexmf/dblatex/xetex
-%{py_sitescriptdir}/dbtexmf/dblatex/xetex/*.py[co]
-%dir %{py_sitescriptdir}/dbtexmf/xslt
-%{py_sitescriptdir}/dbtexmf/xslt/*.py[co]
-%{py_sitescriptdir}/dblatex-*.egg-info
+%{py3_sitescriptdir}/dbtexmf
+%{py3_sitescriptdir}/dblatex-%{version}-py*.egg-info
 %{_datadir}/%{name}
 %{_mandir}/man1/dblatex.1*
diff --git a/dblatex-adjust-submodule-imports.patch b/dblatex-adjust-submodule-imports.patch
new file mode 100644
index 0000000..9a09ede
--- /dev/null
+++ b/dblatex-adjust-submodule-imports.patch
@@ -0,0 +1,62 @@
+From f5ce76603178e5465a744cb4feed4686489bebb9 Mon Sep 17 00:00:00 2001
+Message-ID: <f5ce76603178e5465a744cb4feed4686489bebb9.1688648379.git.github at grubix.eu>
+From: Michael J Gruber <github at grubix.eu>
+Date: Thu, 6 Jul 2023 14:58:03 +0200
+Subject: [PATCH] Python 3.12 compatibility: adjust submodule imports
+
+importlib imports behave differently in py 3.11 and py 3.12: py 3.12
+requires explicit imports of the submodules.
+
+While fixing this, reduce the imports to the used submodules. Currently,
+the base is still imported automatically.
+---
+ lib/dbtexmf/core/dbtex.py              | 3 ++-
+ lib/dbtexmf/dblatex/grubber/plugins.py | 3 ++-
+ lib/dbtexmf/xslt/xslt.py               | 3 ++-
+ 3 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/lib/dbtexmf/core/dbtex.py b/lib/dbtexmf/core/dbtex.py
+index adac781..4cf9591 100644
+--- a/lib/dbtexmf/core/dbtex.py
++++ b/lib/dbtexmf/core/dbtex.py
+@@ -15,7 +15,8 @@ try:
+ except ImportError:
+     from urllib.request import pathname2url
+ import glob
+-import importlib
++import importlib.machinery
++import importlib.util
+ from optparse import OptionParser
+ from io import open
+ 
+diff --git a/lib/dbtexmf/dblatex/grubber/plugins.py b/lib/dbtexmf/dblatex/grubber/plugins.py
+index 047f2bb..6b4ecb4 100644
+--- a/lib/dbtexmf/dblatex/grubber/plugins.py
++++ b/lib/dbtexmf/dblatex/grubber/plugins.py
+@@ -4,7 +4,8 @@
+ Mechanisms to dynamically load extra modules to help the LaTeX compilation.
+ All the modules must be derived from the TexModule class.
+ """
+-import importlib
++import importlib.machinery
++import importlib.util
+ 
+ from os.path import *
+ from dbtexmf.dblatex.grubber.msg import _, msg
+diff --git a/lib/dbtexmf/xslt/xslt.py b/lib/dbtexmf/xslt/xslt.py
+index 57c99a2..7cc2038 100644
+--- a/lib/dbtexmf/xslt/xslt.py
++++ b/lib/dbtexmf/xslt/xslt.py
+@@ -2,7 +2,8 @@
+ # Very simple plugin loader for Xslt classes
+ #
+ import os
+-import importlib
++import importlib.machinery
++import importlib.util
+ import glob
+ import sys
+ 
+-- 
+2.41.0.411.gd9071d4297
+
diff --git a/dblatex-nodebian.patch b/dblatex-nodebian.patch
index 6c4580b..92e7619 100644
--- a/dblatex-nodebian.patch
+++ b/dblatex-nodebian.patch
@@ -1,6 +1,6 @@
---- dblatex-0.3.4/setup.py.orig	2012-06-03 01:43:42.000000000 +0200
-+++ dblatex-0.3.4/setup.py	2012-09-27 18:26:56.603121631 +0200
-@@ -23,7 +23,6 @@
+--- dblatex3-0.3.12/setup.py.orig	2020-11-29 18:50:08.000000000 +0100
++++ dblatex3-0.3.12/setup.py	2026-08-08 21:05:24.344079006 +0200
+@@ -25,7 +25,6 @@ from distutils.command.sdist import sdis
  from distutils import log
  from subprocess import Popen, PIPE
  sys.path.append("lib")
@@ -8,7 +8,7 @@
  
  #
  # Build the command line script
-@@ -365,12 +364,8 @@
+@@ -373,12 +372,8 @@ class Install(install):
              raise OSError("not found: %s" % ", ".join(mis_stys))
  
      def run(self):
@@ -22,15 +22,15 @@
              try:
                  self.check_xslt_dependencies()
                  self.check_util_dependencies()
-@@ -379,7 +374,6 @@
-                 print >>sys.stderr, "Error: %s" % e
+@@ -387,7 +382,6 @@ class Install(install):
+                 print("Error: %s" % e, file=sys.stderr)
                  sys.exit(1)
  
 -        if db: db.adapt_paths()
  
          # If no build is required, at least build the script
          if self.skip_build:
-@@ -387,7 +381,6 @@
+@@ -395,7 +389,6 @@ class Install(install):
  
          install.run(self)
  
diff --git a/dblatex-remove-shebangs-from-non-scripts.patch b/dblatex-remove-shebangs-from-non-scripts.patch
new file mode 100644
index 0000000..1e82c30
--- /dev/null
+++ b/dblatex-remove-shebangs-from-non-scripts.patch
@@ -0,0 +1,44 @@
+From 52f0949e92ab898978baafaa341d43896ffcb8c7 Mon Sep 17 00:00:00 2001
+Message-ID: <52f0949e92ab898978baafaa341d43896ffcb8c7.1753130592.git.github at grubix.eu>
+From: Michael J Gruber <github at grubix.eu>
+Date: Mon, 21 Jul 2025 22:41:48 +0200
+Subject: [PATCH] remove shebangs from non-scripts
+
+These python files are pure modules without any code to be called as
+script, so remove the shebangs.
+---
+ lib/dbtexmf/dblatex/xetex/fontspec.py  | 1 -
+ lib/dbtexmf/dblatex/xetex/fsconfig.py  | 1 -
+ lib/dbtexmf/dblatex/xetex/fsencoder.py | 1 -
+ 3 files changed, 3 deletions(-)
+
+diff --git a/lib/dbtexmf/dblatex/xetex/fontspec.py b/lib/dbtexmf/dblatex/xetex/fontspec.py
+index 767d003..3bda923 100644
+--- a/lib/dbtexmf/dblatex/xetex/fontspec.py
++++ b/lib/dbtexmf/dblatex/xetex/fontspec.py
+@@ -1,4 +1,3 @@
+-#!/usr/bin/env python
+ # -*- coding: utf-8 -*-
+ # Time-stamp: <2008-06-23 22:21:26 ah>
+ 
+diff --git a/lib/dbtexmf/dblatex/xetex/fsconfig.py b/lib/dbtexmf/dblatex/xetex/fsconfig.py
+index 2b9fa7d..0b475c9 100644
+--- a/lib/dbtexmf/dblatex/xetex/fsconfig.py
++++ b/lib/dbtexmf/dblatex/xetex/fsconfig.py
+@@ -1,4 +1,3 @@
+-#!/usr/bin/env python
+ # -*- coding: utf-8 -*-
+ # Time-stamp: <2008-06-23 22:21:26 ah>
+ 
+diff --git a/lib/dbtexmf/dblatex/xetex/fsencoder.py b/lib/dbtexmf/dblatex/xetex/fsencoder.py
+index b22e59b..f685c43 100644
+--- a/lib/dbtexmf/dblatex/xetex/fsencoder.py
++++ b/lib/dbtexmf/dblatex/xetex/fsencoder.py
+@@ -1,4 +1,3 @@
+-#!/usr/bin/env python
+ # -*- coding: utf-8 -*-
+ # Time-stamp: <2008-06-23 22:21:26 ah>
+ from __future__ import print_function
+-- 
+2.50.1.480.g41fff1fbcf
+
diff --git a/dblatex-replace-imp-by-importlib.patch b/dblatex-replace-imp-by-importlib.patch
new file mode 100644
index 0000000..0531733
--- /dev/null
+++ b/dblatex-replace-imp-by-importlib.patch
@@ -0,0 +1,113 @@
+diff --git a/lib/dbtexmf/core/dbtex.py b/lib/dbtexmf/core/dbtex.py
+index b3ec732..adac781 100644
+--- a/lib/dbtexmf/core/dbtex.py
++++ b/lib/dbtexmf/core/dbtex.py
+@@ -15,7 +15,7 @@ try:
+ except ImportError:
+     from urllib.request import pathname2url
+ import glob
+-import imp
++import importlib
+ from optparse import OptionParser
+ from io import open
+ 
+@@ -540,15 +540,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/lib/dbtexmf/dblatex/grubber/plugins.py b/lib/dbtexmf/dblatex/grubber/plugins.py
+index 9e333c9..047f2bb 100644
+--- a/lib/dbtexmf/dblatex/grubber/plugins.py
++++ b/lib/dbtexmf/dblatex/grubber/plugins.py
+@@ -4,7 +4,7 @@
+ 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
+ 
+ from os.path import *
+ from dbtexmf.dblatex.grubber.msg import _, msg
+@@ -108,17 +108,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/lib/dbtexmf/xslt/xslt.py b/lib/dbtexmf/xslt/xslt.py
+index 0350e30..57c99a2 100644
+--- a/lib/dbtexmf/xslt/xslt.py
++++ b/lib/dbtexmf/xslt/xslt.py
+@@ -2,20 +2,21 @@
+ # Very simple plugin loader for Xslt classes
+ #
+ import os
+-import imp
++import importlib
+ 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
+ 
diff --git a/dblatex-which-shutil.patch b/dblatex-which-shutil.patch
new file mode 100644
index 0000000..37f4f36
--- /dev/null
+++ b/dblatex-which-shutil.patch
@@ -0,0 +1,42 @@
+From af5dc6ec530b107a4a0bd6ac9b2e80b0e7d36077 Mon Sep 17 00:00:00 2001
+Message-Id: <af5dc6ec530b107a4a0bd6ac9b2e80b0e7d36077.1569226914.git.github at grubix.eu>
+In-Reply-To: <49b85799a8f0674ac5eb6f2dfc37b23208d9754a.1569226914.git.github at grubix.eu>
+References: <49b85799a8f0674ac5eb6f2dfc37b23208d9754a.1569226914.git.github at grubix.eu>
+From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro at redhat.com>
+Date: Tue, 26 Jun 2018 17:41:19 +0200
+Subject: [PATCH 13/13] Use which from shutil
+
+Signed-off-by: Michael J Gruber <github at grubix.eu>
+---
+ setup.py | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 86619ec..799c1d2 100644
+--- a/setup.py
++++ b/setup.py
+@@ -208,17 +208,15 @@ class Build(build):
+ 
+ 
+ def find_programs(utils):
+-    sys.path.append("lib")
+-    from contrib.which import which
++    import shutil
+     util_paths = {}
+     missed = []
+     for util in utils:
+-        try:
+-            path = which.which(util)
++        path = shutil.which(util)
++        if path:
+             util_paths[util] = path
+-        except which.WhichError:
++        else:
+             missed.append(util)
+-    sys.path.remove("lib")
+     return (util_paths, missed)
+ 
+ def kpsewhich(tex_file):
+-- 
+2.23.0.369.g5d0cb2d495
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/dblatex.git/commitdiff/d4ee513e2285fd6cce6a3bf94a95f4dcd8e07511



More information about the pld-cvs-commit mailing list