pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/textproc/gnome-doc-utils gnome-doc-utils: add Python 3...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5d27515925b4
branches:  trunk
changeset: 447298:5d27515925b4
user:      nia <nia%pkgsrc.org@localhost>
date:      Fri Feb 19 10:42:54 2021 +0000

description:
gnome-doc-utils: add Python 3 support, based on Fedora patches

bump PKGREVISION

diffstat:

 textproc/gnome-doc-utils/Makefile                                     |   12 +-
 textproc/gnome-doc-utils/PLIST                                        |    2 +-
 textproc/gnome-doc-utils/distinfo                                     |    9 +-
 textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_____init____.py  |  134 ++++++++++
 textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_modes_docbook.py |   58 ++++
 textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_modes_gs.py      |   18 +
 textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_modes_mallard.py |   27 ++
 textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_modes_ubuntu.py  |   18 +
 textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_modes_xhtml.py   |   18 +
 textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_xml2po.py.in     |   76 +++++
 10 files changed, 362 insertions(+), 10 deletions(-)

diffs (truncated from 450 to 300 lines):

diff -r 2b470a44afca -r 5d27515925b4 textproc/gnome-doc-utils/Makefile
--- a/textproc/gnome-doc-utils/Makefile Fri Feb 19 10:19:56 2021 +0000
+++ b/textproc/gnome-doc-utils/Makefile Fri Feb 19 10:42:54 2021 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.75 2020/12/04 20:45:44 nia Exp $
+# $NetBSD: Makefile,v 1.76 2021/02/19 10:42:54 nia Exp $
 
 DISTNAME=      gnome-doc-utils-0.20.10
-PKGREVISION=   7
+PKGREVISION=   8
 CATEGORIES=    textproc gnome
 MASTER_SITES=  ${MASTER_SITE_GNOME:=sources/gnome-doc-utils/0.20/}
 EXTRACT_SUFX=  .tar.xz
@@ -12,12 +12,9 @@
 LICENSE=       gnu-gpl-v2 AND gnu-lgpl-v2.1
 
 DEPENDS+=      ${PYPKGPREFIX}-libxml2>=2.6.16:../../textproc/py-libxml2
-DEPENDS+=      ${PYPKGPREFIX}-libxslt>=1.1.12:../../textproc/py-libxslt
 DEPENDS+=      docbook-xml>=4.5:../../textproc/docbook-xml
 DEPENDS+=      getopt-[0-9]*:../../misc/getopt
 
-PYTHON_VERSIONS_ACCEPTED=      27 # py-libxslt
-
 USE_TOOLS+=            intltool pkg-config gmake gawk msgfmt bash:run
 GNU_CONFIGURE=         YES
 MAKE_JOBS_SAFE=                no
@@ -35,7 +32,7 @@
 SUBST_FILES.getopt=    tools/gnome-doc-tool.in
 SUBST_SED.getopt=      "s|@GETOPT@|${LOCALBASE}/bin/getopt|g"
 
-PY_PATCHPLIST=         yes
+PLIST_SUBST+=          PYSITELIB=${PYSITELIB}
 
 BUILDLINK_API_DEPENDS.libxml2+=        libxml2>=2.6.12
 BUILDLINK_DEPMETHOD.libxslt=   build
@@ -44,8 +41,7 @@
 post-install:
        ${PY_COMPILE_ALL} ${DESTDIR}${PREFIX}/share/xml2po
 
-.include "../../lang/python/application.mk"
-.include "../../lang/python/extension.mk"
+.include "../../lang/python/pyversion.mk"
 .include "../../textproc/libxml2/buildlink3.mk"
 .include "../../textproc/libxslt/buildlink3.mk"
 .include "../../textproc/xmlcatmgr/buildlink3.mk"
