1 |
commit: 95b8c676dfeb51f8f54e008a058436b6e5832ab1 |
2 |
Author: Sergey Torokhov <torokhov-s-a <AT> yandex <DOT> ru> |
3 |
AuthorDate: Thu Aug 20 22:10:27 2020 +0000 |
4 |
Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 16 08:04:11 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95b8c676 |
7 |
|
8 |
app-doc/gimp-help: 2.10.0, fix build using python3 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/725940 |
11 |
|
12 |
Signed-off-by: Sergey Torokhov <torokhov-s-a <AT> yandex.ru> |
13 |
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org> |
14 |
|
15 |
.../gimp-help/files/gimp-help-2.10.0-python3.patch | 297 +++++++++++++++++++++ |
16 |
app-doc/gimp-help/gimp-help-2.10.0-r1.ebuild | 36 +++ |
17 |
2 files changed, 333 insertions(+) |
18 |
|
19 |
diff --git a/app-doc/gimp-help/files/gimp-help-2.10.0-python3.patch b/app-doc/gimp-help/files/gimp-help-2.10.0-python3.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..e42214a0f82 |
22 |
--- /dev/null |
23 |
+++ b/app-doc/gimp-help/files/gimp-help-2.10.0-python3.patch |
24 |
@@ -0,0 +1,297 @@ |
25 |
+diff -urNp a/tools/xml2po/__init__.py b/tools/xml2po/__init__.py |
26 |
+--- a/tools/xml2po/__init__.py 2019-11-28 11:45:00.889048989 +0100 |
27 |
++++ b/tools/xml2po/__init__.py 2020-01-06 13:24:24.715787902 +0100 |
28 |
+@@ -166,7 +166,7 @@ class XMLDocument(object): |
29 |
+ elif node.isText(): |
30 |
+ if node.isBlankNode(): |
31 |
+ if self.app.options.get('expand_entities') or \ |
32 |
+- (not (node.prev and not node.prev.isBlankNode() and node.next and not node.next.isBlankNode()) ): |
33 |
++ (not (node.prev and not node.prev.isBlankNode() and node.nextElementSibling() and not node.next.isBlankNode()) ): |
34 |
+ #print >>sys.stderr, "BLANK" |
35 |
+ node.setContent('') |
36 |
+ else: |
37 |
+@@ -200,7 +200,7 @@ class XMLDocument(object): |
38 |
+ tree = ctxt.doc() |
39 |
+ newnode = tree.getRootElement() |
40 |
+ except: |
41 |
+- print >> sys.stderr, """Error while normalizing string as XML:\n"%s"\n""" % (text) |
42 |
++ print("""Error while normalizing string as XML:\n"%s"\n""" % (text), file=sys.stderr) |
43 |
+ return text |
44 |
+ |
45 |
+ self.normalizeNode(newnode) |
46 |
+@@ -259,7 +259,7 @@ class XMLDocument(object): |
47 |
+ if not self.expand_entities: |
48 |
+ result += '&' + child.name + ';' |
49 |
+ else: |
50 |
+- result += child.content.decode('utf-8') |
51 |
++ result += child.content |
52 |
+ else: |
53 |
+ result += self.myAttributeSerialize(child) |
54 |
+ child = child.next |
55 |
+@@ -326,7 +326,7 @@ class XMLDocument(object): |
56 |
+ pass |
57 |
+ |
58 |
+ content = '<%s>%s</%s>' % (starttag, text, endtag) |
59 |
+- tmp = tmp + content.encode('utf-8') |
60 |
++ tmp = tmp + content |
61 |
+ |
62 |
+ newnode = None |
63 |
+ try: |
64 |
+@@ -338,7 +338,7 @@ class XMLDocument(object): |
65 |
+ pass |
66 |
+ |
67 |
+ if not newnode: |
68 |
+- print >> sys.stderr, """Error while parsing translation as XML:\n"%s"\n""" % (text.encode('utf-8')) |
69 |
++ print("""Error while parsing translation as XML:\n"%s"\n""" % (text), file=sys.stderr) |
70 |
+ return |
71 |
+ |
72 |
+ newelem = newnode.getRootElement() |
73 |
+@@ -354,7 +354,7 @@ class XMLDocument(object): |
74 |
+ copy = newelem.copyNodeList() |
75 |
+ next = node.next |
76 |
+ node.replaceNode(newelem.copyNodeList()) |
77 |
+- node.next = next |
78 |
++ node.__next__ = next |
79 |
+ |
80 |
+ else: |
81 |
+ # In practice, this happens with tags such as "<para> </para>" (only whitespace in between) |
82 |
+@@ -406,7 +406,7 @@ class XMLDocument(object): |
83 |
+ translation = self.app.getTranslation(outtxt) # unicode or None |
84 |
+ if translation is not None: |
85 |
+ self.replaceAttributeContentsWithText(attr, |
86 |
+- translation.encode('utf-8')) |
87 |
++ translation) |
88 |
+ else: |
89 |
+ self.app.msg.outputMessage(outtxt, node.lineNo(), "", spacepreserve=False, |
90 |
+ tag = node.name + ":" + attr.name) |
91 |
+@@ -447,14 +447,14 @@ class XMLDocument(object): |
92 |
+ norm_outtxt = self.normalizeString(outtxt, self.app.isSpacePreserveNode(node)) |
93 |
+ translation = self.app.getTranslation(norm_outtxt) |
94 |
+ else: |
95 |
+- translation = outtxt.decode('utf-8') |
96 |
++ translation = outtxt |
97 |
+ |
98 |
+ starttag = self.startTagForNode(node) |
99 |
+ endtag = self.endTagForNode(node) |
100 |
+ |
101 |
+ worth = self.worthOutputting(node) |
102 |
+ if not translation: |
103 |
+- translation = outtxt.decode('utf-8') |
104 |
++ translation = outtxt |
105 |
+ if worth and self.app.options.get('mark_untranslated'): |
106 |
+ node.setLang('C') |
107 |
+ |
108 |
+@@ -463,7 +463,7 @@ class XMLDocument(object): |
109 |
+ # repl[0] may contain translated attributes with |
110 |
+ # non-ASCII chars, so implicit conversion to <str> may fail |
111 |
+ replacement = '<%s>%s</%s>' % \ |
112 |
+- (repl[0].decode('utf-8'), repl[3], repl[2]) |
113 |
++ (repl[0], repl[3], repl[2]) |
114 |
+ translation = translation.replace('<placeholder-%d/>' % (i+1), replacement) |
115 |
+ |
116 |
+ if worth: |
117 |
+@@ -542,7 +542,7 @@ class Main(object): |
118 |
+ elif output == '-': |
119 |
+ self.out = sys.stdout |
120 |
+ else: |
121 |
+- self.out = file(output, 'w') |
122 |
++ self.out = open(output, 'w') |
123 |
+ |
124 |
+ def load_mode(self, modename): |
125 |
+ try: |
126 |
+@@ -565,7 +565,7 @@ class Main(object): |
127 |
+ try: |
128 |
+ doc = XMLDocument(xmlfile, self) |
129 |
+ except Exception as e: |
130 |
+- print >> sys.stderr, "Unable to parse XML file '%s': %s" % (xmlfile, str(e)) |
131 |
++ print("Unable to parse XML file '%s': %s" % (xmlfile, str(e)), file=sys.stderr) |
132 |
+ sys.exit(1) |
133 |
+ self.current_mode.preProcessXml(doc.doc, self.msg) |
134 |
+ doc.generate_messages() |
135 |
+@@ -578,13 +578,13 @@ class Main(object): |
136 |
+ try: |
137 |
+ doc = XMLDocument(xmlfile, self) |
138 |
+ except Exception as e: |
139 |
+- print >> sys.stderr, str(e) |
140 |
++ print(str(e), file=sys.stderr) |
141 |
+ sys.exit(1) |
142 |
+ |
143 |
+ try: |
144 |
+ mfile = open(mofile, "rb") |
145 |
+ except: |
146 |
+- print >> sys.stderr, "Can't open MO file '%s'." % (mofile) |
147 |
++ print("Can't open MO file '%s'." % (mofile), file=sys.stderr) |
148 |
+ self.gt = gettext.GNUTranslations(mfile) |
149 |
+ self.gt.add_fallback(NoneTranslations()) |
150 |
+ # Has preProcessXml use cases for merge? |
151 |
+@@ -607,7 +607,7 @@ class Main(object): |
152 |
+ try: |
153 |
+ doc = XMLDocument(xmlfile, self) |
154 |
+ except Exception as e: |
155 |
+- print >> sys.stderr, str(e) |
156 |
++ print(str(e), file=sys.stderr) |
157 |
+ sys.exit(1) |
158 |
+ doc.generate_messages() |
159 |
+ |
160 |
+@@ -615,7 +615,7 @@ class Main(object): |
161 |
+ try: |
162 |
+ doc = XMLDocument(origxml, self) |
163 |
+ except Exception as e: |
164 |
+- print >> sys.stderr, str(e) |
165 |
++ print(str(e), file=sys.stderr) |
166 |
+ sys.exit(1) |
167 |
+ doc.generate_messages() |
168 |
+ self.output_po() |
169 |
+@@ -646,11 +646,11 @@ class Main(object): |
170 |
+ |
171 |
+ text should be a string to look for. |
172 |
+ """ |
173 |
+- #print >>sys.stderr,"getTranslation('%s')" % (text.encode('utf-8')) |
174 |
++ #print >>sys.stderr,"getTranslation('%s')" % (text) |
175 |
+ if not text or text.strip() == '': |
176 |
+ return text |
177 |
+ if self.gt: |
178 |
+- res = self.gt.ugettext(text.decode('utf-8')) |
179 |
++ res = self.gt.gettext(text) |
180 |
+ return res |
181 |
+ |
182 |
+ return text |
183 |
+diff -urNp a/tools/xml2po/modes/docbook.py b/tools/xml2po/modes/docbook.py |
184 |
+--- a/tools/xml2po/modes/docbook.py 2019-11-28 11:45:00.889048989 +0100 |
185 |
++++ b/tools/xml2po/modes/docbook.py 2020-01-06 13:10:18.324679751 +0100 |
186 |
+@@ -43,7 +43,7 @@ try: |
187 |
+ except ImportError: |
188 |
+ from md5 import new as md5_new |
189 |
+ |
190 |
+-from basic import basicXmlMode |
191 |
++from .basic import basicXmlMode |
192 |
+ |
193 |
+ class docbookXmlMode(basicXmlMode): |
194 |
+ """Class for special handling of DocBook document types. |
195 |
+@@ -131,7 +131,7 @@ class docbookXmlMode(basicXmlMode): |
196 |
+ hash = self._md5_for_file(fullpath) |
197 |
+ else: |
198 |
+ hash = "THIS FILE DOESN'T EXIST" |
199 |
+- print >>sys.stderr, "Warning: image file '%s' not found." % fullpath |
200 |
++ print("Warning: image file '%s' not found." % fullpath, file=sys.stderr) |
201 |
+ |
202 |
+ msg.outputMessage("@@image: '%s'; md5=%s" % (attr, hash), node.lineNo(), |
203 |
+ "When image changes, this message will be marked fuzzy or untranslated for you.\n"+ |
204 |
+@@ -184,7 +184,7 @@ class docbookXmlMode(basicXmlMode): |
205 |
+ else: |
206 |
+ ai.addChild(copy) |
207 |
+ if match.group(3): |
208 |
+- copy.newChild(None, "year", match.group(3).encode('utf-8')) |
209 |
++ copy.newChild(None, "year", match.group(3)) |
210 |
+ if match.group(1) and match.group(2): |
211 |
+ holder = match.group(1)+"(%s)" % match.group(2) |
212 |
+ elif match.group(1): |
213 |
+@@ -193,15 +193,15 @@ class docbookXmlMode(basicXmlMode): |
214 |
+ holder = match.group(2) |
215 |
+ else: |
216 |
+ holder = "???" |
217 |
+- copy.newChild(None, "holder", holder.encode('utf-8')) |
218 |
++ copy.newChild(None, "holder", holder) |
219 |
+ |
220 |
+ # Perform some tests when ran standalone |
221 |
+ if __name__ == '__main__': |
222 |
+ test = docbookXmlMode() |
223 |
+- print "Ignored tags : " + repr(test.getIgnoredTags()) |
224 |
+- print "Final tags : " + repr(test.getFinalTags()) |
225 |
+- print "Space-preserve tags: " + repr(test.getSpacePreserveTags()) |
226 |
++ print("Ignored tags : " + repr(test.getIgnoredTags())) |
227 |
++ print("Final tags : " + repr(test.getFinalTags())) |
228 |
++ print("Space-preserve tags: " + repr(test.getSpacePreserveTags())) |
229 |
+ |
230 |
+- print "Credits from string: '%s'" % test.getStringForTranslators() |
231 |
+- print "Explanation for credits:\n\t'%s'" % test.getCommentForTranslators() |
232 |
++ print("Credits from string: '%s'" % test.getStringForTranslators()) |
233 |
++ print("Explanation for credits:\n\t'%s'" % test.getCommentForTranslators()) |
234 |
+ |
235 |
+diff -urNp a/tools/xml2po/modes/gimphelp.py b/tools/xml2po/modes/gimphelp.py |
236 |
+--- a/tools/xml2po/modes/gimphelp.py 2019-11-28 11:45:00.889048989 +0100 |
237 |
++++ b/tools/xml2po/modes/gimphelp.py 2020-01-06 11:59:17.387855373 +0100 |
238 |
+@@ -31,7 +31,7 @@ try: |
239 |
+ except ImportError: |
240 |
+ from md5 import new as md5_new |
241 |
+ |
242 |
+-from docbook import docbookXmlMode |
243 |
++from .docbook import docbookXmlMode |
244 |
+ |
245 |
+ class gimphelpXmlMode(docbookXmlMode): |
246 |
+ """Class for special handling of gimp-help DocBook document types. |
247 |
+@@ -91,10 +91,10 @@ class gimphelpXmlMode(docbookXmlMode): |
248 |
+ # Perform some tests when ran standalone |
249 |
+ if __name__ == '__main__': |
250 |
+ test = gimphelpXmlMode() |
251 |
+- print "Ignored tags : " + repr(test.getIgnoredTags()) |
252 |
+- print "Final tags : " + repr(test.getFinalTags()) |
253 |
+- print "Space-preserve tags: " + repr(test.getSpacePreserveTags()) |
254 |
++ print("Ignored tags : " + repr(test.getIgnoredTags())) |
255 |
++ print("Final tags : " + repr(test.getFinalTags())) |
256 |
++ print("Space-preserve tags: " + repr(test.getSpacePreserveTags())) |
257 |
+ |
258 |
+- print "Credits from string: '%s'" % test.getStringForTranslators() |
259 |
+- print "Explanation for credits:\n\t'%s'" % test.getCommentForTranslators() |
260 |
++ print("Credits from string: '%s'" % test.getStringForTranslators()) |
261 |
++ print("Explanation for credits:\n\t'%s'" % test.getCommentForTranslators()) |
262 |
+ |
263 |
+diff -urNp a/tools/xml2po.py b/tools/xml2po.py |
264 |
+--- a/tools/xml2po.py 2019-11-28 11:45:00.889048989 +0100 |
265 |
++++ b/tools/xml2po.py 2020-01-06 11:59:17.387855373 +0100 |
266 |
+@@ -1,4 +1,4 @@ |
267 |
+-#!/usr/bin/env python2 |
268 |
++#!/usr/bin/env python3 |
269 |
+ # -*- encoding: utf-8 -*- |
270 |
+ # Copyright (c) 2004, 2005, 2006 Danilo Šegan <danilo@×××××.org>. |
271 |
+ # Copyright (c) 2009 Claude Paroz <claude@×××××××.net>. |
272 |
+@@ -41,9 +41,9 @@ NULL_STRING = '/dev/null' |
273 |
+ if not os.path.exists('/dev/null'): NULL_STRING = 'NUL' |
274 |
+ |
275 |
+ def usage (with_help = False): |
276 |
+- print >> sys.stderr, "Usage: %s [OPTIONS] [XMLFILE]..." % (sys.argv[0]) |
277 |
++ print("Usage: %s [OPTIONS] [XMLFILE]..." % (sys.argv[0]), file=sys.stderr) |
278 |
+ if with_help: |
279 |
+- print >> sys.stderr, """ |
280 |
++ print(""" |
281 |
+ OPTIONS may be some of: |
282 |
+ -a --automatic-tags Automatically decides if tags are to be considered |
283 |
+ "final" or not |
284 |
+@@ -72,7 +72,7 @@ EXAMPLES: |
285 |
+ using -p option for each XML file: |
286 |
+ %(command)s -p de.po chapter1.xml > chapter1.de.xml |
287 |
+ %(command)s -p de.po chapter2.xml > chapter2.de.xml |
288 |
+-""" % {'command': sys.argv[0]} |
289 |
++""" % {'command': sys.argv[0]}, file=sys.stderr) |
290 |
+ |
291 |
+ |
292 |
+ def main(argv): |
293 |
+@@ -148,7 +148,7 @@ def main(argv): |
294 |
+ sys.exit(0) |
295 |
+ |
296 |
+ if operation == 'update' and output != "-": |
297 |
+- print >> sys.stderr, "Option '-o' is not yet supported when updating translations directly. Ignoring this option." |
298 |
++ print("Option '-o' is not yet supported when updating translations directly. Ignoring this option.", file=sys.stderr) |
299 |
+ |
300 |
+ # Treat remaining arguments as XML files |
301 |
+ filenames = [] |
302 |
+@@ -158,16 +158,16 @@ def main(argv): |
303 |
+ try: |
304 |
+ xml2po_main = Main(default_mode, operation, output, options) |
305 |
+ except IOError: |
306 |
+- print >> sys.stderr, "Error: cannot open file %s for writing." % (output) |
307 |
++ print("Error: cannot open file %s for writing." % (output), file=sys.stderr) |
308 |
+ sys.exit(5) |
309 |
+ |
310 |
+ if operation == 'merge': |
311 |
+ if len(filenames) > 1: |
312 |
+- print >> sys.stderr, "Error: You can merge translations with only one XML file at a time." |
313 |
++ print("Error: You can merge translations with only one XML file at a time.", file=sys.stderr) |
314 |
+ sys.exit(2) |
315 |
+ |
316 |
+ if not mofile: |
317 |
+- print >> sys.stderr, "Error: You must specify MO file when merging translations." |
318 |
++ print("Error: You must specify MO file when merging translations.", file=sys.stderr) |
319 |
+ sys.exit(3) |
320 |
+ |
321 |
+ xml2po_main.merge(mofile, filenames[0]) |
322 |
|
323 |
diff --git a/app-doc/gimp-help/gimp-help-2.10.0-r1.ebuild b/app-doc/gimp-help/gimp-help-2.10.0-r1.ebuild |
324 |
new file mode 100644 |
325 |
index 00000000000..3dab2da02f4 |
326 |
--- /dev/null |
327 |
+++ b/app-doc/gimp-help/gimp-help-2.10.0-r1.ebuild |
328 |
@@ -0,0 +1,36 @@ |
329 |
+# Copyright 1999-2020 Gentoo Authors |
330 |
+# Distributed under the terms of the GNU General Public License v2 |
331 |
+ |
332 |
+EAPI=7 |
333 |
+ |
334 |
+PYTHON_COMPAT=( python3_{6,7,8,9} ) |
335 |
+inherit python-any-r1 |
336 |
+ |
337 |
+DESCRIPTION="GNU Image Manipulation Program help files" |
338 |
+HOMEPAGE="https://docs.gimp.org/" |
339 |
+SRC_URI="mirror://gimp/help/${P}.tar.bz2" |
340 |
+ |
341 |
+LICENSE="FDL-1.2" |
342 |
+SLOT="2" |
343 |
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" |
344 |
+IUSE="" |
345 |
+ |
346 |
+BDEPEND="${PYTHON_DEPS} |
347 |
+ sys-devel/gettext |
348 |
+" |
349 |
+ |
350 |
+DEPEND="$(python_gen_any_dep 'dev-libs/libxml2[python,${PYTHON_USEDEP}]') |
351 |
+ dev-libs/libxslt |
352 |
+" |
353 |
+ |
354 |
+# Adds python3 build support, bug 725940 |
355 |
+# patch is from https://gitlab.gnome.org/GNOME/gimp-help/-/issues/201 |
356 |
+PATCHES=( "${FILESDIR}/${P}-python3.patch" ) |
357 |
+ |
358 |
+python_check_deps() { |
359 |
+ has_version "dev-libs/libxml2[${PYTHON_USEDEP}]" |
360 |
+} |
361 |
+ |
362 |
+src_configure() { |
363 |
+ econf --without-gimp |
364 |
+} |