diff --git a/python-docutils.spec b/python-docutils.spec index 26d464e83ca17f1f4bcd7a0754face3eb5e6e181..88443e501df361deb91a9b210103e8972f8ca65f 100644 --- a/python-docutils.spec +++ b/python-docutils.spec @@ -4,11 +4,12 @@ Name: python-%{modname} Version: 0.17.1 -Release: 2 +Release: 3 Summary: Documentation Utilities Written in Python, for General- and Special-Purpose Use License: Public Domain and BSD-2-Clause and Python and GPLv3+ URL: http://docutils.sourceforge.net Source0: http://downloads.sourceforge.net/docutils/docutils-%{version}.tar.gz +Patch00: skip_null-bytes_exeception_tests_on_py3.11.patch BuildArch: noarch BuildRequires: python3-devel @@ -93,6 +94,9 @@ popd %doc THANKS.txt docs tools/editors %changelog +* Thu Oct 10 2024 tzing_t - 0.17.1-3 +- fix build error, skip null-bytes exception tests on python 3.11 + * Mon May 9 2022 baizhonggui - 0.17.1-2 - modify license identifier diff --git a/skip_null-bytes_exeception_tests_on_py3.11.patch b/skip_null-bytes_exeception_tests_on_py3.11.patch new file mode 100644 index 0000000000000000000000000000000000000000..8211578ec917309f8fde62abaa00ae6f0411e842 --- /dev/null +++ b/skip_null-bytes_exeception_tests_on_py3.11.patch @@ -0,0 +1,88 @@ +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 2e11131..cf9f097 100755 +--- a/test/test_parsers/test_rst/test_directives/test_tables.py ++++ b/test/test_parsers/test_rst/test_directives/test_tables.py +@@ -55,17 +55,6 @@ csv_unknown_url = "'bogus.csv'" + if sys.version_info < (3, 0): + csv_unknown_url = "bogus.csv" + +- +-def null_bytes(): +- with open(utf_16_csv, 'rb') as f: +- csv_data = f.read() +- csv_data = unicode(csv_data, 'latin1').splitlines() +- reader = csv.reader([tables.CSVTable.encode_for_csv(line + '\n') +- for line in csv_data]) +- next(reader) +- +-null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes)[0] +- + totest = {} + + totest['table'] = [ +@@ -1025,26 +1014,6 @@ u"""\ + good, csv, data + """ % csv_eod_error_str], + ["""\ +-.. csv-table:: bad encoding +- :file: %s +- :encoding: latin-1 +- +-(7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.) +-""" % utf_16_csv, +-"""\ +- +- +- +- Error with CSV data in "csv-table" directive: +- %s +- +- .. csv-table:: bad encoding +- :file: %s +- :encoding: latin-1 +- +- (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.) +-""" % (null_bytes_exception, utf_16_csv)], +-["""\ + .. csv-table:: good encoding + :file: %s + :encoding: utf-16 +@@ -1459,6 +1428,38 @@ totest['list-table'] = [ + """], + ] + ++if sys.version_info < (3, 11): ++ def null_bytes(): ++ with open(utf_16_csv, 'rb') as f: ++ csv_data = f.read() ++ csv_data = unicode(csv_data, 'latin1').splitlines() ++ reader = csv.reader([tables.CSVTable.encode_for_csv(line + '\n') ++ for line in csv_data]) ++ next(reader) ++ ++ null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes)[0] ++ ++ totest['table'].append(["""\ ++.. csv-table:: bad encoding ++ :file: %s ++ :encoding: latin-1 ++ ++(7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.) ++""" % utf_16_csv, ++"""\ ++ ++ ++ ++ Error with CSV data in "csv-table" directive: ++ %s ++ ++ .. csv-table:: bad encoding ++ :file: %s ++ :encoding: latin-1 ++ ++ (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.) ++""" % (null_bytes_exception, utf_16_csv)]) ++ + + if __name__ == '__main__': + import unittest