diff --git a/mingw-w64-zziplib/PKGBUILD b/mingw-w64-zziplib/PKGBUILD
index b6fe365989..c9bd45106e 100644
--- a/mingw-w64-zziplib/PKGBUILD
+++ b/mingw-w64-zziplib/PKGBUILD
@@ -3,8 +3,8 @@
_realname=zziplib
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
-pkgver=0.13.69
-pkgrel=2
+pkgver=0.13.70
+pkgrel=1
pkgdesc="A lightweight library that offers the ability to easily extract data from files archived in a single zip file (mingw-w64)"
arch=('any')
url="https://zziplib.sourceforge.io/"
@@ -18,27 +18,21 @@ optdepends=("${MINGW_PACKAGE_PREFIX}-SDL: SDL_rwops for ZZipLib")
options=('staticlibs' 'strip')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/gdraheim/zziplib/archive/v${pkgver}.tar.gz"
"configure.patch"
- "python3.patch"
- "python3-more.patch")
-sha256sums=('846246d7cdeee405d8d21e2922c6e97f55f24ecbe3b6dcf5778073a88f120544'
+ "fix-upstream-merge-hunk.patch")
+sha256sums=('a1457262d7a237dc50ce1f98ca57242bc714055ff81146f419ee53cdea1bf029'
'892162a8535575891663607b8fb5e3be518e8293e9b0f22cf437b1d83a58b008'
- '67ac4be1ef78790c91488d61cb4cc3ca12905b8bc360ffbaf408b0c89cafbdd2'
- 'bd642d92a35ebad6514400900098a110e05de336452cb6e5e84549bd84b86db5')
+ 'ef6da465673997df0fa08789a1e7d9e3809a543bd0d033c3b0bf7b4ccd662fbf')
prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
-
patch -Np1 -i ${srcdir}/configure.patch
- # This is the diff between the last release and current master for *.py
- patch -Np1 -i ${srcdir}/python3.patch
- # This is by me to make things actually work
- patch -Np1 -i ${srcdir}/python3-more.patch
+ patch -Np1 -i ${srcdir}/fix-upstream-merge-hunk.patch
autoreconf -fiv
}
build() {
- export PYTHON=${MINGW_PREFIX}/bin/python3
+ export PYTHON=${MINGW_PREFIX}/bin/python
export PERL=/usr/bin/perl
mkdir -p "${srcdir}/build-${MINGW_CHOST}"
cd "${srcdir}/build-${MINGW_CHOST}"
diff --git a/mingw-w64-zziplib/fix-upstream-merge-hunk.patch b/mingw-w64-zziplib/fix-upstream-merge-hunk.patch
new file mode 100644
index 0000000000..5a440ca387
--- /dev/null
+++ b/mingw-w64-zziplib/fix-upstream-merge-hunk.patch
@@ -0,0 +1,16 @@
+--- zziplib-0.13.70/docs/zzipdoc/htm2dbk.py.orig 2020-04-25 22:23:05.627353100 +0300
++++ zziplib-0.13.70/docs/zzipdoc/htm2dbk.py 2020-04-25 22:23:30.563121400 +0300
+@@ -146,13 +146,8 @@
+ doc.filename = filename
+ doc.add(f.read())
+ f.close()
+-<<<<<<< HEAD
+- except IOError as e:
+- print >> sys.stderr, "can not open "+filename
+-=======
+ except IOError:
+ print("can not open "+filename, file=sys.stderr)
+->>>>>>> develop
+ return doc.value()
+
+ def html2docbook(text):
diff --git a/mingw-w64-zziplib/python3-more.patch b/mingw-w64-zziplib/python3-more.patch
deleted file mode 100644
index 254ef3ea36..0000000000
--- a/mingw-w64-zziplib/python3-more.patch
+++ /dev/null
@@ -1,322 +0,0 @@
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/commentmarkup.py zziplib-0.13.69/docs/zzipdoc/commentmarkup.py
---- zziplib-0.13.69/docs/zzipdoc.orig/commentmarkup.py 2020-03-27 16:43:54.977560900 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/commentmarkup.py 2020-03-27 16:45:09.617584400 +0100
-@@ -1,4 +1,4 @@
--from match import Match
-+from .match import Match
-
- def markup_link_syntax(text):
- """ markup the link-syntax ` => somewhere ` in the text block """
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/dbk2htm.py zziplib-0.13.69/docs/zzipdoc/dbk2htm.py
---- zziplib-0.13.69/docs/zzipdoc.orig/dbk2htm.py 2018-03-17 13:46:45.000000000 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/dbk2htm.py 2020-03-27 16:48:33.767813900 +0100
-@@ -1,4 +1,4 @@
--from match import Match
-+from .match import Match
- import string
-
- class dbk2htm_conversion:
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/docbookdocument.py zziplib-0.13.69/docs/zzipdoc/docbookdocument.py
---- zziplib-0.13.69/docs/zzipdoc.orig/docbookdocument.py 2020-03-27 16:41:51.781269500 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/docbookdocument.py 2020-03-27 16:51:53.669073400 +0100
-@@ -1,6 +1,6 @@
- #! /usr/bin/env python
- # -*- coding: UTF-8 -*-
--from match import Match
-+from .match import Match
-
- class DocbookDocument:
- """ binds some xml content page with additional markup - in this
-@@ -30,7 +30,7 @@
- def _xml_text(self, xml):
- """ accepts adapter objects with .xml_text() """
- try: return xml.xml_text()
-- except Exception as e: print "DocbookDocument/text", e; pass
-+ except Exception as e: print("DocbookDocument/text", e); pass
- return str(xml)
- def _fetch_rootnode(self, text):
- fetch = Match(r"^[^<>]*<(\w+)\b")
-@@ -47,7 +47,7 @@
- return filename
- def save(self, filename = None):
- filename = self._filename(filename)
-- print "writing '"+filename+"'"
-+ print("writing '"+filename+"'")
- if len(self.text) > 1:
- self.save_all(filename)
- else:
-@@ -58,12 +58,12 @@
- xml_text = self._xml_text(text)
- rootnode = self._fetch_rootnode(xml_text)
- doctype = self._xml_doctype(rootnode)
-- print >>fd, doctype
-- print >>fd, xml_text
-+ print(doctype, file=fd)
-+ print(xml_text, file=fd)
- fd.close()
- return True
- except IOError as e:
-- print "could not open '"+filename+"'file", e
-+ print("could not open '"+filename+"'file", e)
- return False
- def save_all(self, filename):
- assert len(self.text) > 1
-@@ -76,20 +76,20 @@
- else:
- rootnode = self.rootnode
- doctype = self._xml_doctype(rootnode)
-- print >>fd, doctype
-+ print(doctype, file=fd)
- title = self.get_title()
- if title and self.rootnode in self.has_title_child:
-- print >>fd, "<"+self.rootnode+'>
'+title+''
-+ print("<"+self.rootnode+'>'+title+'', file=fd)
- elif title:
-- print >>fd, "<"+self.rootnode+' id="'+title+'">'
-+ print("<"+self.rootnode+' id="'+title+'">', file=fd)
- else:
-- print >>fd, "<"+self.rootnode+'>'
-+ print("<"+self.rootnode+'>', file=fd)
- for text in self.text:
- text = self._xml_text(text)
-- print >>fd, text
-- print >>fd, ""+self.rootnode+">"
-+ print(text, file=fd)
-+ print(""+self.rootnode+">", file=fd)
- fd.close()
- return True
- except IOError as e:
-- print "could not open '"+filename+"'file", e
-+ print("could not open '"+filename+"'file", e)
- return False
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/functionheader.py zziplib-0.13.69/docs/zzipdoc/functionheader.py
---- zziplib-0.13.69/docs/zzipdoc.orig/functionheader.py 2018-03-17 13:46:45.000000000 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/functionheader.py 2020-03-27 16:44:54.896848300 +0100
-@@ -1,4 +1,4 @@
--from match import Match
-+from .match import Match
-
- class FunctionHeader:
- """ parsing the comment block that is usually presented before
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/functionlisthtmlpage.py zziplib-0.13.69/docs/zzipdoc/functionlisthtmlpage.py
---- zziplib-0.13.69/docs/zzipdoc.orig/functionlisthtmlpage.py 2020-03-27 16:41:51.782276800 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/functionlisthtmlpage.py 2020-03-27 16:45:40.325021000 +0100
-@@ -1,5 +1,5 @@
--from options import *
--from match import Match
-+from .options import *
-+from .match import Match
-
- class FunctionListHtmlPage:
- """ The main part here is to create a TOC (table of contents) at the
-@@ -35,7 +35,7 @@
- head_text = entry.head_xml_text()
- body_text = entry.body_xml_text(name)
- if not head_text:
-- print "no head_text for", name
-+ print("no head_text for", name)
- return
- try:
- prespec = entry.head_get_prespec()
-@@ -102,7 +102,7 @@
- text &= (Match("(?s)(\w+)")
- >> (lambda x: self.resolve_internal(x.group(1))))
- if len(self.not_found_in_anchors):
-- print "not found in anchors: ", self.not_found_in_anchors
-+ print("not found in anchors: ", self.not_found_in_anchors)
- return (text & Match("(?s)([^<>]*)")
- >> "\\1")
- def resolve_external(self, func, sect):
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/functionlistreference.py zziplib-0.13.69/docs/zzipdoc/functionlistreference.py
---- zziplib-0.13.69/docs/zzipdoc.orig/functionlistreference.py 2018-03-17 13:46:45.000000000 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/functionlistreference.py 2020-03-27 16:46:12.464598200 +0100
-@@ -1,7 +1,7 @@
- #! /usr/bin/env python
- # -*- coding: UTF-8 -*-
--from match import Match
--from htm2dbk import *
-+from .match import Match
-+from .htm2dbk import *
-
- class FunctionListReference:
- """ Creating a docbook-style list of parts
-@@ -19,7 +19,7 @@
- description = entry.body_xml_text(name)
- funcsynopsis = entry.head_xml_text()
- if not funcsynopsis:
-- print "no funcsynopsis for", name
-+ print("no funcsynopsis for", name)
- return
- if self.entry is None:
- self.entry = FunctionListRefEntry(entry, self.o)
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/functionprototype.py zziplib-0.13.69/docs/zzipdoc/functionprototype.py
---- zziplib-0.13.69/docs/zzipdoc.orig/functionprototype.py 2018-03-17 13:46:45.000000000 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/functionprototype.py 2020-03-27 16:45:02.976858300 +0100
-@@ -1,4 +1,4 @@
--from match import Match
-+from .match import Match
-
- class FunctionPrototype:
- """ takes a single function prototype line (cut from some source file)
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/htm2dbk.py zziplib-0.13.69/docs/zzipdoc/htm2dbk.py
---- zziplib-0.13.69/docs/zzipdoc.orig/htm2dbk.py 2020-03-27 16:41:51.783765600 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/htm2dbk.py 2020-03-27 16:47:11.103389500 +0100
-@@ -7,7 +7,7 @@
- present in the world of docbook-to-anything converters. """
-
- from datetime import date
--import match
-+from . import match
- import sys
-
- m = match.Match
-@@ -147,7 +147,7 @@
- doc.add(f.read())
- f.close()
- except IOError as e:
-- print >> sys.stderr, "can not open "+filename
-+ print("can not open "+filename, file=sys.stderr)
- return doc.value()
-
- def html2docbook(text):
-@@ -155,4 +155,4 @@
- return htm2dbk_conversion().convert2(text)
-
- if __name__ == "__main__":
-- print htm2dbk_files(sys.argv[1:])
-+ print(htm2dbk_files(sys.argv[1:]))
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/htmldocument.py zziplib-0.13.69/docs/zzipdoc/htmldocument.py
---- zziplib-0.13.69/docs/zzipdoc.orig/htmldocument.py 2020-03-27 16:41:51.785145000 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/htmldocument.py 2020-03-27 16:49:53.920431000 +0100
-@@ -1,6 +1,6 @@
- #! /usr/bin/env python
- # -*- coding: UTF-8 -*-
--from match import Match
-+from .match import Match
-
- class HtmlDocument:
- """ binds some html content page with additional markup - in this
-@@ -42,18 +42,18 @@
- try: return style.html_style()
- except Exception as e: ee = e; pass
- try: return style.xml_style()
-- except Exception as e: print "HtmlDocument/style", ee, e; pass
-+ except Exception as e: print("HtmlDocument/style", ee, e); pass
- try: return str(style)
-- except Exception as e: print "HtmlDocument/style", e; return ""
-+ except Exception as e: print("HtmlDocument/style", e); return ""
- def _html_text(self, html):
- """ accepts adapter objects with .html_text() and .xml_text() """
- ee = None
- try: return html.html_text()
- except Exception as e: ee = e; pass
- try: return html.xml_text()
-- except Exception as e: print "HtmlDocument/text", ee, e; pass
-+ except Exception as e: print("HtmlDocument/text", ee, e); pass
- try: return str(html)
-- except Exception as e: print "HtmlDocument/text", e; return " "
-+ except Exception as e: print("HtmlDocument/text", e); return " "
- def navigation(self):
- if self.navi:
- return self.navi
-@@ -103,15 +103,15 @@
- return filename
- def save(self, filename = None):
- filename = self._filename(filename)
-- print "writing '"+filename+"'"
-+ print("writing '"+filename+"'")
- try:
- fd = open(filename, "w")
-- print >>fd, self.html_header()
-+ print(self.html_header(), file=fd)
- for text in self.text:
-- print >>fd, self._html_text(text)
-- print >>fd, self.html_footer()
-+ print(self._html_text(text), file=fd)
-+ print(self.html_footer(), file=fd)
- fd.close()
- return True
- except IOError as e:
-- print "could not open '"+filename+"'file", e
-+ print("could not open '"+filename+"'file", e)
- return False
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/match.py zziplib-0.13.69/docs/zzipdoc/match.py
---- zziplib-0.13.69/docs/zzipdoc.orig/match.py 2020-03-27 16:41:51.799021400 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/match.py 2020-03-27 16:48:13.357609400 +0100
-@@ -18,7 +18,7 @@
- MatchReplace.__call__(self, matching, template, count, flags)
- def __call__(self, matching, template = None, count = 0, flags = None):
- """ other than __init__ the template may be left off to be unchanged"""
-- if isinstance(count, basestring): # count/flags swapped over?
-+ if isinstance(count, str): # count/flags swapped over?
- flags = count; count = 0
- if isinstance(matching, Match):
- self.matching = matching
-@@ -57,7 +57,7 @@
- def __call__(self, pattern, flags = None):
- assert isinstance(pattern, str) or pattern is None
- assert isinstance(flags, str) or flags is None
-- str.__init__(self, pattern)
-+ str.__init__(self)
- self.replaced = 0 # set by subn() inside MatchReplace
- self.found = None # set by search() to a MatchObject
- self.pattern = pattern
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/options.py zziplib-0.13.69/docs/zzipdoc/options.py
---- zziplib-0.13.69/docs/zzipdoc.orig/options.py 2020-03-27 16:43:56.274426500 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/options.py 2020-03-27 16:51:31.203008500 +0100
-@@ -3,13 +3,13 @@
- # @creator (C) 2003 Guido U. Draheim
- # @license http://creativecommons.org/licenses/by-nc-sa/2.0/de/
-
--from match import Match
-+from .match import Match
-
- # use as o.optionname to check for commandline options.
- class Options:
- var = {}
- def __getattr__(self, name):
-- if not self.var.has_key(name): return None
-+ if name not in self.var: return None
- return self.var[name]
- def __setattr__(self, name, value):
- self.var[name] = value
-diff -Nur zziplib-0.13.69/docs/zzipdoc.orig/textfileheader.py zziplib-0.13.69/docs/zzipdoc/textfileheader.py
---- zziplib-0.13.69/docs/zzipdoc.orig/textfileheader.py 2018-03-17 13:46:45.000000000 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/textfileheader.py 2020-03-27 16:44:46.583362100 +0100
-@@ -1,4 +1,4 @@
--from match import Match
-+from .match import Match
-
- class TextFileHeader:
- """ scan for a comment block at the source file start and fill the
-@@ -17,7 +17,7 @@
- x = Match()
- text = self.textfile.get_src_text()
- if not text:
-- print "nonexistent file:", self.textfile.get_filename()
-+ print("nonexistent file:", self.textfile.get_filename())
- return False
- if text & x(r"(?s)[/][*]+(\s(?:.(?!\*\/))*.)\*\/"
- r"(?:\s*\#(?:define|ifdef|endif)[ ]*\S*[ ]*\S*)*"
---- zziplib-0.13.69/docs/zzipdoc/match.py.orig 2018-03-17 13:46:45.000000000 +0100
-+++ zziplib-0.13.69/docs/zzipdoc/match.py 2020-03-27 16:41:02.379001800 +0100
-@@ -90,14 +90,14 @@
- if __name__ == "__main__":
- # matching:
- if "foo" & Match("oo"):
-- print "oo"
-+ print("oo")
- x = Match()
- if "foo" & x("(o+)"):
-- print x[1]
-+ print(x[1])
- # replacing:
- y = "fooboo" & Match("oo") >> "ee"
-- print y
-+ print(y)
- r = Match("oo") >> "ee"
-- print "fooboo" & r
-+ print("fooboo" & r)
- s = MatchReplace("oo", "ee")
-- print "fooboo" & s
-+ print("fooboo" & s)
diff --git a/mingw-w64-zziplib/python3.patch b/mingw-w64-zziplib/python3.patch
deleted file mode 100644
index 24c3562fc1..0000000000
--- a/mingw-w64-zziplib/python3.patch
+++ /dev/null
@@ -1,813 +0,0 @@
-diff -Nur zziplib-0.13.69/docs/dbk2man.py zziplib-master/docs/dbk2man.py
---- zziplib-0.13.69/docs/dbk2man.py 2018-03-17 13:46:45.000000000 +0100
-+++ zziplib-master/docs/dbk2man.py 2019-08-04 20:00:21.000000000 +0200
-@@ -1,4 +1,6 @@
- #! /usr/bin/python
-+from __future__ import print_function
-+
- """ Converts an xml-file with docbook elements into troff manual pages.
- The conversion uses etree expecting elements in the input.
- The output goes to a multiple files in manX/* subdirectories.
-@@ -9,22 +11,52 @@
- import logging
- import os.path
- import re
-+import collections
- import xml.etree.ElementTree as ET
-
- logg = logging.getLogger("dbk2man")
-
-+def esc(text):
-+ text = str(text)
-+ text = text.replace(".", "\\&.")
-+ text = text.replace("-", "\\-")
-+ return text
-+def unescape(text):
-+ text = str(text)
-+ text = text.replace('<', '<')
-+ text = text.replace('>', '>')
-+ text = text.replace('"', '"')
-+ text = text.replace('&', '&')
-+ return text
-+def htm(text):
-+ text = str(text)
-+ text = text.replace('&', '&')
-+ text = text.replace('<', '<')
-+ text = text.replace('>', '>')
-+ text = text.replace('"', '"')
-+ return text
-+def mailhref(text):
-+ return re.sub("<([^<>]*@[^<>]*)>",
-+ lambda x: '<%s>' % (x.group(1), x.group(1)),
-+ text)
-+
-+OverviewEntry = collections.namedtuple("OverviewEntry", ["manpage", "manvolnum", "refpurpose"])
-+
- def parse_docbook(filename):
- tree = ET.parse(filename)
- return tree.getroot()
-
--def dbk2man(filename, subdirectory = "."):
-- root = parse_docbook(filename)
-- return docbook2man(root, subdirectory)
-+def dbk2(man, filenames, subdirectory = "."):
-+ for filename in filenames:
-+ root = parse_docbook(filename)
-+ overview = docbook2(man, root, subdirectory)
-+ overview2(man, overview, subdirectory, filename)
-
--def docbook2man(root, subdirectory = "."):
-+def docbook2(man, root, subdirectory = "."):
- if root.tag != "reference":
- logg.warning("no found, not a docbook file?")
- logg.warning("found <%s> instead", root.tag)
-+ overview = {}
- title = ""
- for refentry in root:
- if refentry.tag == 'title':
-@@ -34,21 +66,12 @@
- logg.warning("no list found, not a docbook file?")
- logg.warning("found <%s> instead", refentry.tag)
- continue
-- refentry2man(refentry, subdirectory, title)
-+ overviewref = refentry2(man, refentry, subdirectory, title)
-+ for filename, overviewentry in overviewref.items():
-+ overview[filename] = overviewentry
-+ return overview
-
--def esc(text):
-- text = text.replace(".", "\\&.")
-- text = text.replace("-", "\\-")
-- return text
--def unescape(text):
-- text = text.replace('<', '<')
-- text = text.replace('>', '>')
-- text = text.replace('"', '"')
-- text = text.replace('&', '&')
-- return text
--
--
--def refentryinfo2(refentry, title):
-+def refentryinfo2(man, refentry, title):
- date, productname, manvolnum, refentrytitle = "", "", "", ""
- section = refentry.find("refentryinfo")
- if section is not None:
-@@ -62,24 +85,38 @@
- if found is not None: refentrytitle = found.text
- found = section.find("manvolnum")
- if found is not None: manvolnum = found.text
-- header = []
-- if refentrytitle:
-- header += [ refentrytitle ]
-- if manvolnum:
-- header += [ manvolnum ]
-- if date:
-- header += [ date ]
-- if productname:
-- header += [ productname ]
-- if title:
-- header += [ title ]
-- if header:
-+ if man:
-+ header = []
-+ if refentrytitle:
-+ header += [ refentrytitle ]
-+ if manvolnum:
-+ header += [ manvolnum ]
-+ if date:
-+ header += [ date ]
-+ if productname:
-+ header += [ productname ]
-+ if title:
-+ header += [ title ]
-+ if not header:
-+ logg.warning("no found")
-+ return ""
- text = '.TH ' + " ".join([ '"%s"' % esc(part) for part in header])
- return text + "\n"
-- logg.warning("no found")
-- return ""
-+ else:
-+ text = ""
-+ if productname or title:
-+ text += "%s: " % htm(productname or title)
-+ text += htm(refentrytitle)
-+ if manvolnum:
-+ text += "(%s)" % htm(manvolnum)
-+ text += ""
-+ text += "\n" + '' % htm(productname or title)
-+ text += "\n" + '' % htm(refentrytitle)
-+ text += "\n" + '' % htm(manvolnum)
-+ text += "\n" + '' % htm(date)
-+ return text + "\n\n"
-
--def refentrytitle2(refentry, title = ""):
-+def refentrytitle2(man, refentry, title = ""):
- refentrytitle = ""
- section = refentry.find("refmeta")
- if section is not None:
-@@ -95,89 +132,170 @@
- refname = found.text
- if refname not in refentries:
- refentries.append(refname)
-- if refentrytitle:
-+ if not refentrytitle:
-+ logg.warning("no found")
-+ return ""
-+ elif man:
- text = '.SH "NAME"' + "\n"
- text += "" + esc(", ".join(refentries))
- text += " " + esc("-")
- text += " " + esc(refpurpose)
- return text + "\n"
-- logg.warning("no found")
-- return ""
--
-+ else:
-+ text = '
Name
' + "\n"
-+ text += "
" + htm(", ".join(refentries))
-+ text += " " + htm("-")
-+ text += " " + htm(refpurpose)
-+ text += "
"
-+ return text + "\n"
-
--def refsynopsisdiv2(refentry, title = ""):
-- section = refentry.find("refsynopsisdiv")
-- if section is not None:
-- text = '.SH "SYNOPSIS"' + "\n"
-- text += ".sp\n"
-- text += ".nf\n"
-- for funcsynopsis in section.findall("funcsynopsis"):
-- funcsynopsisinfo = ""
-- found = funcsynopsis.find("funcsynopsisinfo")
-- if found is not None: funcsynopsisinfo = found.text
-- if funcsynopsisinfo:
-- for info in funcsynopsisinfo.split("\n"):
-- text += '.B "%s"' % esc(info)
-- text += "\n"
-- text += ".sp" + "\n"
-- else:
-- logg.debug("no found")
-- logg.debug("\n%s", ET.tostring(funcsynopsis))
-- funcs = 0
-- for funcprototype in funcsynopsis.findall("funcprototype"):
-- item = ET.tostring(funcprototype)
-- item = item.replace("","")
-- item = item.replace("","")
-- if False:
-- item = item.replace("\n", " ")
-- item = item.replace("","")
-- item = item.replace("","")
-- item = item.replace("",'')
-- item = item.replace("",'')
-- items = item.split("")
-- text += '.BI %s' % " ".join(['"%s"' % part for part in items if part])
-- else:
-- item = item.replace("","")
-- item = re.sub(r"([_\w]+)", lambda x: "\\fI%s\\fR" % x.group(1), item)
-- item = item.replace("",'')
-- item = item.replace("",'')
-- text += item
-+def refsynopsisdiv2(man, refentry, title = ""):
-+ refsynopsisdiv = refentry.find("refsynopsisdiv")
-+ if refsynopsisdiv is None:
-+ logg.warning("no found")
-+ return ""
-+ if man:
-+ return refsynopsisdiv2man(refsynopsisdiv, title)
-+ else:
-+ return refsynopsisdiv2htm(refsynopsisdiv, title)
-+
-+def refsynopsisdiv2man(refsynopsisdiv, title = ""):
-+ text = '.SH "SYNOPSIS"' + "\n"
-+ text += ".sp\n"
-+ text += ".nf\n"
-+ for funcsynopsis in refsynopsisdiv.findall("funcsynopsis"):
-+ funcsynopsisinfo = ""
-+ found = funcsynopsis.find("funcsynopsisinfo")
-+ if found is not None: funcsynopsisinfo = found.text
-+ if funcsynopsisinfo:
-+ for info in funcsynopsisinfo.split("\n"):
-+ text += '.B "%s"' % esc(info)
- text += "\n"
-- funcs += 1
-- if not funcs:
-- logg.warning("no found")
-- logg.warning("\n%s", ET.tostring(funcsynopsis))
-- text += ".fi" + "\n"
- text += ".sp" + "\n"
-- return text
-- logg.warning("no found")
-- return ""
-+ else:
-+ logg.debug("no found")
-+ logg.debug("\n%s", ET.tostring(funcsynopsis))
-+ funcs = 0
-+ for funcprototype in funcsynopsis.findall("funcprototype"):
-+ item = ET.tostring(funcprototype)
-+ item = str(item)
-+ item = item.replace("","")
-+ item = item.replace("","")
-+ if False:
-+ item = item.replace("\n", " ")
-+ item = item.replace("","")
-+ item = item.replace("","")
-+ item = item.replace("",'')
-+ item = item.replace("",'')
-+ items = item.split("")
-+ text += '.BI %s' % " ".join(['"%s"' % part for part in items if part])
-+ else:
-+ item = item.replace("","")
-+ item = re.sub(r"([_\w]+)", lambda x: "\\fI%s\\fR" % x.group(1), item)
-+ item = item.replace("",'')
-+ item = item.replace("",'')
-+ text += item
-+ text += "\n"
-+ funcs += 1
-+ if not funcs:
-+ logg.warning("no found")
-+ logg.warning("\n%s", ET.tostring(funcsynopsis))
-+ text += ".fi" + "\n"
-+ text += ".sp" + "\n"
-+ return text
-
--def refsections2(refentry, title = ""):
-+def refsynopsisdiv2htm(refsynopsisdiv, title = ""):
-+ text = '
Synopsis
' + "\n"
-+ text += '
' + "\n"
-+ for funcsynopsis in refsynopsisdiv.findall("funcsynopsis"):
-+ funcsynopsisinfo = ""
-+ found = funcsynopsis.find("funcsynopsisinfo")
-+ if found is not None: funcsynopsisinfo = found.text
-+ if funcsynopsisinfo:
-+ for info in funcsynopsisinfo.split("\n"):
-+ text += '%s' % htm(info)
-+ text += "\n"
-+ text += "\n"
-+ else:
-+ logg.debug("no found")
-+ logg.debug("\n%s", ET.tostring(funcsynopsis))
-+ funcs = 0
-+ for funcprototype in funcsynopsis.findall("funcprototype"):
-+ item = ET.tostring(funcprototype)
-+ item = str(item)
-+ item = item.replace("","")
-+ item = item.replace("","")
-+ item = item.replace("","")
-+ item = re.sub(r"([_\w]+)", lambda x: "%s" % x.group(1), item)
-+ item = item.replace("",'')
-+ item = item.replace("",'')
-+ text += item
-+ text += "\n"
-+ funcs += 1
-+ if not funcs:
-+ logg.warning("no found")
-+ logg.warning("\n%s", ET.tostring(funcsynopsis))
-+ text += "
" + "\n"
-+ return text
-+
-+def refsections2(man, refentry, title = ""):
- text = ""
- for refsect in refentry.findall("refsect1"):
-- head = refsect.find("title")
-- if head is not None:
-- text += '.SH "%s"' % (esc(head.text.upper()))
-- text += "\n"
-- for para in list(refsect):
-- if para.tag == 'title':
-- continue
-- if para.tag == 'para':
-- text += cleanpara(para) + "\n"
-+ if man:
-+ text += refsect2man(refsect, title)
-+ text += ".sp\n"
-+ else:
-+ text += refsect2htm(refsect, title)
-+ return text
-+
-+
-+def refsect2man(refsect, title = ""):
-+ text = ""
-+ head = refsect.find("title")
-+ if head is not None:
-+ text += '.SH "%s"' % (esc(head.text.upper()))
-+ text += "\n"
-+ for para in list(refsect):
-+ if para.tag == 'title':
-+ continue
-+ if para.tag == 'para':
-+ text += para2man(para) + "\n"
-+ text += ".sp\n"
-+ continue
-+ if para.tag == 'itemizedlist':
-+ for item in list(para):
-+ text += para2man(item) + "\n"
- text += ".sp\n"
-- continue
-- if para.tag == 'itemizedlist':
-- for item in list(para):
-- text += cleanpara(item) + "\n"
-- text += ".sp\n"
-- continue
-- logg.warning("unknown para <%s>", para.tag)
-- text += ".sp\n"
-+ continue
-+ logg.warning("unknown para <%s>", para.tag)
-+ return text
-+
-+def refsect2htm(refsect, title = ""):
-+ text = ""
-+ head = refsect.find("title")
-+ if head is not None:
-+ text += '
%s
' % htm(head.text)
-+ text += "\n"
-+ for para in list(refsect):
-+ if para.tag == 'title':
-+ continue
-+ if para.tag == 'para':
-+ text += "
" + para2htm(para)
-+ text += "
" + "\n"
-+ continue
-+ if para.tag == 'itemizedlist':
-+ text += "
" + "\n"
-+ for item in list(para):
-+ text += "
" + para2htm(item)
-+ text += "
" + "\n"
-+ text += "
" + "\n"
-+ continue
-+ logg.warning("unknown para <%s>", para.tag)
- return text
-
--def cleanpara(para):
-+def para2man(para):
- item = unescape(ET.tostring(para))
-+ item = str(item)
- item = item.replace("\n", " ")
- item = item.replace(" ", " ")
- item = item.replace(" ", " ")
-@@ -193,24 +311,53 @@
- item = item.replace("", "\\fP")
- return item
-
--def styleinfo():
-- styles = []
-- styles += [ ".ie \\n(.g .ds Aq \\(aq" ]
-- styles += [ ".el .ds Aq " ] # http://bugs.debian.org/507673
-- styles += [ ".nh" ] # disable hyphenation
-- styles += [ ".ad l" ] # align left, no justification
-- return "".join([ "%s\n" % part for part in styles ])
-+def para2htm(para):
-+ item = unescape(ET.tostring(para))
-+ item = str(item)
-+ item = item.replace("\n", " ")
-+ item = item.replace(" ", " ")
-+ item = item.replace(" ", " ")
-+ item = item.replace(" ", " ")
-+ item = item.replace(" ", " ")
-+ item = item.replace("", "")
-+ item = item.replace("", "")
-+ item = item.replace("", "")
-+ item = item.replace("", "")
-+ item = item.replace("", "")
-+ item = item.replace("", "")
-+ item = item.replace("", "")
-+ item = item.replace("", "")
-+ item = mailhref(item)
-+ return item
-+
-+def styleinfo2(man):
-+ if man:
-+ styles = []
-+ styles += [ ".ie \\n(.g .ds Aq \\(aq" ]
-+ styles += [ ".el .ds Aq " ] # http://bugs.debian.org/507673
-+ styles += [ ".nh" ] # disable hyphenation
-+ styles += [ ".ad l" ] # align left, no justification
-+ return "".join([ "%s\n" % part for part in styles ])
-+ else:
-+ return ""
-+
-+def refends2(man):
-+ if man:
-+ return ""
-+ else:
-+ return "" + "\n"
-
--def refentry2man(refentry, subdirectory = ".", title = ""):
-+def refentry2(man, refentry, subdirectory = ".", title = ""):
- if refentry.tag != "refentry":
- logg.warning("no found, not a docbook file?")
- logg.warning("found <%s> instead", refentry.tag)
- text = ""
-- text += refentryinfo2(refentry, title)
-- text += styleinfo()
-- text += refentrytitle2(refentry, title)
-- text += refsynopsisdiv2(refentry)
-- text += refsections2(refentry)
-+ text += refentryinfo2(man, refentry, title)
-+ text += styleinfo2(man)
-+ text += refentrytitle2(man, refentry, title)
-+ text += refsynopsisdiv2(man, refentry)
-+ text += refsections2(man, refentry)
-+ text += refends2(man)
-
- ### write the files
- refentrytitle = ""
-@@ -221,24 +368,70 @@
- if found is not None: refentrytitle = found.text
- found = section.find("manvolnum")
- if found is not None: manvolnum = found.text
-- written = 0
-+ #
-+ refpurpose = ""
- section = refentry.find("refnamediv")
-- for refname in section.findall("refname"):
-- if not refentrytitle:
-- refentrytitle = refname.text
-- manpage = refname.text
-- filename = "%s/man%s/%s.%s" % (subdirectory, manvolnum, manpage, manvolnum)
-- if manpage != refentrytitle:
-- manpagetext = ".so %s.%s\n" % (refentrytitle, manvolnum)
-- writefile(filename, manpagetext)
-- else:
-- manpagetext = text
-+ if not section:
-+ logg.warning("no found in for '%s', bad docbook?", refentrytitle)
-+ if not refentrytitle: raise Exception("not even a refentrytitle")
-+ manpages = [ refentrytitle ]
-+ else:
-+ manpages = [ refname.text for refname in section.findall("refname") ]
-+ found = section.find("refpurpose")
-+ if found is not None: refpurpose = found.text
-+ #
-+ overview = {}
-+ if man:
-+ written = 0
-+ for manpage in manpages:
-+ if not refentrytitle:
-+ refentrytitle = manpage
-+ filename = "%s/man%s/%s.%s" % (subdirectory, manvolnum, manpage, manvolnum)
-+ if manpage != refentrytitle:
-+ manpagetext = ".so %s.%s\n" % (refentrytitle, manvolnum)
-+ writefile(filename, manpagetext)
-+ else:
-+ manpagetext = text
-+ writefile(filename, manpagetext)
-+ written += 1
-+ overview[filename] = OverviewEntry(manpage, manvolnum, refpurpose)
-+ if not written:
-+ manpage = refentrytitle
-+ filename = "%s/man%s/%s.%s" % (subdirectory, manvolnum, manpage, manvolnum)
- writefile(filename, manpagetext)
-- written += 1
-- if not written:
-+ overview[filename] = OverviewEntry(manpage, manvolnum, refpurpose)
-+ else:
- manpage = refentrytitle
-- filename = "%s/man%s/%s.%s" % (subdirectory, manvolnum, manpage, manvolnum)
-- writefile(filename, manpagetext)
-+ filename = "%s/%s.%s.%s" % (subdirectory, manpage, manvolnum, "html")
-+ writefile(filename, text)
-+ overview[filename] = OverviewEntry(manpage, manvolnum, refpurpose)
-+ #
-+ return overview
-+
-+def splitname(filename):
-+ base = os.path.basename(filename)
-+ name, ext = os.path.splitext(base)
-+ return name
-+
-+def overview2(man, overview, subdirectory, docbook_filename):
-+ if not man:
-+ overview2htm(overview, subdirectory, docbook_filename)
-+
-+def overview2htm(overview, subdirectory, docbook_filename):
-+ basename = splitname(docbook_filename)
-+ text = "%s %s\n" % (htm(basename), htm("overview"))
-+ text += "\n"
-+ text += "
%s %s
\n" % (htm(basename), htm("overview"))
-+ text += "
\n"
-+ for filename in sorted(overview):
-+ entry = overview[filename]
-+ subdir_filename = os.path.basename(filename)
-+ text += '