diff -r 2b470a44afca -r 5d27515925b4 textproc/gnome-doc-utils/PLIST
--- a/textproc/gnome-doc-utils/PLIST    Fri Feb 19 10:19:56 2021 +0000
+++ b/textproc/gnome-doc-utils/PLIST    Fri Feb 19 10:42:54 2021 +0000
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.19 2012/08/23 15:18:07 drochner Exp $
+@comment $NetBSD: PLIST,v 1.20 2021/02/19 10:42:54 nia Exp $
 bin/gnome-doc-prepare
 bin/gnome-doc-tool
 bin/xml2po
diff -r 2b470a44afca -r 5d27515925b4 textproc/gnome-doc-utils/distinfo
--- a/textproc/gnome-doc-utils/distinfo Fri Feb 19 10:19:56 2021 +0000
+++ b/textproc/gnome-doc-utils/distinfo Fri Feb 19 10:42:54 2021 +0000
@@ -1,7 +1,14 @@
-$NetBSD: distinfo,v 1.30 2020/03/11 12:38:06 wiz Exp $
+$NetBSD: distinfo,v 1.31 2021/02/19 10:42:54 nia Exp $
 
 SHA1 (gnome-doc-utils-0.20.10.tar.xz) = 8320a30e1b7239aa33ba276da046090407a93bbf
 RMD160 (gnome-doc-utils-0.20.10.tar.xz) = 64fcdf0166c213b6bf5c872f583546b3a9a17bf4
 SHA512 (gnome-doc-utils-0.20.10.tar.xz) = 1cb5e3b9ca9e45e6c551801e9c9c4aac725c2ce85238c230a4c70b36c90419886b921d8dd464df0643fc3bbb877df075abaa83a36d1609c5664960c31e11d151
 Size (gnome-doc-utils-0.20.10.tar.xz) = 526700 bytes
 SHA1 (patch-aa) = 340bf8450a100a3d35d7bf1b411de081d3ebe776
