diff options
author | Leo <thinkabit.ukim@gmail.com> | 2019-11-27 01:39:42 +0100 |
---|---|---|
committer | Leo <thinkabit.ukim@gmail.com> | 2019-11-27 09:44:28 +0100 |
commit | 2f78cb7781fb6d3a27eadb2312a14824349485ec (patch) | |
tree | 14dab0855c44ea880de6da83d76fcc47a0cb487d /main/asciidoc | |
parent | ec8bed83e80b4543043ad2c985163b094088b750 (diff) |
main/asciidoc: switch to python3
Import patches from Fedora and use the same source as them.
Diffstat (limited to 'main/asciidoc')
-rw-r--r-- | main/asciidoc/APKBUILD | 26 | ||||
-rw-r--r-- | main/asciidoc/asciidoc-python3-a2x-decode-fix.patch | 41 | ||||
-rw-r--r-- | main/asciidoc/asciidoc-python3-deprecation-warning.patch | 173 | ||||
-rw-r--r-- | main/asciidoc/asciidoc-python3.patch | 40 |
4 files changed, 270 insertions, 10 deletions
diff --git a/main/asciidoc/APKBUILD b/main/asciidoc/APKBUILD index 4113918a823..5637fde52c4 100644 --- a/main/asciidoc/APKBUILD +++ b/main/asciidoc/APKBUILD @@ -1,24 +1,28 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=asciidoc pkgver=8.6.10 -pkgrel=0 +pkgrel=1 +_commit=986f99d743d0b6ddc2014bdc8dcfa991ab9b4863 pkgdesc="Text based documentation" url="http://asciidoc.org/" arch="noarch" -license="GPL-2.0" -depends="python2 libxml2-utils docbook-xsl" -makedepends="autoconf" +license="GPL-2.0-or-later and GPL-1.0-or-later" +depends="python3 libxml2-utils docbook-xsl" +makedepends="autoconf automake" subpackages="$pkgname-doc $pkgname-vim::noarch" -source="$pkgname-$pkgver.tar.gz::https://github.com/asciidoc/asciidoc/archive/$pkgver.tar.gz" -builddir="$srcdir/$pkgname-$pkgver" +source="$pkgname-$_commit.tar.gz::https://github.com/asciidoc/asciidoc-py3/archive/$_commit/asciidoc-py3-$_commit.tar.gz + asciidoc-python3.patch + asciidoc-python3-a2x-decode-fix.patch + asciidoc-python3-deprecation-warning.patch + " +builddir="$srcdir/asciidoc-py3-$_commit" prepare() { default_prepare - autoconf + autoreconf -fi } build() { - cd "$builddir" ./configure \ --build=$CBUILD \ --host=$CHOST \ @@ -30,7 +34,6 @@ build() { } package() { - cd "$builddir" make DESTDIR="$pkgdir" install } @@ -41,4 +44,7 @@ vim() { "$subpkgdir"/usr/share/vim/vimfiles/syntax/$pkgname.vim } -sha512sums="6ecc86977baaf1c756691e3f661e43ef2bb24e606898f6075bfa6f174d1fdc5e77d00853ffe014847e295364349d6ad34f3b8209cb97870e0233012fc38a281a asciidoc-8.6.10.tar.gz" +sha512sums="758362cac485cbe4fd504224f7a8d24d20955464dd56af258e9a70deac8dc89d0f07f8e4567cfbbd3e1cbe6336704e9d12590bade662dd5bf228ea7e611676d1 asciidoc-986f99d743d0b6ddc2014bdc8dcfa991ab9b4863.tar.gz +331d7c1a6e8ec6bdd11c2998c0d76285e282914ca12a0de79e04199926f7fd10a7b24a3602fd01d3cbdf7fb8f718000eb8d5063236354c894a9187ab54194aa6 asciidoc-python3.patch +dfa4b288c894373aecebafbadf726aadcb51cf4578c0903433936c114a587b086695f85c97bf712140d94adc916c83d0c861c5af8cf15195a3364ca8e4e8414e asciidoc-python3-a2x-decode-fix.patch +de4687009f4c5dd4d3f7727634e6577d1e6df3f4c812dd4d4c9828a31d529b8e520ae43a53a63cb4c154664d51d5bad96728f05feb9e9ec0889849903cae739e asciidoc-python3-deprecation-warning.patch" diff --git a/main/asciidoc/asciidoc-python3-a2x-decode-fix.patch b/main/asciidoc/asciidoc-python3-a2x-decode-fix.patch new file mode 100644 index 00000000000..5525c7d6dca --- /dev/null +++ b/main/asciidoc/asciidoc-python3-a2x-decode-fix.patch @@ -0,0 +1,41 @@ +Taken from upstream PR#5 (https://github.com/asciidoc/asciidoc-py3/pull/5) + +6469317 Remove unnecessary decode in a2x (Matthew Peveler) +684913e Fix decoding of file that specifies encoding in header tag in a2x (Matthew Peveler) +8369a97 re-add --nonet option (Matthew Peveler) + +diff --git c/a2x.py w/a2x.py +index 55eb57e..c015079 100755 +--- c/a2x.py ++++ w/a2x.py +@@ -254,15 +254,11 @@ def find_resources(files, tagname, attrname, filter=None): + if OPTIONS.dry_run: + continue + parser = FindResources() +- # HTMLParser has problems with non-ASCII strings. +- # See http://bugs.python.org/issue3932 +- contents = read_file(filename) +- mo = re.search(r'\A<\?xml.* encoding="(.*?)"', contents) +- if mo: +- encoding = mo.group(1) +- parser.feed(contents.decode(encoding)) +- else: +- parser.feed(contents) ++ with open(filename, 'rb') as open_file: ++ contents = open_file.read() ++ mo = re.search(b'\A<\?xml.* encoding="(.*?)"', contents) ++ contents = contents.decode(mo.group(1).decode('utf-8') if mo else 'utf-8') ++ parser.feed(contents) + parser.close() + result = list(set(result)) # Drop duplicate values. + result.sort() +@@ -337,7 +333,7 @@ def get_source_options(asciidoc_file): + result = [] + if os.path.isfile(asciidoc_file): + options = '' +- with open(asciidoc_file) as f: ++ with open(asciidoc_file, encoding='utf-8') as f: + for line in f: + mo = re.search(r'^//\s*a2x:', line) + if mo: + diff --git a/main/asciidoc/asciidoc-python3-deprecation-warning.patch b/main/asciidoc/asciidoc-python3-deprecation-warning.patch new file mode 100644 index 00000000000..00b4f0e9db6 --- /dev/null +++ b/main/asciidoc/asciidoc-python3-deprecation-warning.patch @@ -0,0 +1,173 @@ +diff -urNp a/asciidoc.conf b/asciidoc.conf +--- a/asciidoc.conf 2018-12-03 13:06:23.377407390 +0100 ++++ b/asciidoc.conf 2018-12-03 13:07:08.142320548 +0100 +@@ -29,7 +29,7 @@ empty= + sp=" " + # Attribute and AttributeList element patterns. + attributeentry-pattern=^:(?P<attrname>\w[^.]*?)(\.(?P<attrname2>.*?))?:(\s+(?P<attrvalue>.*))?$ +-attributelist-pattern=(?u)(^\[\[(?P<id>[\w_:][\w_:.-]*)(,(?P<reftext>.*?))?\]\]$)|(^\[(?P<attrlist>.*)\]$) ++attributelist-pattern=(^\[\[(?P<id>[\w_:][\w_:.-]*)(,(?P<reftext>.*?))?\]\]$)|(^\[(?P<attrlist>.*)\]$) + # Substitution attributes for escaping AsciiDoc processing. + amp=& + lt=< +@@ -288,10 +288,10 @@ endif::no-inline-literal[] + # Block macros + #------------- + # Macros using default syntax. +-(?u)^(?P<name>image|unfloat|toc)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$=# ++^(?P<name>image|unfloat|toc)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$=# + + # Passthrough macros. +-(?u)^(?P<name>pass)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=# ++^(?P<name>pass)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=# + + ^'{3,}$=#ruler + ^<{3,}$=#pagebreak +diff -urNp a/asciidoc.py b/asciidoc.py +--- a/asciidoc.py 2018-12-03 13:06:23.378407388 +0100 ++++ b/asciidoc.py 2018-12-03 13:17:41.965990011 +0100 +@@ -30,7 +30,7 @@ SUBS_NORMAL = ('specialcharacters','quot + 'specialwords','replacements','macros','replacements2') + SUBS_VERBATIM = ('specialcharacters','callouts') + +-NAME_RE = r'(?u)[^\W\d][-\w]*' # Valid section or attribute name. ++NAME_RE = r'[^\W\d][-\w]*' # Valid section or attribute name. + OR, AND = ',', '+' # Attribute list separators. + + +@@ -463,7 +463,7 @@ def parse_options(options,allowed,errmsg + + def symbolize(s): + """Drop non-symbol characters and convert to lowercase.""" +- return re.sub(r'(?u)[^\w\-_]', '', s).lower() ++ return re.sub(r'[^\w\-_]', '', s).lower() + + def is_name(s): + """Return True if s is valid attribute, macro or tag name +@@ -1746,7 +1746,7 @@ class AttributeEntry: + attr.name = attr.name[:-1] + attr.value = None + # Strip white space and illegal name chars. +- attr.name = re.sub(r'(?u)[^\w\-_]', '', attr.name).lower() ++ attr.name = re.sub(r'[^\w\-_]', '', attr.name).lower() + # Don't override most command-line attributes. + if attr.name in config.cmd_attrs \ + and attr.name not in ('trace','numbered'): +@@ -1946,7 +1946,7 @@ class Title: + if ul != s[:ul_len]: return False + # Don't be fooled by back-to-back delimited blocks, require at + # least one alphanumeric character in title. +- if not re.search(r'(?u)\w',title): return False ++ if not re.search(r'\w',title): return False + mo = re.match(Title.pattern, title) + if mo: + Title.attributes = mo.groupdict() +@@ -2104,7 +2104,7 @@ class Section: + """ + # Replace non-alpha numeric characters in title with underscores and + # convert to lower case. +- base_id = re.sub(r'(?u)\W+', '_', title).strip('_').lower() ++ base_id = re.sub(r'\W+', '_', title).strip('_').lower() + if 'ascii-ids' in document.attributes: + # Replace non-ASCII characters with ASCII equivalents. + import unicodedata +@@ -3602,7 +3602,7 @@ class Tables(AbstractBlocks): + + class Macros: + # Default system macro syntax. +- SYS_RE = r'(?u)^(?P<name>[\\]?\w(\w|-)*?)::(?P<target>\S*?)' + \ ++ SYS_RE = r'^(?P<name>[\\]?\w(\w|-)*?)::(?P<target>\S*?)' + \ + r'(\[(?P<attrlist>.*?)\])$' + def __init__(self): + self.macros = [] # List of Macros. +@@ -4478,7 +4478,7 @@ class Config: + rdr.open(fname) + message.linenos = None + self.fname = fname +- reo = re.compile(r'(?u)^\[(?P<section>\+?[^\W\d][\w-]*)\]\s*$') ++ reo = re.compile(r'^\[(?P<section>\+?[^\W\d][\w-]*)\]\s*$') + sections = OrderedDict() + section,contents = '',[] + while not rdr.eof(): +diff -urNp a/doc/asciidoc.conf b/doc/asciidoc.conf +--- a/doc/asciidoc.conf 2018-12-03 13:06:23.379407386 +0100 ++++ b/doc/asciidoc.conf 2018-12-03 13:07:32.374272984 +0100 +@@ -3,5 +3,5 @@ + # + [specialwords] + ifndef::doctype-manpage[] +-monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\) ++monospacedwords=\\?\basciidoc\(1\) \\?\ba2x\(1\) + endif::doctype-manpage[] +diff -urNp a/docbook45.conf b/docbook45.conf +--- a/docbook45.conf 2018-12-03 13:06:23.383407378 +0100 ++++ b/docbook45.conf 2018-12-03 13:07:53.221231766 +0100 +@@ -47,7 +47,7 @@ latexmath-style=template="latexmathblock + [macros] + # math macros. + (?su)[\\]?(?P<name>latexmath):(?P<subslist>\S*?)\[(?:\$\s*)?(?P<passtext>.*?)(?:\s*\$)?(?<!\\)\]=[] +-(?u)^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\s*\\\])?\])$=#[] ++^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\s*\\\])?\])$=#[] + + [latexmath-inlinemacro] + <inlineequation> +diff -urNp a/examples/website/layout1.conf b/examples/website/layout1.conf +--- a/examples/website/layout1.conf 2018-12-03 13:06:23.384407377 +0100 ++++ b/examples/website/layout1.conf 2018-12-03 13:08:17.989182454 +0100 +@@ -22,7 +22,7 @@ + # xhtml11 backend stylesheets. + + [specialwords] +-monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\) ++monospacedwords=\\?\basciidoc\(1\) \\?\ba2x\(1\) + + [header] + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" +diff -urNp a/examples/website/layout2.conf b/examples/website/layout2.conf +--- a/examples/website/layout2.conf 2018-12-03 13:06:23.384407377 +0100 ++++ b/examples/website/layout2.conf 2018-12-03 13:08:35.614147145 +0100 +@@ -24,7 +24,7 @@ + # xhtml11 backend stylesheets. + + [specialwords] +-monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\) ++monospacedwords=\\?\basciidoc\(1\) \\?\ba2x\(1\) + + [header] + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" +diff -urNp a/html5.conf b/html5.conf +--- a/html5.conf 2018-12-03 13:06:23.386407373 +0100 ++++ b/html5.conf 2018-12-03 13:08:59.231099559 +0100 +@@ -36,13 +36,13 @@ asciimath-style=template="asciimathblock + latexmath-style=template="latexmathblock",subs=(),posattrs=(),filter="unwraplatex.py" + + [macros] +-(?u)^(?P<name>audio|video)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$=# ++^(?P<name>audio|video)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$=# + # math macros. + # Special characters are escaped in HTML math markup. + (?su)[\\]?(?P<name>asciimath):(?P<subslist>\S*?)\[(?P<passtext>.*?)(?<!\\)\]=[specialcharacters] +-(?u)^(?P<name>asciimath)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=#[specialcharacters] ++^(?P<name>asciimath)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=#[specialcharacters] + (?su)[\\]?(?P<name>latexmath):(?P<subslist>\S*?)\[(?:\$\s*)?(?P<passtext>.*?)(?:\s*\$)?(?<!\\)\]=[specialcharacters] +-(?u)^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\s*\\\])?\])$=#[specialcharacters] ++^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\s*\\\])?\])$=#[specialcharacters] + + [asciimath-inlinemacro] + `{passtext}` +diff -urNp a/xhtml11.conf b/xhtml11.conf +--- a/xhtml11.conf 2018-12-03 13:06:23.395407355 +0100 ++++ b/xhtml11.conf 2018-12-03 13:09:18.358060798 +0100 +@@ -39,9 +39,9 @@ latexmath-style=template="latexmathblock + # math macros. + # Special characters are escaped in HTML math markup. + (?su)[\\]?(?P<name>asciimath):(?P<subslist>\S*?)\[(?P<passtext>.*?)(?<!\\)\]=[specialcharacters] +-(?u)^(?P<name>asciimath)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=#[specialcharacters] ++^(?P<name>asciimath)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=#[specialcharacters] + (?su)[\\]?(?P<name>latexmath):(?P<subslist>\S*?)\[(?:\$\s*)?(?P<passtext>.*?)(?:\s*\$)?(?<!\\)\]=[specialcharacters] +-(?u)^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\s*\\\])?\])$=#[specialcharacters] ++^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\s*\\\])?\])$=#[specialcharacters] + + [asciimath-inlinemacro] + `{passtext}` + diff --git a/main/asciidoc/asciidoc-python3.patch b/main/asciidoc/asciidoc-python3.patch new file mode 100644 index 00000000000..74c53d8f757 --- /dev/null +++ b/main/asciidoc/asciidoc-python3.patch @@ -0,0 +1,40 @@ +diff -urNp old/filters/latex/latex2img.py new/filters/latex/latex2img.py +--- old/filters/latex/latex2img.py 2018-06-05 15:27:44.153533130 +0200 ++++ new/filters/latex/latex2img.py 2018-06-05 15:28:43.542828463 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/env python3 + ''' + NAME + latex2img - Converts LaTeX source to PNG or SVG file +diff -urNp old/filters/music/music2png.py new/filters/music/music2png.py +--- old/filters/music/music2png.py 2018-06-05 15:27:44.153533130 +0200 ++++ new/filters/music/music2png.py 2018-06-05 15:28:56.502882780 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/env python3 + ''' + NAME + music2png - Converts textual music notation to classically notated PNG file +diff -urNp old/filters/unwraplatex.py new/filters/unwraplatex.py +--- old/filters/unwraplatex.py 2018-06-05 15:27:44.152533125 +0200 ++++ new/filters/unwraplatex.py 2018-06-05 15:28:29.956767744 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/env python3 + ''' + NAME + unwraplatex - Removes delimiters from LaTeX source text +diff -urNp old/Makefile.in new/Makefile.in +--- old/Makefile.in 2018-06-05 15:27:44.144533079 +0200 ++++ new/Makefile.in 2018-06-05 15:27:56.328600132 +0200 +@@ -107,7 +107,7 @@ $(DATATARGETS): % : %dir + $(INSTALL_DATA) $($@) $(DESTDIR)/$($<)/ + + $(manp): %.1 : %.1.txt +- python2 a2x.py -f manpage $< ++ python3 a2x.py -f manpage $< + + docs: + $(INSTALL) -d $(DESTDIR)/$(docdir) + |