SHA256
1
0
forked from pool/gimp-help
Dominique Leuenberger 2020-07-17 18:51:36 +00:00 committed by Git OBS Bridge
commit e77883f71b
5 changed files with 373 additions and 48 deletions

View File

@ -0,0 +1,314 @@
diff -urNp a/tools/xml2po/__init__.py b/tools/xml2po/__init__.py
--- a/tools/xml2po/__init__.py 2019-11-28 11:45:00.889048989 +0100
+++ b/tools/xml2po/__init__.py 2020-01-06 13:24:24.715787902 +0100
@@ -86,14 +86,14 @@ class MessageOutput:
self.messages.append(t)
if spacepreserve:
self.nowrap[t] = True
- if t in self.linenos.keys():
+ if t in list(self.linenos.keys()):
self.linenos[t].append((self.filename, tag, lineno))
else:
self.linenos[t] = [ (self.filename, tag, lineno) ]
if (not self.do_translations) and comment and not t in self.comments:
self.comments[t] = comment
else:
- if t in self.linenos.keys():
+ if t in list(self.linenos.keys()):
self.linenos[t].append((self.filename, tag, lineno))
else:
self.linenos[t] = [ (self.filename, tag, lineno) ]
@@ -166,7 +166,7 @@ class XMLDocument(object):
elif node.isText():
if node.isBlankNode():
if self.app.options.get('expand_entities') or \
- (not (node.prev and not node.prev.isBlankNode() and node.next and not node.next.isBlankNode()) ):
+ (not (node.prev and not node.prev.isBlankNode() and node.nextElementSibling() and not node.next.isBlankNode()) ):
#print >>sys.stderr, "BLANK"
node.setContent('')
else:
@@ -200,7 +200,7 @@ class XMLDocument(object):
tree = ctxt.doc()
newnode = tree.getRootElement()
except:
- print >> sys.stderr, """Error while normalizing string as XML:\n"%s"\n""" % (text)
+ print("""Error while normalizing string as XML:\n"%s"\n""" % (text), file=sys.stderr)
return text
self.normalizeNode(newnode)
@@ -259,7 +259,7 @@ class XMLDocument(object):
if not self.expand_entities:
result += '&' + child.name + ';'
else:
- result += child.content.decode('utf-8')
+ result += child.content
else:
result += self.myAttributeSerialize(child)
child = child.next
@@ -326,7 +326,7 @@ class XMLDocument(object):
pass
content = '<%s>%s</%s>' % (starttag, text, endtag)
- tmp = tmp + content.encode('utf-8')
+ tmp = tmp + content
newnode = None
try:
@@ -338,7 +338,7 @@ class XMLDocument(object):
pass
if not newnode:
- print >> sys.stderr, """Error while parsing translation as XML:\n"%s"\n""" % (text.encode('utf-8'))
+ print("""Error while parsing translation as XML:\n"%s"\n""" % (text), file=sys.stderr)
return
newelem = newnode.getRootElement()
@@ -354,7 +354,7 @@ class XMLDocument(object):
copy = newelem.copyNodeList()
next = node.next
node.replaceNode(newelem.copyNodeList())
- node.next = next
+ node.__next__ = next
else:
# In practice, this happens with tags such as "<para> </para>" (only whitespace in between)
@@ -406,7 +406,7 @@ class XMLDocument(object):
translation = self.app.getTranslation(outtxt) # unicode or None
if translation is not None:
self.replaceAttributeContentsWithText(attr,
- translation.encode('utf-8'))
+ translation)
else:
self.app.msg.outputMessage(outtxt, node.lineNo(), "", spacepreserve=False,
tag = node.name + ":" + attr.name)
@@ -447,14 +447,14 @@ class XMLDocument(object):
norm_outtxt = self.normalizeString(outtxt, self.app.isSpacePreserveNode(node))
translation = self.app.getTranslation(norm_outtxt)
else:
- translation = outtxt.decode('utf-8')
+ translation = outtxt
starttag = self.startTagForNode(node)
endtag = self.endTagForNode(node)
worth = self.worthOutputting(node)
if not translation:
- translation = outtxt.decode('utf-8')
+ translation = outtxt
if worth and self.app.options.get('mark_untranslated'):
node.setLang('C')
@@ -463,7 +463,7 @@ class XMLDocument(object):
# repl[0] may contain translated attributes with
# non-ASCII chars, so implicit conversion to <str> may fail
replacement = '<%s>%s</%s>' % \
- (repl[0].decode('utf-8'), repl[3], repl[2])
+ (repl[0], repl[3], repl[2])
translation = translation.replace('<placeholder-%d/>' % (i+1), replacement)
if worth:
@@ -542,7 +542,7 @@ class Main(object):
elif output == '-':
self.out = sys.stdout
else:
- self.out = file(output, 'w')
+ self.out = open(output, 'w')
def load_mode(self, modename):
try:
@@ -565,7 +565,7 @@ class Main(object):
try:
doc = XMLDocument(xmlfile, self)
except Exception as e:
- print >> sys.stderr, "Unable to parse XML file '%s': %s" % (xmlfile, str(e))
+ print("Unable to parse XML file '%s': %s" % (xmlfile, str(e)), file=sys.stderr)
sys.exit(1)
self.current_mode.preProcessXml(doc.doc, self.msg)
doc.generate_messages()
@@ -578,13 +578,13 @@ class Main(object):
try:
doc = XMLDocument(xmlfile, self)
except Exception as e:
- print >> sys.stderr, str(e)
+ print(str(e), file=sys.stderr)
sys.exit(1)
try:
mfile = open(mofile, "rb")
except:
- print >> sys.stderr, "Can't open MO file '%s'." % (mofile)
+ print("Can't open MO file '%s'." % (mofile), file=sys.stderr)
self.gt = gettext.GNUTranslations(mfile)
self.gt.add_fallback(NoneTranslations())
# Has preProcessXml use cases for merge?
@@ -607,7 +607,7 @@ class Main(object):
try:
doc = XMLDocument(xmlfile, self)
except Exception as e:
- print >> sys.stderr, str(e)
+ print(str(e), file=sys.stderr)
sys.exit(1)
doc.generate_messages()
@@ -615,7 +615,7 @@ class Main(object):
try:
doc = XMLDocument(origxml, self)
except Exception as e:
- print >> sys.stderr, str(e)
+ print(str(e), file=sys.stderr)
sys.exit(1)
doc.generate_messages()
self.output_po()
@@ -646,11 +646,11 @@ class Main(object):
text should be a string to look for.
"""
- #print >>sys.stderr,"getTranslation('%s')" % (text.encode('utf-8'))
+ #print >>sys.stderr,"getTranslation('%s')" % (text)
if not text or text.strip() == '':
return text
if self.gt:
- res = self.gt.ugettext(text.decode('utf-8'))
+ res = self.gt.gettext(text)
return res
return text
diff -urNp a/tools/xml2po/modes/docbook.py b/tools/xml2po/modes/docbook.py
--- a/tools/xml2po/modes/docbook.py 2019-11-28 11:45:00.889048989 +0100
+++ b/tools/xml2po/modes/docbook.py 2020-01-06 13:10:18.324679751 +0100
@@ -43,7 +43,7 @@ try:
except ImportError:
from md5 import new as md5_new
-from basic import basicXmlMode
+from .basic import basicXmlMode
class docbookXmlMode(basicXmlMode):
"""Class for special handling of DocBook document types.
@@ -131,7 +131,7 @@ class docbookXmlMode(basicXmlMode):
hash = self._md5_for_file(fullpath)
else:
hash = "THIS FILE DOESN'T EXIST"
- print >>sys.stderr, "Warning: image file '%s' not found." % fullpath
+ print("Warning: image file '%s' not found." % fullpath, file=sys.stderr)
msg.outputMessage("@@image: '%s'; md5=%s" % (attr, hash), node.lineNo(),
"When image changes, this message will be marked fuzzy or untranslated for you.\n"+
@@ -184,7 +184,7 @@ class docbookXmlMode(basicXmlMode):
else:
ai.addChild(copy)
if match.group(3):
- copy.newChild(None, "year", match.group(3).encode('utf-8'))
+ copy.newChild(None, "year", match.group(3))
if match.group(1) and match.group(2):
holder = match.group(1)+"(%s)" % match.group(2)
elif match.group(1):
@@ -193,15 +193,15 @@ class docbookXmlMode(basicXmlMode):
holder = match.group(2)
else:
holder = "???"
- copy.newChild(None, "holder", holder.encode('utf-8'))
+ copy.newChild(None, "holder", holder)
# Perform some tests when ran standalone
if __name__ == '__main__':
test = docbookXmlMode()
- print "Ignored tags : " + repr(test.getIgnoredTags())
- print "Final tags : " + repr(test.getFinalTags())
- print "Space-preserve tags: " + repr(test.getSpacePreserveTags())
+ print("Ignored tags : " + repr(test.getIgnoredTags()))
+ print("Final tags : " + repr(test.getFinalTags()))
+ print("Space-preserve tags: " + repr(test.getSpacePreserveTags()))
- print "Credits from string: '%s'" % test.getStringForTranslators()
- print "Explanation for credits:\n\t'%s'" % test.getCommentForTranslators()
+ print("Credits from string: '%s'" % test.getStringForTranslators())
+ print("Explanation for credits:\n\t'%s'" % test.getCommentForTranslators())
diff -urNp a/tools/xml2po/modes/gimphelp.py b/tools/xml2po/modes/gimphelp.py
--- a/tools/xml2po/modes/gimphelp.py 2019-11-28 11:45:00.889048989 +0100
+++ b/tools/xml2po/modes/gimphelp.py 2020-01-06 11:59:17.387855373 +0100
@@ -31,7 +31,7 @@ try:
except ImportError:
from md5 import new as md5_new
-from docbook import docbookXmlMode
+from .docbook import docbookXmlMode
class gimphelpXmlMode(docbookXmlMode):
"""Class for special handling of gimp-help DocBook document types.
@@ -91,10 +91,10 @@ class gimphelpXmlMode(docbookXmlMode):
# Perform some tests when ran standalone
if __name__ == '__main__':
test = gimphelpXmlMode()
- print "Ignored tags : " + repr(test.getIgnoredTags())
- print "Final tags : " + repr(test.getFinalTags())
- print "Space-preserve tags: " + repr(test.getSpacePreserveTags())
+ print("Ignored tags : " + repr(test.getIgnoredTags()))
+ print("Final tags : " + repr(test.getFinalTags()))
+ print("Space-preserve tags: " + repr(test.getSpacePreserveTags()))
- print "Credits from string: '%s'" % test.getStringForTranslators()
- print "Explanation for credits:\n\t'%s'" % test.getCommentForTranslators()
+ print("Credits from string: '%s'" % test.getStringForTranslators())
+ print("Explanation for credits:\n\t'%s'" % test.getCommentForTranslators())
diff -urNp a/tools/xml2po.py b/tools/xml2po.py
--- a/tools/xml2po.py 2019-11-28 11:45:00.889048989 +0100
+++ b/tools/xml2po.py 2020-01-06 11:59:17.387855373 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# Copyright (c) 2004, 2005, 2006 Danilo Šegan <danilo@gnome.org>.
# Copyright (c) 2009 Claude Paroz <claude@2xlibre.net>.
@@ -41,9 +41,9 @@ NULL_STRING = '/dev/null'
if not os.path.exists('/dev/null'): NULL_STRING = 'NUL'
def usage (with_help = False):
- print >> sys.stderr, "Usage: %s [OPTIONS] [XMLFILE]..." % (sys.argv[0])
+ print("Usage: %s [OPTIONS] [XMLFILE]..." % (sys.argv[0]), file=sys.stderr)
if with_help:
- print >> sys.stderr, """
+ print("""
OPTIONS may be some of:
-a --automatic-tags Automatically decides if tags are to be considered
"final" or not
@@ -72,7 +72,7 @@ EXAMPLES:
using -p option for each XML file:
%(command)s -p de.po chapter1.xml > chapter1.de.xml
%(command)s -p de.po chapter2.xml > chapter2.de.xml
-""" % {'command': sys.argv[0]}
+""" % {'command': sys.argv[0]}, file=sys.stderr)
def main(argv):
@@ -148,7 +148,7 @@ def main(argv):
sys.exit(0)
if operation == 'update' and output != "-":
- print >> sys.stderr, "Option '-o' is not yet supported when updating translations directly. Ignoring this option."
+ print("Option '-o' is not yet supported when updating translations directly. Ignoring this option.", file=sys.stderr)
# Treat remaining arguments as XML files
filenames = []
@@ -158,16 +158,16 @@ def main(argv):
try:
xml2po_main = Main(default_mode, operation, output, options)
except IOError:
- print >> sys.stderr, "Error: cannot open file %s for writing." % (output)
+ print("Error: cannot open file %s for writing." % (output), file=sys.stderr)
sys.exit(5)
if operation == 'merge':
if len(filenames) > 1:
- print >> sys.stderr, "Error: You can merge translations with only one XML file at a time."
+ print("Error: You can merge translations with only one XML file at a time.", file=sys.stderr)
sys.exit(2)
if not mofile:
- print >> sys.stderr, "Error: You must specify MO file when merging translations."
+ print("Error: You must specify MO file when merging translations.", file=sys.stderr)
sys.exit(3)
xml2po_main.merge(mofile, filenames[0])

3
gimp-help-2.10.0.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:03804fed071b49e5810edd8327868659dfd9932fbf34d34189d56bd0ad539118
size 187092180

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e5658f1553428898bc23f07eedbb87e259ef9010fcf55b99b364f07d143b6e57
size 158504580

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Jul 14 21:12:13 UTC 2020 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- Update to version 2.10.0, no changes overview provided.
- Build with Python 3, add gimp-help-2.10.0-python3.patch.
- Clean up spec file, drop unused dependencies.
- Drop huge ChangeLog (verbatim git log), README and TERMINOLOGY
files, not useful for end users.
-------------------------------------------------------------------
Thu Oct 3 12:23:32 UTC 2019 - Michel Normand <normand@linux.vnet.ibm.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package gimp-help
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,32 +12,29 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: gimp-help
Version: 2.8.2
Version: 2.10.0
Release: 0
# FIXME: Check if parallel build reliably works again (last check: 2.6.1)
Summary: Help System Data for GIMP
License: GFDL-1.2
Group: Productivity/Graphics/Bitmap Editors
Url: http://www.gimp.org/
Source0: http://download.gimp.org/pub/gimp/help/gimp-help-2.8.2.tar.bz2
Url: https://docs.gimp.org/
Source0: https://download.gimp.org/pub/gimp/help/gimp-help-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM -- https://gitlab.gnome.org/GNOME/gimp-help/-/issues/201
Patch0: gimp-help-2.10.0-python3.patch
BuildRequires: docbook-xsl-stylesheets
BuildRequires: fdupes
BuildRequires: gimp-devel
BuildRequires: libxslt
BuildRequires: xhtml-dtd
BuildRequires: xmlcharent
BuildRequires: pngcrush
BuildRequires: python2-libxml2
BuildRequires: pngcrush
BuildRequires: python3-libxml2-python
Requires: gimp
Enhances: gimp
Provides: gimp-help-2
Obsoletes: gimp-help-2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: gimp-help-2 = %{version}
Obsoletes: gimp-help-2 < %{version}
BuildArch: noarch
%description
@ -248,6 +245,18 @@ browser, external Web browser and HTML renderers, and human eyeballs.
This package provides Brazilian Portuguese data for gimp-help.
%package ro
Summary: Romanian Help System Data for GIMP
Group: System/Localization
Requires: %{name} = %{version}
Provides: locale(%{name}:ro)
%description ro
GIMP-Help is a help system designed for use with the internal GIMP help
browser, external Web browser and HTML renderers, and human eyeballs.
This package provides Romanian data for gimp-help.
%package ru
Summary: Russian Help System Data for GIMP
Group: System/Localization
@ -298,12 +307,21 @@ This package provides Chinese data for gimp-help.
%prep
%setup -q
%patch0 -p1
find . -iname \*.py -exec sed -i -e '1 s@env python.\?@python3@' '{}' \;
%build
%configure
# We install the help to the same prefix as gimp itself, so no
# need to query gimp for the prefix at build time
%configure \
--without-gimp
unset MALLOC_CHECK_
unset MALLOC_PERTURB_
make
%if 0%{?sle_version} <= 150100
export LANG=en_US.utf-8
%endif
%make_build
# unify the permissions of images, to make fdupes working again (bnc#784670)
find images/ -type f -exec chmod 0644 {} +
@ -318,93 +336,77 @@ done
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog NEWS README TERMINOLOGY
%doc AUTHORS NEWS
%license COPYING
%dir %{_datadir}/gimp
%dir %{_datadir}/gimp/2.0
%dir %{_datadir}/gimp/2.0/help
%{_datadir}/gimp/2.0/help/en/
%files ca
%defattr (-,root,root)
%lang(ca) %{_datadir}/gimp/2.0/help/ca/
%files da
%defattr (-,root,root)
%lang(da) %{_datadir}/gimp/2.0/help/da/
%files de
%defattr (-,root,root)
%lang(de) %{_datadir}/gimp/2.0/help/de/
%files el
%defattr (-,root,root)
%lang(el) %{_datadir}/gimp/2.0/help/el/
%files en_GB
%defattr (-,root,root)
%lang(en_GB) %{_datadir}/gimp/2.0/help/en_GB/
%files es
%defattr (-,root,root)
%lang(es) %{_datadir}/gimp/2.0/help/es/
%files fi
%defattr (-,root,root)
#lang(fi) %{_datadir}/gimp/2.0/help/fi/
%lang(fi) %{_datadir}/gimp/2.0/help/fi/
%files fr
%defattr (-,root,root)
%lang(fr) %{_datadir}/gimp/2.0/help/fr/
%files hr
%defattr (-,root,root)
#lang(hr) %{_datadir}/gimp/2.0/help/hr/
#lang(hr) %%{_datadir}/gimp/2.0/help/hr/
%files it
%defattr (-,root,root)
%lang(it) %{_datadir}/gimp/2.0/help/it/
%files ja
%defattr (-,root,root)
%lang(ja) %{_datadir}/gimp/2.0/help/ja/
%files ko
%defattr (-,root,root)
%lang(ko) %{_datadir}/gimp/2.0/help/ko/
%files lt
%defattr (-,root,root)
#lang(lt) %{_datadir}/gimp/2.0/help/lt/
#lang(lt) %%{_datadir}/gimp/2.0/help/lt/
%files nl
%defattr (-,root,root)
%lang(nl) %{_datadir}/gimp/2.0/help/nl/
%files nn
%defattr (-,root,root)
%lang(nn) %{_datadir}/gimp/2.0/help/nn/
%files pl
%defattr (-,root,root)
#lang(pl) %{_datadir}/gimp/2.0/help/pl/
#lang(pl) %%{_datadir}/gimp/2.0/help/pl/
%files pt_BR
%defattr (-,root,root)
%lang(pt_BR) %{_datadir}/gimp/2.0/help/pt_BR/
%files ro
%lang(ro) %{_datadir}/gimp/2.0/help/ro/
%files ru
%defattr (-,root,root)
%lang(ru) %{_datadir}/gimp/2.0/help/ru/
%files sl
%defattr (-,root,root)
%lang(sl) %{_datadir}/gimp/2.0/help/sl/
#%lang(sl) %%{_datadir}/gimp/2.0/help/sl/
%files sv
%defattr (-,root,root)
%lang(sv) %{_datadir}/gimp/2.0/help/sv/
#%lang(sv) %%{_datadir}/gimp/2.0/help/sv/
%files zh
%defattr (-,root,root)
%lang(zh) %{_datadir}/gimp/2.0/help/zh_CN/
%changelog