summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2022-11-28 00:05:04 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2022-11-28 00:06:01 +0000
commit7c891f1b68cdae9c34133c93c2b4b3a600b1c148 (patch)
treed8533d3acec57a2763eae4d6987b01e36b7d9b03
parent5b5c5dc82d40efa231b4a2403dfcd154311e0baf (diff)
downloadpackages-7c891f1b68cdae9c34133c93c2b4b3a600b1c148.tar.gz
packages-7c891f1b68cdae9c34133c93c2b4b3a600b1c148.tar.bz2
packages-7c891f1b68cdae9c34133c93c2b4b3a600b1c148.tar.xz
packages-7c891f1b68cdae9c34133c93c2b4b3a600b1c148.zip
user/py3-docutils: Fix test suite for 3.11 compat
Backport of https://sourceforge.net/p/docutils/code/8909 and 8910. Fixes: #892
-rw-r--r--user/py3-docutils/APKBUILD7
-rw-r--r--user/py3-docutils/py311-test.patch246
2 files changed, 251 insertions, 2 deletions
diff --git a/user/py3-docutils/APKBUILD b/user/py3-docutils/APKBUILD
index 7dc54af91..34006c824 100644
--- a/user/py3-docutils/APKBUILD
+++ b/user/py3-docutils/APKBUILD
@@ -14,7 +14,9 @@ license="Custom"
depends="python3 py3-pillow"
makedepends="python3-dev"
subpackages="$pkgname-doc"
-source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/$_p/$_pkgname/$_pkgname-$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/$_p/$_pkgname/$_pkgname-$pkgver.tar.gz
+ py311-test.patch
+ "
builddir="$srcdir/$_pkgname-$pkgver"
build() {
@@ -49,4 +51,5 @@ doc() {
cp "$builddir"/licenses/* "$licdir"
}
-sha512sums="5ec2087116bd5356fdffc54f07f6b0355aac5fa9d6caeefa77e8d201fd4706c0d419193c4d9a3964ae493da3091fe2c7dc36b74f81a1e1b9282173658b06e71b py3-docutils-0.17.1.tar.gz"
+sha512sums="5ec2087116bd5356fdffc54f07f6b0355aac5fa9d6caeefa77e8d201fd4706c0d419193c4d9a3964ae493da3091fe2c7dc36b74f81a1e1b9282173658b06e71b py3-docutils-0.17.1.tar.gz
+9842be1028d6430c74ba2537eeee151eff459bac52b04934a165cc9776d9a6ad4e602b97d556b337a8f38d46f181878dd325565afb259b481abc3b7648d897ac py311-test.patch"
diff --git a/user/py3-docutils/py311-test.patch b/user/py3-docutils/py311-test.patch
new file mode 100644
index 000000000..4975b65ba
--- /dev/null
+++ b/user/py3-docutils/py311-test.patch
@@ -0,0 +1,246 @@
+From de1e14dd9374cf9932be4ee43970083ad332cd98 Mon Sep 17 00:00:00 2001
+From: milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>
+Date: Sat, 27 Nov 2021 16:28:38 +0000
+Subject: [PATCH] Special-casing for Python 3.11: Null char valid in CSV.
+
+First part of a fix for bug #436.
+
+git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8909 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
+---
+ test/DocutilsTestSupport.py | 1 +
+ .../test_rst/test_directives/test_tables.py | 88 ++++++++++++++++++----
+ 2 files changed, 76 insertions(+), 13 deletions(-)
+
+diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py
+index 592d3f9df..e1f33aa7a 100644
+--- a/test/DocutilsTestSupport.py
++++ b/test/DocutilsTestSupport.py
+@@ -818,6 +818,7 @@ def exception_data(func, *args, **kwds):
+ except Exception as detail:
+ return (detail, detail.args,
+ '%s: %s' % (detail.__class__.__name__, detail))
++ return None, [], "No exception"
+
+
+ def _format_str(*args):
+diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py
+index 07be0122f..b030e7552 100755
+--- a/test/test_parsers/test_rst/test_directives/test_tables.py
++++ b/test/test_parsers/test_rst/test_directives/test_tables.py
+@@ -65,6 +65,79 @@ def null_bytes():
+ next(reader)
+
+ null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes)[0]
++# Null bytes are valid in Python 3.11+:
++if null_bytes_exception is None:
++ bad_encoding_result = """\
++<document source="test data">
++<document source="test data">
++ <table>
++ <title>
++ good encoding
++ <tgroup cols="3">
++ <colspec colwidth="33">
++ <colspec colwidth="33">
++ <colspec colwidth="33">
++ <thead>
++ <row>
++ <entry>
++ <paragraph>
++ Treat
++ <entry>
++ <paragraph>
++ Quantity
++ <entry>
++ <paragraph>
++ Description
++ <tbody>
++ <row>
++ <entry>
++ <paragraph>
++ Albatr\u00b0\u00df
++ <entry>
++ <paragraph>
++ 2.99
++ <entry>
++ <paragraph>
++ \u00a1On a \u03c3\u03c4\u03b9\u03ba!
++ <row>
++ <entry>
++ <paragraph>
++ Crunchy Frog
++ <entry>
++ <paragraph>
++ 1.49
++ <entry>
++ <paragraph>
++ If we took the b\u00f6nes out, it wouldn\u2019t be
++ crunchy, now would it?
++ <row>
++ <entry>
++ <paragraph>
++ Gannet Ripple
++ <entry>
++ <paragraph>
++ 1.99
++ <entry>
++ <paragraph>
++ \u00bfOn a \u03c3\u03c4\u03b9\u03ba?
++ <paragraph>
++ (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
++""" % (null_bytes_exception, utf_16_csv)
++else:
++ bad_encoding_result = """\
++<document source="test data">
++ <system_message level="3" line="1" source="test data" type="ERROR">
++ <paragraph>
++ Error with CSV data in "csv-table" directive:
++ %s
++ <literal_block xml:space="preserve">
++ .. csv-table:: bad encoding
++ :file: %s
++ :encoding: latin-1
++ <paragraph>
++ (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
++""" % (null_bytes_exception, utf_16_csv)
++
+
+ totest = {}
+
+@@ -1031,19 +1104,8 @@ u"""\
+
+ (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
+ """ % utf_16_csv,
+-"""\
+-<document source="test data">
+- <system_message level="3" line="1" source="test data" type="ERROR">
+- <paragraph>
+- Error with CSV data in "csv-table" directive:
+- %s
+- <literal_block xml:space="preserve">
+- .. csv-table:: bad encoding
+- :file: %s
+- :encoding: latin-1
+- <paragraph>
+- (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
+-""" % (null_bytes_exception, utf_16_csv)],
++bad_encoding_result
++],
+ ["""\
+ .. csv-table:: good encoding
+ :file: %s
+--
+2.11.4.GIT
+
+From 83b6811e753947c9d8576d410c635b36d515657c Mon Sep 17 00:00:00 2001
+From: grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>
+Date: Sat, 27 Nov 2021 21:16:41 +0000
+Subject: [PATCH] Change
+ test/test_parsers/test_rst/test_directives/test_tables.py for python 3.11.0a2
+ csv modules supports null character.
+
+git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8910 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
+---
+ .../test_rst/test_directives/test_tables.py | 51 ++++++++++++++--------
+ 1 file changed, 31 insertions(+), 20 deletions(-)
+
+diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py
+index b030e7552..73724ed7e 100755
+--- a/test/test_parsers/test_rst/test_directives/test_tables.py
++++ b/test/test_parsers/test_rst/test_directives/test_tables.py
+@@ -69,60 +69,73 @@ null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes)[0]
+ if null_bytes_exception is None:
+ bad_encoding_result = """\
+ <document source="test data">
+-<document source="test data">
+ <table>
+ <title>
+- good encoding
+- <tgroup cols="3">
+- <colspec colwidth="33">
+- <colspec colwidth="33">
+- <colspec colwidth="33">
+- <thead>
++ bad encoding
++ <tgroup cols="4">
++ <colspec colwidth="25">
++ <colspec colwidth="25">
++ <colspec colwidth="25">
++ <colspec colwidth="25">
++ <tbody>
+ <row>
+ <entry>
+ <paragraph>
+- Treat
++ \xfe\xff"Treat"
+ <entry>
+ <paragraph>
+- Quantity
++ "Quantity"
+ <entry>
+ <paragraph>
+- Description
+- <tbody>
++ "Description"
++ <entry>
+ <row>
+ <entry>
+ <paragraph>
+- Albatr\u00b0\u00df
++ "Albatr\u00b0\u00df"
+ <entry>
+ <paragraph>
+ 2.99
+ <entry>
+ <paragraph>
+- \u00a1On a \u03c3\u03c4\u03b9\u03ba!
++ "\u00a1Ona\x03\xc3\x03\xc4\x03\xb9\x03\xba!"
++ <entry>
+ <row>
+ <entry>
+ <paragraph>
+- Crunchy Frog
++ "CrunchyFrog"
+ <entry>
+ <paragraph>
+ 1.49
+ <entry>
+ <paragraph>
+- If we took the b\u00f6nes out, it wouldn\u2019t be
+- crunchy, now would it?
++ "Ifwetooktheb\u00f6nesout
++ <entry>
++ <paragraph>
++ itwouldn\x20\x19tbe
+ <row>
+ <entry>
+ <paragraph>
+- Gannet Ripple
++ crunchy
++ <entry>
++ <paragraph>
++ nowwouldit?"
++ <entry>
++ <entry>
++ <row>
++ <entry>
++ <paragraph>
++ "GannetRipple"
+ <entry>
+ <paragraph>
+ 1.99
+ <entry>
+ <paragraph>
+- \u00bfOn a \u03c3\u03c4\u03b9\u03ba?
++ "\xbfOna\x03\xc3\x03\xc4\x03\xb9\x03\xba?"
++ <entry>
+ <paragraph>
+ (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
+-""" % (null_bytes_exception, utf_16_csv)
++"""
+ else:
+ bad_encoding_result = """\
+ <document source="test data">
+--
+2.11.4.GIT
+