commit:     65f03f171fac890573267be3554f7256975a6b10
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat May 14 07:50:52 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat May 14 08:25:50 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65f03f17

dev-python/docutils: Enable py3.11

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/docutils/docutils-0.17.1-r1.ebuild      |   6 +-
 dev-python/docutils/docutils-0.18.1-r1.ebuild      |   6 +-
 .../docutils/files/docutils-0.18.1-py311.patch     | 135 +++++++++++++++++++++
 3 files changed, 145 insertions(+), 2 deletions(-)

diff --git a/dev-python/docutils/docutils-0.17.1-r1.ebuild 
b/dev-python/docutils/docutils-0.17.1-r1.ebuild
index 5d0b53a49995..14547bfb4e2f 100644
--- a/dev-python/docutils/docutils-0.17.1-r1.ebuild
+++ b/dev-python/docutils/docutils-0.17.1-r1.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{8..10} pypy3 )
+PYTHON_COMPAT=( python3_{8..11} pypy3 )
 
 inherit distutils-r1
 
@@ -26,6 +26,10 @@ BDEPEND="
        ${RDEPEND}
 "
 
+PATCHES=(
+       "${FILESDIR}/docutils-0.18.1-py311.patch"
+)
+
 python_compile_all() {
        # Generate html docs from reStructured text sources.
 

diff --git a/dev-python/docutils/docutils-0.18.1-r1.ebuild 
b/dev-python/docutils/docutils-0.18.1-r1.ebuild
index 5d0b53a49995..14298078d9f9 100644
--- a/dev-python/docutils/docutils-0.18.1-r1.ebuild
+++ b/dev-python/docutils/docutils-0.18.1-r1.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{8..10} pypy3 )
+PYTHON_COMPAT=( python3_{8..11} pypy3 )
 
 inherit distutils-r1
 
@@ -26,6 +26,10 @@ BDEPEND="
        ${RDEPEND}
 "
 
+PATCHES=(
+       "${FILESDIR}/${P}-py311.patch"
+)
+
 python_compile_all() {
        # Generate html docs from reStructured text sources.
 

diff --git a/dev-python/docutils/files/docutils-0.18.1-py311.patch 
b/dev-python/docutils/files/docutils-0.18.1-py311.patch
new file mode 100644
index 000000000000..878c6f1961db
--- /dev/null
+++ b/dev-python/docutils/files/docutils-0.18.1-py311.patch
@@ -0,0 +1,135 @@
+Combination of:
+http://svn.code.sf.net/p/docutils/code/trunk@8910
+http://svn.code.sf.net/p/docutils/code/trunk@8909
+
+diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py
+index 592d3f9df..e1f33aa7a 100644
+--- a/test/DocutilsTestSupport.py
++++ b/test/DocutilsTestSupport.py
+@@ -819,6 +819,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..73724ed7e 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,92 @@ 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">
++    <table>
++        <title>
++            bad encoding
++        <tgroup cols="4">
++            <colspec colwidth="25">
++            <colspec colwidth="25">
++            <colspec colwidth="25">
++            <colspec colwidth="25">
++            <tbody>
++                <row>
++                    <entry>
++                        <paragraph>
++                            \xfe\xff"Treat"
++                    <entry>
++                        <paragraph>
++                            "Quantity"
++                    <entry>
++                        <paragraph>
++                            "Description"
++                    <entry>
++                <row>
++                    <entry>
++                        <paragraph>
++                            "Albatr\u00b0\u00df"
++                    <entry>
++                        <paragraph>
++                            2.99
++                    <entry>
++                        <paragraph>
++                            "\u00a1Ona\x03\xc3\x03\xc4\x03\xb9\x03\xba!"
++                    <entry>
++                <row>
++                    <entry>
++                        <paragraph>
++                            "CrunchyFrog"
++                    <entry>
++                        <paragraph>
++                            1.49
++                    <entry>
++                        <paragraph>
++                            "Ifwetooktheb\u00f6nesout
++                    <entry>
++                        <paragraph>
++                            itwouldn\x20\x19tbe
++                <row>
++                    <entry>
++                        <paragraph>
++                            crunchy
++                    <entry>
++                        <paragraph>
++                            nowwouldit?"
++                    <entry>
++                    <entry>
++                <row>
++                    <entry>
++                        <paragraph>
++                            "GannetRipple"
++                    <entry>
++                        <paragraph>
++                            1.99
++                    <entry>
++                        <paragraph>
++                            "\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.)
++"""
++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 +1117,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

Reply via email to