From 99e4b3adf3ef565a07feea7db43bab4a27d4bb97cae5223e2120715c7f417921 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Tue, 10 Jan 2023 16:45:29 +0000 Subject: [PATCH] - Delete sphix-6.0.0.patch - Add pygments-2.14.patch - The patch is related to pygments not Sphinx and the patch is updated to make it conditional so it work with older versions of pygments, shp#docutils#201 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-docutils?expand=0&rev=79 --- pygments-2.14.patch | 669 ++++++++++++++++++++++++++++++++++++++++ python-docutils.changes | 8 + python-docutils.spec | 4 +- sphinx-6.0.0.patch | 188 ----------- 4 files changed, 679 insertions(+), 190 deletions(-) create mode 100644 pygments-2.14.patch delete mode 100644 sphinx-6.0.0.patch diff --git a/pygments-2.14.patch b/pygments-2.14.patch new file mode 100644 index 0000000..551304e --- /dev/null +++ b/pygments-2.14.patch @@ -0,0 +1,669 @@ +Index: docutils-0.19/test/test_parsers/test_rst/test_directives/test_code.py +=================================================================== +--- docutils-0.19.orig/test/test_parsers/test_rst/test_directives/test_code.py ++++ docutils-0.19/test/test_parsers/test_rst/test_directives/test_code.py +@@ -11,13 +11,18 @@ Test the 'code' directive in parsers/rst + if __name__ == '__main__': + import __init__ # noqa: F401 + from test_parsers import DocutilsTestSupport +-from docutils.utils.code_analyzer import with_pygments ++from docutils.utils.code_analyzer import with_pygments, pygments_version + + + def suite(): + s = DocutilsTestSupport.ParserTestSuite() + if not with_pygments: + del(totest['code-parsing']) ++ del(totest['code-parsing-2-14']) ++ elif pygments_version >= '2.14.0': ++ del(totest['code-parsing']) ++ else: ++ del(totest['code-parsing-2-14']) + s.generateTests(totest) + return s + +@@ -170,6 +175,165 @@ totest['code-parsing'] = [ + \n\ + + print ++ ++ ( ++ ++ 8 ++ ++ / ++ ++ 2 ++ ++ ) ++"""], ++["""\ ++.. code:: latex ++ :class: testclass ++ ++ hello \\emph{world} % emphasize ++""", ++"""\ ++ ++ ++ hello \n\ ++ ++ \\emph ++ ++ { ++ world ++ ++ } ++ \n\ ++ ++ % emphasize"""], ++["""\ ++.. code:: rst ++ :number-lines: ++ ++ This is a code block with text. ++""", ++"""\ ++ ++ ++ ++ 1 \n\ ++ This is a code block with text. ++"""], ++["""\ ++Code not parsed but warning silenced in ParserTestCase. ++ ++.. code:: s-lang ++ ++ % abc.sl ++ autoload("abc_mode", "abc"); ++""", ++"""\ ++ ++ ++ Code not parsed but warning silenced in ParserTestCase. ++ ++ % abc.sl ++ autoload("abc_mode", "abc"); ++"""], ++["""\ ++Place the language name in a class argument to avoid the no-lexer warning: ++ ++.. code:: ++ :class: s-lang ++ ++ % abc.sl ++ autoload("abc_mode", "abc"); ++""", ++"""\ ++ ++ ++ Place the language name in a class argument to avoid the no-lexer warning: ++ ++ % abc.sl ++ autoload("abc_mode", "abc"); ++"""], ++] ++ ++totest['code-parsing-2-14'] = [ ++["""\ ++.. code:: python3 ++ :class: testclass ++ ++ print('hello world') # to stdout ++""", ++"""\ ++ ++ ++ \n\ ++ ++ print ++ ++ ( ++ ++ 'hello world' ++ ++ ) ++ \n\ ++ ++ # to stdout ++"""], ++["""\ ++.. code:: python3 ++ :class: testclass ++ :name: my_function ++ :number-lines: 7 ++ ++ def my_function(): ++ '''Test the lexer. ++ ''' ++ ++ # and now for something completely different ++ print(8/2) ++""", ++"""\ ++ ++ ++ ++ 7 \n\ ++ ++ def ++ \n\ ++ ++ my_function ++ ++ (): ++ ++ \n\ ++ ++ 8 \n\ ++ ++ \n\ ++ ++ \'\'\'Test the lexer. ++ ++ 9 \n\ ++ ++ \'\'\' ++ ++ \n\ ++ ++ 10 \n\ ++ ++ \n\ ++ ++ 11 \n\ ++ ++ \n\ ++ ++ # and now for something completely different ++ ++ \n\ ++ ++ 12 \n\ ++ ++ \n\ ++ ++ print + + ( + +Index: docutils-0.19/test/test_parsers/test_rst/test_directives/test_code_long.py +=================================================================== +--- docutils-0.19.orig/test/test_parsers/test_rst/test_directives/test_code_long.py ++++ docutils-0.19/test/test_parsers/test_rst/test_directives/test_code_long.py +@@ -11,14 +11,20 @@ Test the 'code' directive in body.py wit + if __name__ == '__main__': + import __init__ # noqa: F401 + from test_parsers import DocutilsTestSupport +-from docutils.utils.code_analyzer import with_pygments ++from docutils.utils.code_analyzer import with_pygments, pygments_version + + + def suite(): + settings = {'syntax_highlight': 'long'} + s = DocutilsTestSupport.ParserTestSuite(suite_settings=settings) + if with_pygments: ++ if pygments_version >= '2.14.0': ++ del(totest['code-parsing-long']) ++ else: ++ del(totest['code-parsing-long-2-14']) ++ + s.generateTests(totest) ++ + return s + + +@@ -73,6 +79,94 @@ totest['code-parsing-long'] = [ + \n\ + + print ++ ++ ( ++ ++ 8 ++ ++ / ++ ++ 2 ++ ++ ) ++"""], ++["""\ ++.. code:: latex ++ ++ hello \\emph{world} % emphasize ++""", ++"""\ ++ ++ ++ hello \n\ ++ ++ \\emph ++ ++ { ++ world ++ ++ } ++ \n\ ++ ++ % emphasize"""], ++] ++ ++totest['code-parsing-long-2-14'] = [ ++["""\ ++.. code:: python3 ++ :number-lines: 7 ++ ++ def my_function(): ++ '''Test the lexer. ++ ''' ++ ++ # and now for something completely different ++ print(8/2) ++""", ++"""\ ++ ++ ++ ++ 7 \n\ ++ ++ def ++ \n\ ++ ++ my_function ++ ++ (): ++ ++ \n\ ++ ++ 8 \n\ ++ ++ \n\ ++ ++ \'\'\'Test the lexer. ++ ++ 9 \n\ ++ ++ \'\'\' ++ ++ \n\ ++ ++ 10 \n\ ++ ++ \n\ ++ ++ 11 \n\ ++ ++ \n\ ++ ++ # and now for something completely different ++ ++ \n\ ++ ++ 12 \n\ ++ ++ \n\ ++ ++ print + + ( + +Index: docutils-0.19/test/test_parsers/test_rst/test_directives/test_include.py +=================================================================== +--- docutils-0.19.orig/test/test_parsers/test_rst/test_directives/test_include.py ++++ docutils-0.19/test/test_parsers/test_rst/test_directives/test_include.py +@@ -12,7 +12,7 @@ if __name__ == '__main__': + import __init__ # noqa: F401 + from test_parsers import DocutilsTestSupport + from docutils import parsers +-from docutils.utils.code_analyzer import with_pygments ++from docutils.utils.code_analyzer import with_pygments, pygments_version + + # optional 3rd-party markdown parser + md_parser_name = 'recommonmark' +@@ -27,6 +27,11 @@ def suite(): + # eventually skip optional parts: + if not with_pygments: + del(totest['include-code']) ++ del(totest['include-code-2-14']) ++ elif pygments_version >= '2.14.0': ++ del(totest['include-code']) ++ else: ++ del(totest['include-code-2-14']) + if not md_parser_class: + del(totest['include-markdown']) + s.generateTests(totest) +@@ -1191,6 +1196,313 @@ Including includes/include14.txt + + .. + \n\ ++ ++ include ++ ++ :: ++ ../sibling/include7.txt ++""" % reldir(include6)], ++["""\ ++Circular inclusion ++ ++.. include:: %s ++""" % include15, ++"""\ ++ ++ ++ Circular inclusion ++ ++ File "include15.txt": example of rekursive inclusion. ++ ++ File "include16.txt": example of rekursive inclusion. ++ ++ ++ circular inclusion in "include" directive: ++ %s ++ > %s ++ > %s ++ > test data ++ ++ .. include:: include15.txt ++ ++ No loop when clipping before the "include" directive: ++ ++ File "include15.txt": example of rekursive inclusion. ++""" % (reldir(include16), reldir(include15), ++ reldir(include16), reldir(include15))], ++["""\ ++Circular inclusion with clipping. ++ ++.. include:: %s ++ :start-line: 2 ++""" % include16, ++"""\ ++ ++ ++ Circular inclusion with clipping. ++ ++ File "include15.txt": example of rekursive inclusion. ++ ++ File "include16.txt": example of rekursive inclusion. ++ ++ ++ circular inclusion in "include" directive: ++ %s ++ > %s ++ > %s ++ > %s ++ > test data ++ ++ .. include:: include15.txt ++ ++ No loop when clipping before the "include" directive: ++ ++ File "include15.txt": example of rekursive inclusion. ++ ++ No loop when clipping before the "include" directive: ++ ++ File "include15.txt": example of rekursive inclusion. ++""" % (reldir(include16), reldir(include15), reldir(include16), ++ reldir(include15), reldir(include16))], ++["""\ ++Circular inclusion with specified parser. ++ ++.. include:: %s ++ :parser: rst ++""" % include15, ++"""\ ++ ++ ++ Circular inclusion with specified parser. ++ ++ File "include15.txt": example of rekursive inclusion. ++ ++ File "include16.txt": example of rekursive inclusion. ++ ++ ++ circular inclusion in "include" directive: ++ %s ++ > %s ++ > %s ++ > test data ++ ++ .. include:: include15.txt ++ ++ No loop when clipping before the "include" directive: ++ ++ File "include15.txt": example of rekursive inclusion. ++""" % (reldir(include16), reldir(include15), ++ reldir(include16), reldir(include15))], ++["""\ ++No circular inclusion. ++ ++============================= ============================= ++.. include:: data/include.txt .. include:: data/include.txt ++============================= ============================= ++""", ++"""\ ++ ++ ++ No circular inclusion. ++ ++ ++ ++ ++ ++ ++ ++ ++ Some include text. ++ ++ ++ Some include text."""], ++] ++ ++totest['include-code-2-14'] = [ ++["""\ ++Included code ++ ++.. include:: %s ++ :code: rst ++""" % include1, ++"""\ ++ ++ ++ Included code ++ ++ ++ Inclusion 1 ++ \n\ ++ ++ ----------- ++ \n\ ++ ++ \n\ ++ This file is used by \n\ ++ ++ ``test_include.py`` ++ . ++""" % reldir(include1)], ++["""\ ++Included code ++ ++.. include:: %s ++ :code: rst ++ :number-lines: ++""" % include1, ++"""\ ++ ++ ++ Included code ++ ++ ++ 1 \n\ ++ ++ Inclusion 1 ++ \n\ ++ ++ 2 \n\ ++ ++ ----------- ++ \n\ ++ ++ 3 \n\ ++ ++ \n\ ++ ++ 4 \n\ ++ ++ This file is used by \n\ ++ ++ ``test_include.py`` ++ . ++""" % reldir(include1)], ++["""\ ++TAB expansion with included code: ++ ++.. include:: %s ++ :code: rst ++""" % include_literal, ++"""\ ++ ++ ++ TAB expansion with included code: ++ ++ Literal included this should \n\ ++ ++ **not** ++ be \n\ ++ ++ *marked* ++ \n\ ++ ++ `up` ++ . ++ ++ \n\ ++ <- leading raw tab. ++ ++ \n\ ++ \n\ ++ Newlines ++ ++ \n\ ++ are ++ ++ \n\ ++ normalized. ++""" % include_literal], ++["""\ ++Custom TAB expansion with included code: ++ ++.. include:: %s ++ :code: rst ++ :tab-width: 2 ++""" % include_literal, ++"""\ ++ ++ ++ Custom TAB expansion with included code: ++ ++ Literal included this should \n\ ++ ++ **not** ++ be \n\ ++ ++ *marked* ++ \n\ ++ ++ `up` ++ . ++ ++ \n\ ++ <- leading raw tab. ++ ++ \n\ ++ \n\ ++ Newlines ++ ++ \n\ ++ are ++ ++ \n\ ++ normalized. ++""" % include_literal], ++["""\ ++Custom TAB expansion with included code: ++ ++.. include:: %s ++ :code: rst ++ :tab-width: -1 ++""" % include_literal, ++"""\ ++ ++ ++ Custom TAB expansion with included code: ++ ++ Literal included this should \n\ ++ ++ **not** ++ be \n\ ++ ++ *marked* ++ \n\ ++ ++ `up` ++ . ++ ++ \n\ ++ \t<- leading raw tab. ++ ++ \n\ ++ \n\ ++ Newlines ++ ++ \n\ ++ are ++ ++ \n\ ++ normalized. ++""" % include_literal], ++["""\ ++Including includes/include14.txt ++ ++.. include:: %s ++""" % include14, ++"""\ ++ ++ ++ Including includes/include14.txt ++ ++ Including more/include6.txt as rst-code from includes/include14.txt: ++ ++ In includes/more/include6.txt ++ ++ \n\ ++ \n\ ++ ++ .. ++ \n\ + + include + +Index: docutils-0.19/docutils/utils/code_analyzer.py +=================================================================== +--- docutils-0.19.orig/docutils/utils/code_analyzer.py ++++ docutils-0.19/docutils/utils/code_analyzer.py +@@ -9,11 +9,14 @@ + from docutils import ApplicationError + try: + import pygments ++ from distutils.version import LooseVersion + from pygments.lexers import get_lexer_by_name + from pygments.formatters.html import _get_ttype_class + with_pygments = True ++ pygments_version = LooseVersion(pygments.__version__) + except ImportError: + with_pygments = False ++ pygments_version = '0' + + # Filter the following token types from the list of class arguments: + unstyled_tokens = ['token', # Token (base token type) diff --git a/python-docutils.changes b/python-docutils.changes index 4a2ec2d..6f35b3f 100644 --- a/python-docutils.changes +++ b/python-docutils.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Jan 10 15:42:55 UTC 2023 - Daniel Garcia + +- Delete sphix-6.0.0.patch +- Add pygments-2.14.patch +- The patch is related to pygments not Sphinx and the patch is updated to make + it conditional so it work with older versions of pygments, shp#docutils#201 + ------------------------------------------------------------------- Wed Jan 4 13:09:13 UTC 2023 - Daniel Garcia diff --git a/python-docutils.spec b/python-docutils.spec index a83b73d..83266b9 100644 --- a/python-docutils.spec +++ b/python-docutils.spec @@ -32,8 +32,8 @@ License: BSD-2-Clause AND Python-2.0 AND GPL-2.0-or-later AND GPL-3.0-or- URL: https://pypi.python.org/pypi/docutils/ Source: https://files.pythonhosted.org/packages/source/d/docutils/docutils-%{version}.tar.gz Source99: python-docutils-rpmlintrc -# PATCH-FIX-OPENSUSE sphinx-6.0.0.patch -Patch0: sphinx-6.0.0.patch +# PATCH-FIX-OPENSUSE pygments-2.14.patch shp#docutils#201 +Patch0: pygments-2.14.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module wheel} diff --git a/sphinx-6.0.0.patch b/sphinx-6.0.0.patch deleted file mode 100644 index 5e4a89f..0000000 --- a/sphinx-6.0.0.patch +++ /dev/null @@ -1,188 +0,0 @@ -Index: docutils-0.19/test/test_parsers/test_rst/test_directives/test_code.py -=================================================================== ---- docutils-0.19.orig/test/test_parsers/test_rst/test_directives/test_code.py -+++ docutils-0.19/test/test_parsers/test_rst/test_directives/test_code.py -@@ -145,28 +145,35 @@ totest['code-parsing'] = [ - my_function - - (): -- \n\ -+ -+ \n\ - - 8 \n\ -- \n\ -+ -+ \n\ - - \'\'\'Test the lexer. - - 9 \n\ - - \'\'\' -- \n\ -+ -+ \n\ - - 10 \n\ -- \n\ -+ -+ \n\ - - 11 \n\ -+ - \n\ - - # and now for something completely different -- \n\ -+ -+ \n\ - - 12 \n\ -+ - \n\ - - print -Index: docutils-0.19/test/test_parsers/test_rst/test_directives/test_code_long.py -=================================================================== ---- docutils-0.19.orig/test/test_parsers/test_rst/test_directives/test_code_long.py -+++ docutils-0.19/test/test_parsers/test_rst/test_directives/test_code_long.py -@@ -48,28 +48,35 @@ totest['code-parsing-long'] = [ - my_function - - (): -- \n\ -+ -+ \n\ - - 8 \n\ -- \n\ -+ -+ \n\ - - \'\'\'Test the lexer. - - 9 \n\ - - \'\'\' -- \n\ -+ -+ \n\ - - 10 \n\ -- \n\ -+ -+ \n\ - - 11 \n\ -+ - \n\ - - # and now for something completely different -- \n\ -+ -+ \n\ - - 12 \n\ -+ - \n\ - - print -Index: docutils-0.19/test/test_parsers/test_rst/test_directives/test_include.py -=================================================================== ---- docutils-0.19.orig/test/test_parsers/test_rst/test_directives/test_include.py -+++ docutils-0.19/test/test_parsers/test_rst/test_directives/test_include.py -@@ -1053,7 +1053,8 @@ Included code - - ----------- - \n\ -- \n\ -+ -+ \n\ - This file is used by \n\ - - ``test_include.py`` -@@ -1083,9 +1084,11 @@ Included code - \n\ - - 3 \n\ -- \n\ -+ -+ \n\ - - 4 \n\ -+ - This file is used by \n\ - - ``test_include.py`` -@@ -1112,10 +1115,18 @@ TAB expansion with included code: - - `up` - . -+ -+ \n\ - <- leading raw tab. -- \n\ -+ -+ \n\ -+ \n\ - Newlines -+ -+ \n\ - are -+ -+ \n\ - normalized. - """ % include_literal], - ["""\ -@@ -1140,10 +1151,18 @@ Custom TAB expansion with included code: - - `up` - . -+ -+ \n\ - <- leading raw tab. -- \n\ -+ -+ \n\ -+ \n\ - Newlines -+ -+ \n\ - are -+ -+ \n\ - normalized. - """ % include_literal], - ["""\ -@@ -1168,10 +1187,18 @@ Custom TAB expansion with included code: - - `up` - . -+ -+ \n\ - \t<- leading raw tab. -- \n\ -+ -+ \n\ -+ \n\ - Newlines -+ -+ \n\ - are -+ -+ \n\ - normalized. - """ % include_literal], - ["""\ -@@ -1187,7 +1214,9 @@ Including includes/include14.txt - Including more/include6.txt as rst-code from includes/include14.txt: - - In includes/more/include6.txt -- \n\ -+ -+ \n\ -+ \n\ - - .. - \n\