+SHA1 (patch-xml2po_xml2po_____init____.py) = 8dd475fa87e5dcd5cfb6714f183525e0f6653313
+SHA1 (patch-xml2po_xml2po_modes_docbook.py) = 673b588d9d3a8fb493c7201e18363ec8b19ac7e6
+SHA1 (patch-xml2po_xml2po_modes_gs.py) = 5c7f65e46a33e847b88ac675e2ddc21031e2afde
+SHA1 (patch-xml2po_xml2po_modes_mallard.py) = 06219084bcae7bfe2780726007c4421ed7ccd459
+SHA1 (patch-xml2po_xml2po_modes_ubuntu.py) = 9ad4bed8df6e476f048bdef42fc7cd40c07a8cd3
+SHA1 (patch-xml2po_xml2po_modes_xhtml.py) = d440dabcef7df1dc3eb74d0cb14e0c964b034d53
+SHA1 (patch-xml2po_xml2po_xml2po.py.in) = a564f3f1e766e0cabeb72ebfdddbc791c00b5836
diff -r 2b470a44afca -r 5d27515925b4 textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_____init____.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_____init____.py      Fri Feb 19 10:42:54 2021 +0000
@@ -0,0 +1,134 @@
+$NetBSD: patch-xml2po_xml2po_____init____.py,v 1.1 2021/02/19 10:42:54 nia Exp $
+
+Python 3 support.
+
+via Fedora and a million other Linux distributions:
+https://src.fedoraproject.org/rpms/gnome-doc-utils/tree/rawhide
+
+--- xml2po/xml2po/__init__.py.orig     2011-08-04 14:36:03.000000000 +0000
++++ xml2po/xml2po/__init__.py
+@@ -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) ]
+@@ -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)
+@@ -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.encode('utf-8')), file=sys.stderr)
+                 return
+ 
+             newelem = newnode.getRootElement()
+@@ -352,9 +352,10 @@ class XMLDocument(object):
+ 
+                 if node:
+                     copy = newelem.copyNodeList()
+-                    next = node.next
++                    #next = node.next
+                     node.replaceNode(newelem.copyNodeList())
+-                    node.next = next
++                    #print(type(next))
++                    #node.next = next
+ 
+             else:
+                 # In practice, this happens with tags such as "<para>    </para>" (only whitespace in between)
+@@ -470,7 +471,7 @@ class XMLDocument(object):
+ 
+         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')
+ 
+@@ -577,8 +578,8 @@ class Main(object):
+                 raise IOError("Unable to read file '%s'" % xmlfile)
+             try:
+                 doc = XMLDocument(xmlfile, self)
+-            except Exception, e:
+-                print >> sys.stderr, "Unable to parse XML file '%s': %s" % (xmlfile, str(e))
++            except Exception as 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()
+@@ -590,14 +591,14 @@ class Main(object):
+             raise IOError("Unable to read file '%s'" % xmlfile)
+         try:
+             doc = XMLDocument(xmlfile, self)
+-        except Exception, e:
+-            print >> sys.stderr, str(e)
++        except Exception as 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?
+@@ -619,16 +620,16 @@ class Main(object):
+             raise IOError("Unable to read file '%s'" % xmlfile)
+         try:
+             doc = XMLDocument(xmlfile, self)
+-        except Exception, e:
+-            print >> sys.stderr, str(e)
++        except Exception as e:
++            print(str(e), file=sys.stderr)
+             sys.exit(1)
+         doc.generate_messages()
+ 
+         self.msg.translationsFollow()
+         try:
+             doc = XMLDocument(origxml, self)
+-        except Exception, e:
+-            print >> sys.stderr, str(e)
++        except Exception as e:
++            print(str(e), file=sys.stderr)
+             sys.exit(1)
+         doc.generate_messages()
+         self.output_po()
+@@ -663,7 +664,7 @@ class Main(object):
+         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 -r 2b470a44afca -r 5d27515925b4 textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_modes_docbook.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_modes_docbook.py     Fri Feb 19 10:42:54 2021 +0000
@@ -0,0 +1,58 @@
+$NetBSD: patch-xml2po_xml2po_modes_docbook.py,v 1.1 2021/02/19 10:42:54 nia Exp $
+
+Python 3 support.
+
+via Fedora and a million other Linux distributions:
+https://src.fedoraproject.org/rpms/gnome-doc-utils/tree/rawhide
+
+--- xml2po/xml2po/modes/docbook.py.orig        2011-01-10 16:08:10.000000000 +0000
++++ xml2po/xml2po/modes/docbook.py
+@@ -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 -r 2b470a44afca -r 5d27515925b4 textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_modes_gs.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_modes_gs.py  Fri Feb 19 10:42:54 2021 +0000
@@ -0,0 +1,18 @@
+$NetBSD: patch-xml2po_xml2po_modes_gs.py,v 1.1 2021/02/19 10:42:54 nia Exp $
+
+Python 3 support.
+
+via Fedora and a million other Linux distributions:
+https://src.fedoraproject.org/rpms/gnome-doc-utils/tree/rawhide
+
+--- xml2po/xml2po/modes/gs.py.orig     2010-12-13 16:14:07.000000000 +0000
++++ xml2po/xml2po/modes/gs.py
+@@ -20,7 +20,7 @@
+ # Special case Gnome Summary
+ #
+ 
+-from basic import basicXmlMode
++from .basic import basicXmlMode
+ 
+ class gsXmlMode(basicXmlMode):
+     """Abstract class for special handling of document types."""
diff -r 2b470a44afca -r 5d27515925b4 textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_modes_mallard.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/gnome-doc-utils/patches/patch-xml2po_xml2po_modes_mallard.py     Fri Feb 19 10:42:54 2021 +0000
@@ -0,0 +1,27 @@
+$NetBSD: patch-xml2po_xml2po_modes_mallard.py,v 1.1 2021/02/19 10:42:54 nia Exp $



Home | Main Index | Thread Index | Old Index