Compare commits

..

No commits in common. 'c9' and 'cs10' have entirely different histories.
c9 ... cs10

@ -0,0 +1,62 @@
From f5ce76603178e5465a744cb4feed4686489bebb9 Mon Sep 17 00:00:00 2001
Message-ID: <f5ce76603178e5465a744cb4feed4686489bebb9.1688648379.git.github@grubix.eu>
From: Michael J Gruber <github@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

@ -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

@ -1,6 +1,16 @@
## START: Set by rpmautospec
## (rpmautospec version 0.6.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 22;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
Name: dblatex Name: dblatex
Version: 0.3.12 Version: 0.3.12
Release: 4%{?dist} Release: %autorelease
Summary: DocBook to LaTeX/ConTeXt Publishing Summary: DocBook to LaTeX/ConTeXt Publishing
BuildArch: noarch BuildArch: noarch
# Most of package is GPLv2+, except: # Most of package is GPLv2+, except:
@ -9,7 +19,7 @@ BuildArch: noarch
# latex/misc/enumitem.sty, multirow2.sry and ragged2e.sty are LPPL # latex/misc/enumitem.sty, multirow2.sry and ragged2e.sty are LPPL
# latex/misc/lastpage.sty is GPLv2 (no +) # latex/misc/lastpage.sty is GPLv2 (no +)
# latex/misc/passivetex is MIT (not included in binary RPM so not listed) # latex/misc/passivetex is MIT (not included in binary RPM so not listed)
License: GPLv2+ and GPLv2 and LPPL and DMIT and Public Domain License: GPL-2.0-or-later AND GPL-2.0-only AND LPPL-1.3a AND LicenseRef-DMIT AND LicenseRef-Fedora-Public-Domain
URL: http://dblatex.sourceforge.net/ URL: http://dblatex.sourceforge.net/
Source0: http://downloads.sourceforge.net/%{name}/%{name}3-%{version}.tar.bz2 Source0: http://downloads.sourceforge.net/%{name}/%{name}3-%{version}.tar.bz2
# Source1 is from http://docbook.sourceforge.net/release/xsl/current/COPYING # Source1 is from http://docbook.sourceforge.net/release/xsl/current/COPYING
@ -17,6 +27,10 @@ Source1: COPYING-docbook-xsl
Patch0: dblatex-0.3.11-disable-debian.patch Patch0: dblatex-0.3.11-disable-debian.patch
Patch1: dblatex-0.3.11-which-shutil.patch Patch1: dblatex-0.3.11-which-shutil.patch
Patch2: dblatex-0.3.11-replace-inkscape-by-rsvg.patch Patch2: dblatex-0.3.11-replace-inkscape-by-rsvg.patch
# Patch3 sent upstream: https://sourceforge.net/p/dblatex/patches/12/
Patch3: dblatex-0.3.12-replace-imp-by-importlib.patch
# Patch4 sent upstream: https://sourceforge.net/p/dblatex/patches/13/
Patch4: dblatex-0.3.12-adjust-submodule-imports.patch
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
@ -24,7 +38,6 @@ BuildRequires: libxslt
BuildRequires: texlive-base BuildRequires: texlive-base
BuildRequires: texlive-collection-latex BuildRequires: texlive-collection-latex
BuildRequires: texlive-collection-xetex BuildRequires: texlive-collection-xetex
BuildRequires: texlive-collection-htmlxml
BuildRequires: texlive-xmltex-bin BuildRequires: texlive-xmltex-bin
BuildRequires: texlive-anysize BuildRequires: texlive-anysize
BuildRequires: texlive-appendix BuildRequires: texlive-appendix
@ -33,17 +46,15 @@ BuildRequires: texlive-fancybox
BuildRequires: texlive-jknapltx BuildRequires: texlive-jknapltx
BuildRequires: texlive-multirow BuildRequires: texlive-multirow
BuildRequires: texlive-overpic BuildRequires: texlive-overpic
BuildRequires: texlive-passivetex
BuildRequires: texlive-pdfpages BuildRequires: texlive-pdfpages
BuildRequires: texlive-subfigure BuildRequires: texlive-subfigure
BuildRequires: texlive-stmaryrd BuildRequires: texlive-stmaryrd
BuildRequires: texlive-wasysym BuildRequires: texlive-wasysym
Buildrequires: /usr/bin/pathfix.py
Requires: texlive-base Requires: texlive-base
Requires: texlive-collection-latex Requires: texlive-collection-latex
Requires: texlive-collection-xetex Requires: texlive-collection-xetex
Requires: texlive-collection-htmlxml
Requires: texlive-collection-fontsrecommended Requires: texlive-collection-fontsrecommended
Requires: texlive-passivetex
Requires: texlive-xmltex texlive-xmltex-bin Requires: texlive-xmltex texlive-xmltex-bin
Requires: texlive-anysize Requires: texlive-anysize
Requires: texlive-appendix Requires: texlive-appendix
@ -79,13 +90,10 @@ Authors:
%prep %prep
%setup -q -n %{name}3-%{version} %autosetup -n %{name}3-%{version} -p 1
%patch0 -p1 -b .disable-debian
%patch1 -p1 -b .which-shutil
%patch2 -p1 -b .rsvg
rm -rf lib/contrib rm -rf lib/contrib
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" . %py3_shebang_fix .
%build %build
%{__python3} setup.py build %{__python3} setup.py build
@ -93,7 +101,7 @@ pathfix.py -pni "%{__python3} %{py3_shbang_opts}" .
%install %install
%{__python3} setup.py install --root $RPM_BUILD_ROOT %{__python3} setup.py install --root $RPM_BUILD_ROOT
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" $RPM_BUILD_ROOT%{_bindir}/dblatex %py3_shebang_fix $RPM_BUILD_ROOT%{_bindir}/dblatex
# these are already in tetex-latex: # these are already in tetex-latex:
for file in bibtopic.sty enumitem.sty ragged2e.sty passivetex/ xelatex/; do for file in bibtopic.sty enumitem.sty ragged2e.sty passivetex/ xelatex/; do
@ -136,12 +144,57 @@ cp -p %{SOURCE1} COPYING-docbook-xsl
%postun -p /usr/bin/texhash %postun -p /usr/bin/texhash
%changelog %changelog
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 0.3.12-4 ## START: Generated by rpmautospec
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags * Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 0.3.12-22
Related: rhbz#1991688 - Bump release for October 2024 mass rebuild:
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 0.3.12-21
- Bump release for June 2024 mass rebuild
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.12-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.12-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.12-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jul 06 2023 Michael J Gruber <mjg@fedoraproject.org> - 0.3.12-14
- Fix Py 3.12 imports (rhbz#2220636)
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 0.3.12-13
- Rebuilt for Python 3.12
* Tue Jun 06 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 0.3.12-12
- Remove obsolete texlive-collection-htmlxml dependency
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 0.3.12-3 * Wed Mar 29 2023 Michael J Gruber <mjg@fedoraproject.org> - 0.3.12-11
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 - Adjust patch macro usage to rpm >= 4.18 in a cleaner way
* Tue Mar 28 2023 Than Ngo <than@redhat.com> - 0.3.12-10
- Fix deprecated patch rpm macro
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.12-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Tue Dec 06 2022 Michael J Gruber <mjg@fedoraproject.org> - 0.3.12-8
- SPDX migration
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.12-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.3.12-6
- Rebuilt for Python 3.11
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.12-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.12-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jun 02 2021 Python Maint <python-maint@redhat.com> - 0.3.12-3
- Rebuilt for Python 3.10
* Thu Feb 18 2021 Michael J Gruber <mjg@fedoraproject.org> - 0.3.12-2 * Thu Feb 18 2021 Michael J Gruber <mjg@fedoraproject.org> - 0.3.12-2
- replace inkscape by rsvg (#bz 1833047) - replace inkscape by rsvg (#bz 1833047)
@ -388,3 +441,5 @@ cp -p %{SOURCE1} COPYING-docbook-xsl
* Fri Sep 7 2007 Neal Becker <ndbecker2@gmail.com> - 0.2.7-1 * Fri Sep 7 2007 Neal Becker <ndbecker2@gmail.com> - 0.2.7-1
- Initial - Initial
## END: Generated by rpmautospec

Loading…
Cancel
Save