1 |
commit: 59929d18c71162e37e32305e8a7a433e60c1f04f |
2 |
Author: Zoltan Puskas <zoltan <AT> sinustrom <DOT> info> |
3 |
AuthorDate: Tue Jul 14 05:51:40 2020 +0000 |
4 |
Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 5 12:18:38 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59929d18 |
7 |
|
8 |
app-text/dblatex: Introduce Python 3.8 and 3.9 support |
9 |
|
10 |
Additionally make it compatible with >=media-gfx/inkscape-1.0 |
11 |
|
12 |
Closes: https://bugs.gentoo.org/723412 |
13 |
Package-Manager: Portage-2.3.101, Repoman-2.3.22 |
14 |
Signed-off-by: Zoltan Puskas <zoltan <AT> sinustrom.info> |
15 |
Closes: https://github.com/gentoo/gentoo/pull/16692 |
16 |
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org> |
17 |
|
18 |
app-text/dblatex/dblatex-0.3.11-r1.ebuild | 62 ++++++++++++ |
19 |
app-text/dblatex/files/dblatex-0.3.11-encode.patch | 19 ++++ |
20 |
.../files/dblatex-0.3.11-inkscape-1.0.patch | 107 +++++++++++++++++++++ |
21 |
3 files changed, 188 insertions(+) |
22 |
|
23 |
diff --git a/app-text/dblatex/dblatex-0.3.11-r1.ebuild b/app-text/dblatex/dblatex-0.3.11-r1.ebuild |
24 |
new file mode 100644 |
25 |
index 00000000000..d9813d2f40b |
26 |
--- /dev/null |
27 |
+++ b/app-text/dblatex/dblatex-0.3.11-r1.ebuild |
28 |
@@ -0,0 +1,62 @@ |
29 |
+# Copyright 1999-2020 Gentoo Authors |
30 |
+# Distributed under the terms of the GNU General Public License v2 |
31 |
+ |
32 |
+EAPI="7" |
33 |
+ |
34 |
+PYTHON_COMPAT=( python3_{6,7,8,9} ) |
35 |
+ |
36 |
+inherit distutils-r1 |
37 |
+ |
38 |
+DESCRIPTION="Transform DocBook using TeX macros" |
39 |
+HOMEPAGE="http://dblatex.sourceforge.net/" |
40 |
+SRC_URI="https://downloads.sourceforge.net/project/dblatex/dblatex/${P}/${P}py3.tar.bz2" |
41 |
+ |
42 |
+LICENSE="GPL-2+" |
43 |
+SLOT="0" |
44 |
+KEYWORDS="~amd64 ~arm ~x86" |
45 |
+IUSE="inkscape" |
46 |
+ |
47 |
+RDEPEND=" |
48 |
+ app-text/docbook-xml-dtd:4.5 |
49 |
+ dev-libs/kpathsea |
50 |
+ dev-libs/libxslt |
51 |
+ dev-libs/libxslt |
52 |
+ dev-texlive/texlive-fontutils |
53 |
+ dev-texlive/texlive-latex |
54 |
+ dev-texlive/texlive-latexextra |
55 |
+ dev-texlive/texlive-latexrecommended |
56 |
+ dev-texlive/texlive-mathscience |
57 |
+ dev-texlive/texlive-pictures |
58 |
+ dev-texlive/texlive-xetex |
59 |
+ gnome-base/librsvg |
60 |
+ media-gfx/imagemagick |
61 |
+ media-gfx/transfig |
62 |
+ inkscape? ( media-gfx/inkscape ) |
63 |
+" |
64 |
+DEPEND="${RDEPEND}" |
65 |
+ |
66 |
+S="${WORKDIR}/${P}py3" |
67 |
+ |
68 |
+PATCHES=( |
69 |
+ "${FILESDIR}/${P}-path-logging.patch" |
70 |
+ "${FILESDIR}/${P}-setup.patch" |
71 |
+ "${FILESDIR}/${P}-encode.patch" |
72 |
+) |
73 |
+ |
74 |
+python_prepare_all() { |
75 |
+ # Manual page is precomressed, but we will use our own compression later. |
76 |
+ gunzip docs/manpage/dblatex.1.gz || die |
77 |
+ # If we dont have inkscape we need to use an alternative SVG converter |
78 |
+ use inkscape || eapply "${FILESDIR}/${P}-no-inkscape-dependency.patch" |
79 |
+ # If we use inscape however we want to make dblatex compatible with v1.0 |
80 |
+ use inkscape && eapply "${FILESDIR}/${P}-inkscape-1.0.patch" |
81 |
+ # We need to fix version information in the docs and some metadata |
82 |
+ grep -l -I -R "0.3.11py3" | xargs -n1 sed -i -e "s/${PV}py3/${PV}/" || die |
83 |
+ distutils-r1_python_prepare_all |
84 |
+} |
85 |
+ |
86 |
+python_install_all() { |
87 |
+ distutils-r1_python_install_all |
88 |
+ # Move package documentation to a folder name containing version number |
89 |
+ mv "${D}"/usr/share/doc/${PN} "${D}"/usr/share/doc/${PF} || die |
90 |
+} |
91 |
|
92 |
diff --git a/app-text/dblatex/files/dblatex-0.3.11-encode.patch b/app-text/dblatex/files/dblatex-0.3.11-encode.patch |
93 |
new file mode 100644 |
94 |
index 00000000000..1f32f99074a |
95 |
--- /dev/null |
96 |
+++ b/app-text/dblatex/files/dblatex-0.3.11-encode.patch |
97 |
@@ -0,0 +1,19 @@ |
98 |
+diff -Naur dblatex-0.3.11py3-orig/lib/dbtexmf/dblatex/rawtex.py dblatex-0.3.11py3/lib/dbtexmf/dblatex/rawtex.py |
99 |
+--- dblatex-0.3.11py3-orig/lib/dbtexmf/dblatex/rawtex.py 2020-01-29 13:48:34.000000000 -0800 |
100 |
++++ dblatex-0.3.11py3/lib/dbtexmf/dblatex/rawtex.py 2020-07-13 23:49:56.296767535 -0700 |
101 |
+@@ -101,10 +101,14 @@ |
102 |
+ |
103 |
+ # If something done, replace the figure in the tex file |
104 |
+ if newfig != fig: |
105 |
++ if isinstance(fig, str): |
106 |
++ fig = fig.encode("utf-8") |
107 |
++ if isinstance(newfig, str): |
108 |
++ newfig = newfig.encode("utf-8") |
109 |
+ line = re.sub(br"{"+fig+br"}", br"{"+newfig+br"}", line) |
110 |
+ |
111 |
+ return line |
112 |
+- |
113 |
++ |
114 |
+ |
115 |
+ def main(): |
116 |
+ c = RawLatex() |
117 |
|
118 |
diff --git a/app-text/dblatex/files/dblatex-0.3.11-inkscape-1.0.patch b/app-text/dblatex/files/dblatex-0.3.11-inkscape-1.0.patch |
119 |
new file mode 100644 |
120 |
index 00000000000..48cd9f24972 |
121 |
--- /dev/null |
122 |
+++ b/app-text/dblatex/files/dblatex-0.3.11-inkscape-1.0.patch |
123 |
@@ -0,0 +1,107 @@ |
124 |
+diff -Naur dblatex-0.3.11py3-orig/docs/custom/dblatex.xconf dblatex-0.3.11py3/docs/custom/dblatex.xconf |
125 |
+--- dblatex-0.3.11py3-orig/docs/custom/dblatex.xconf 2020-01-29 13:48:32.000000000 -0800 |
126 |
++++ dblatex-0.3.11py3/docs/custom/dblatex.xconf 2020-07-14 01:05:42.883435133 -0700 |
127 |
+@@ -18,7 +18,7 @@ |
128 |
+ <imagedata> |
129 |
+ <converter src="svg" dst="*" docformat="pdf"> |
130 |
+ <command> |
131 |
+- inkscape -z -D --export-dpi=600 --export-%(dst)s=%(output)s %(input)s |
132 |
++ inkscape -D --export-dpi=600 --export-filename=%(output)s %(input)s |
133 |
+ </command> |
134 |
+ </converter> |
135 |
+ </imagedata> |
136 |
+diff -Naur dblatex-0.3.11py3-orig/docs/xhtml/manual/sec-specs.html dblatex-0.3.11py3/docs/xhtml/manual/sec-specs.html |
137 |
+--- dblatex-0.3.11py3-orig/docs/xhtml/manual/sec-specs.html 2020-01-29 13:49:23.000000000 -0800 |
138 |
++++ dblatex-0.3.11py3/docs/xhtml/manual/sec-specs.html 2020-07-14 01:06:19.012860710 -0700 |
139 |
+@@ -36,7 +36,7 @@ |
140 |
+ <imagedata> |
141 |
+ <converter src="svg" dst="*" docformat="pdf"> |
142 |
+ <command> |
143 |
+- inkscape -z -D --export-dpi=600 --export-%(dst)s=%(output)s %(input)s |
144 |
++ inkscape -D --export-dpi=600 --export-filename=%(output)s %(input)s |
145 |
+ </command> |
146 |
+ </converter> |
147 |
+ </imagedata> |
148 |
+diff -Naur dblatex-0.3.11py3-orig/lib/dbtexmf/core/imagedata.py dblatex-0.3.11py3/lib/dbtexmf/core/imagedata.py |
149 |
+--- dblatex-0.3.11py3-orig/lib/dbtexmf/core/imagedata.py 2020-01-29 13:48:33.000000000 -0800 |
150 |
++++ dblatex-0.3.11py3/lib/dbtexmf/core/imagedata.py 2020-07-14 01:02:56.729388831 -0700 |
151 |
+@@ -47,16 +47,16 @@ |
152 |
+ |
153 |
+ |
154 |
+ class PoolManager: |
155 |
+- def __init__(self): |
156 |
++ def __init__(self): |
157 |
+ self._used_pool = None |
158 |
+ self._pending_pools = [] |
159 |
+- |
160 |
++ |
161 |
+ def set_pool(self, pool): |
162 |
+ self._used_pool = pool |
163 |
+ for p in self._pending_pools: |
164 |
+ pool.preprend(p) |
165 |
+ self._pending_pools = [] |
166 |
+- |
167 |
++ |
168 |
+ def prepend_pool(self, pool): |
169 |
+ if self._used_pool: |
170 |
+ self._used_pool.prepend(pool) |
171 |
+@@ -73,7 +73,7 @@ |
172 |
+ self.format_pool = PoolManager() |
173 |
+ |
174 |
+ _image_setup = ImageSetup() |
175 |
+- |
176 |
++ |
177 |
+ def image_setup(): |
178 |
+ global _image_setup |
179 |
+ return _image_setup |
180 |
+@@ -181,7 +181,7 @@ |
181 |
+ class SvgConverter(ImageConverter): |
182 |
+ def __init__(self, imgsrc, imgdst="", docformat="", backend=""): |
183 |
+ ImageConverter.__init__(self, imgsrc="svg", imgdst=imgdst) |
184 |
+- self.add_command(["inkscape", "-z", "-D", "--export-%(dst)s=%(output)s", |
185 |
++ self.add_command(["inkscape", "-D", "--export-filename=%(output)s", |
186 |
+ "%(input)s"]) |
187 |
+ |
188 |
+ |
189 |
+@@ -224,7 +224,7 @@ |
190 |
+ ImageFormatPool.__init__(self) |
191 |
+ # There can be a mismatch between PDF-1.4 images and PDF-1.3 |
192 |
+ # document produced by XeTeX |
193 |
+- self.add_rule(FormatRule(docformat="pdf", backend="xetex", |
194 |
++ self.add_rule(FormatRule(docformat="pdf", backend="xetex", |
195 |
+ imgdst="png")) |
196 |
+ self.add_rule(FormatRule(docformat="pdf", imgdst="pdf")) |
197 |
+ self.add_rule(FormatRule(docformat="dvi", imgdst="eps")) |
198 |
+@@ -318,7 +318,7 @@ |
199 |
+ Copy the file in the working directory if its path contains characters |
200 |
+ unsupported by latex, like spaces. |
201 |
+ """ |
202 |
+- # Encode to expected output format. If encoding is OK and |
203 |
++ # Encode to expected output format. If encoding is OK and |
204 |
+ # supported by tex, just return the encoded path |
205 |
+ newfig = self._path_encode(fig) |
206 |
+ if newfig and newfig.find(b" ") == -1: |
207 |
+@@ -350,7 +350,7 @@ |
208 |
+ if (ext): |
209 |
+ realfig = self.find(fig) |
210 |
+ return (realfig, ext[1:]) |
211 |
+- |
212 |
++ |
213 |
+ # Lookup for the best suited available figure |
214 |
+ if (self.output_format == "pdf"): |
215 |
+ formats = ("png", "pdf", "jpg", "eps", "gif", "fig", "svg") |
216 |
+@@ -369,7 +369,7 @@ |
217 |
+ format = "" |
218 |
+ |
219 |
+ return (realfig, format) |
220 |
+- |
221 |
++ |
222 |
+ def find(self, fig): |
223 |
+ # First, the obvious absolute path case |
224 |
+ if os.path.isabs(fig): |
225 |
+@@ -385,4 +385,4 @@ |
226 |
+ return realfig |
227 |
+ |
228 |
+ return None |
229 |
+- |
230 |
++ |