This commit is contained in:
Mario Fetka
2024-06-18 10:44:56 +02:00
parent 6a37474503
commit 20ef8b5c88
95 changed files with 4227 additions and 99 deletions

View File

@@ -0,0 +1,19 @@
diff -Naur dblatex-0.3.11py3-orig/lib/dbtexmf/dblatex/rawtex.py dblatex-0.3.11py3/lib/dbtexmf/dblatex/rawtex.py
--- dblatex-0.3.11py3-orig/lib/dbtexmf/dblatex/rawtex.py 2020-01-29 13:48:34.000000000 -0800
+++ dblatex-0.3.11py3/lib/dbtexmf/dblatex/rawtex.py 2020-07-13 23:49:56.296767535 -0700
@@ -101,10 +101,14 @@
# If something done, replace the figure in the tex file
if newfig != fig:
+ if isinstance(fig, str):
+ fig = fig.encode("utf-8")
+ if isinstance(newfig, str):
+ newfig = newfig.encode("utf-8")
line = re.sub(br"{"+fig+br"}", br"{"+newfig+br"}", line)
return line
-
+
def main():
c = RawLatex()

View File

@@ -0,0 +1,107 @@
diff -Naur dblatex-0.3.11py3-orig/docs/custom/dblatex.xconf dblatex-0.3.11py3/docs/custom/dblatex.xconf
--- dblatex-0.3.11py3-orig/docs/custom/dblatex.xconf 2020-01-29 13:48:32.000000000 -0800
+++ dblatex-0.3.11py3/docs/custom/dblatex.xconf 2020-07-14 01:05:42.883435133 -0700
@@ -18,7 +18,7 @@
<imagedata>
<converter src="svg" dst="*" docformat="pdf">
<command>
- inkscape -z -D --export-dpi=600 --export-%(dst)s=%(output)s %(input)s
+ inkscape -D --export-dpi=600 --export-filename=%(output)s %(input)s
</command>
</converter>
</imagedata>
diff -Naur dblatex-0.3.11py3-orig/docs/xhtml/manual/sec-specs.html dblatex-0.3.11py3/docs/xhtml/manual/sec-specs.html
--- dblatex-0.3.11py3-orig/docs/xhtml/manual/sec-specs.html 2020-01-29 13:49:23.000000000 -0800
+++ dblatex-0.3.11py3/docs/xhtml/manual/sec-specs.html 2020-07-14 01:06:19.012860710 -0700
@@ -36,7 +36,7 @@
&lt;imagedata&gt;
&lt;converter src="svg" dst="*" docformat="pdf"&gt;
&lt;command&gt;
- inkscape -z -D --export-dpi=600 --export-%(dst)s=%(output)s %(input)s
+ inkscape -D --export-dpi=600 --export-filename=%(output)s %(input)s
&lt;/command&gt;
&lt;/converter&gt;
&lt;/imagedata&gt;
diff -Naur dblatex-0.3.11py3-orig/lib/dbtexmf/core/imagedata.py dblatex-0.3.11py3/lib/dbtexmf/core/imagedata.py
--- dblatex-0.3.11py3-orig/lib/dbtexmf/core/imagedata.py 2020-01-29 13:48:33.000000000 -0800
+++ dblatex-0.3.11py3/lib/dbtexmf/core/imagedata.py 2020-07-14 01:02:56.729388831 -0700
@@ -47,16 +47,16 @@
class PoolManager:
- def __init__(self):
+ def __init__(self):
self._used_pool = None
self._pending_pools = []
-
+
def set_pool(self, pool):
self._used_pool = pool
for p in self._pending_pools:
pool.preprend(p)
self._pending_pools = []
-
+
def prepend_pool(self, pool):
if self._used_pool:
self._used_pool.prepend(pool)
@@ -73,7 +73,7 @@
self.format_pool = PoolManager()
_image_setup = ImageSetup()
-
+
def image_setup():
global _image_setup
return _image_setup
@@ -181,7 +181,7 @@
class SvgConverter(ImageConverter):
def __init__(self, imgsrc, imgdst="", docformat="", backend=""):
ImageConverter.__init__(self, imgsrc="svg", imgdst=imgdst)
- self.add_command(["inkscape", "-z", "-D", "--export-%(dst)s=%(output)s",
+ self.add_command(["inkscape", "-D", "--export-filename=%(output)s",
"%(input)s"])
@@ -224,7 +224,7 @@
ImageFormatPool.__init__(self)
# There can be a mismatch between PDF-1.4 images and PDF-1.3
# document produced by XeTeX
- self.add_rule(FormatRule(docformat="pdf", backend="xetex",
+ self.add_rule(FormatRule(docformat="pdf", backend="xetex",
imgdst="png"))
self.add_rule(FormatRule(docformat="pdf", imgdst="pdf"))
self.add_rule(FormatRule(docformat="dvi", imgdst="eps"))
@@ -318,7 +318,7 @@
Copy the file in the working directory if its path contains characters
unsupported by latex, like spaces.
"""
- # Encode to expected output format. If encoding is OK and
+ # Encode to expected output format. If encoding is OK and
# supported by tex, just return the encoded path
newfig = self._path_encode(fig)
if newfig and newfig.find(b" ") == -1:
@@ -350,7 +350,7 @@
if (ext):
realfig = self.find(fig)
return (realfig, ext[1:])
-
+
# Lookup for the best suited available figure
if (self.output_format == "pdf"):
formats = ("png", "pdf", "jpg", "eps", "gif", "fig", "svg")
@@ -369,7 +369,7 @@
format = ""
return (realfig, format)
-
+
def find(self, fig):
# First, the obvious absolute path case
if os.path.isabs(fig):
@@ -385,4 +385,4 @@
return realfig
return None
-
+

View File

@@ -0,0 +1,14 @@
diff -Naur dblatex-0.3.11py3/lib/dbtexmf/core/imagedata.py dblatex-0.3.11py3-new/lib/dbtexmf/core/imagedata.py
--- dblatex-0.3.11py3/lib/dbtexmf/core/imagedata.py 2020-01-29 13:48:33.000000000 -0800
+++ dblatex-0.3.11py3-new/lib/dbtexmf/core/imagedata.py 2020-02-25 00:45:35.627054621 -0800
@@ -181,8 +181,8 @@
class SvgConverter(ImageConverter):
def __init__(self, imgsrc, imgdst="", docformat="", backend=""):
ImageConverter.__init__(self, imgsrc="svg", imgdst=imgdst)
- self.add_command(["inkscape", "-z", "-D", "--export-%(dst)s=%(output)s",
- "%(input)s"])
+ self.add_command(["rsvg-convert", "-f", "%(dst)s", "-o","%(output)s",
+ "%(input)s"])
class FormatRule:

View File

@@ -0,0 +1,15 @@
diff -Naur dblatex-0.3.11py3/scripts/dblatex dblatex-0.3.11py3-new/scripts/dblatex
--- dblatex-0.3.11py3/scripts/dblatex 2020-01-29 13:48:34.000000000 -0800
+++ dblatex-0.3.11py3-new/scripts/dblatex 2020-02-25 01:04:16.169346434 -0800
@@ -1,8 +1,10 @@
#! /usr/bin/env python
import sys
import os
+import logging
-package_base = os.path.join(os.path.dirname(sys.argv[0]), "..")
+logging.basicConfig()
+package_base = "/usr/share/dblatex"
sys.path.insert(0, os.path.realpath(os.path.join(package_base, "lib")))
from dbtexmf.dblatex import dblatex

View File

@@ -0,0 +1,47 @@
diff -Naur dblatex-0.3.11py3/setup.py dblatex-0.3.11py3-new/setup.py
--- dblatex-0.3.11py3/setup.py 2020-01-29 13:48:34.000000000 -0800
+++ dblatex-0.3.11py3-new/setup.py 2020-02-27 20:25:21.669297793 -0800
@@ -26,7 +26,6 @@
from distutils import log
from subprocess import Popen, PIPE
sys.path.append("lib")
-from contrib.debian.installer import DebianInstaller
#
# Build the command line script
@@ -192,7 +191,7 @@
log.info("running build_doc")
htmldir = os.path.join("docs", "xhtml")
pdfdocs = glob.glob(os.path.join("docs", "[mr]*.pdf"))
- manpage = os.path.join("docs", "manpage", "dblatex.1.gz")
+ manpage = os.path.join("docs", "manpage", "dblatex.1")
# Lazy check to avoid a rebuild for nothing
if (not(self.force) and os.path.exists(htmldir) and len(pdfdocs) >= 2
@@ -368,15 +367,12 @@
status += "no"
mis_stys.append(sty)
print(status)
-
+
if mis_stys:
raise OSError("not found: %s" % ", ".join(mis_stys))
def run(self):
- if self.install_layout == "deb":
- db = DebianInstaller(self)
- else:
- db = None
+ db = None
if not(db) and not(self.nodeps):
try:
@@ -515,7 +511,7 @@
data_files=[('share/dblatex', ['xsl', 'latex', 'etc/schema']),
('share/doc/dblatex', pdfdocs),
('share/doc/dblatex', htmldoc),
- ('share/man/man1', ['docs/manpage/dblatex.1.gz'])],
+ ('share/man/man1', ['docs/manpage/dblatex.1'])],
scripts=['scripts/dblatex'],
cmdclass={'build': Build,
'build_scripts': BuildScripts,

View File

@@ -0,0 +1,46 @@
Description: 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.
Forwarded: https://sourceforge.net/p/dblatex/patches/13/
Author: Michael J Gruber <github@grubix.eu>
Last-Update: 2023-07-06
--- a/lib/dbtexmf/core/dbtex.py
+++ b/lib/dbtexmf/core/dbtex.py
@@ -15,7 +15,8 @@
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
--- 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
--- 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

View File

@@ -0,0 +1,112 @@
Description: Python 3.12 compatibility: Replace imp by importlib
Forwarded: https://sourceforge.net/p/dblatex/patches/12/
Author: Miro Hrončok <mhroncok@redhat.com>
Last-Update: 2023-06-15
--- a/lib/dbtexmf/core/dbtex.py
+++ b/lib/dbtexmf/core/dbtex.py
@@ -15,7 +15,7 @@
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 @@
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):
--- 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 @@
"""
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
--- 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