Accepting request 1060567 from devel:languages:python
- Refactor pygments-2.14.patch to not use distutils. OBS-URL: https://build.opensuse.org/request/show/1060567 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-docutils?expand=0&rev=35
This commit is contained in:
commit
91c16ae9db
@ -2,9 +2,11 @@ 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.orig/test/test_parsers/test_rst/test_directives/test_code.py
|
||||||
+++ docutils-0.19/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
|
@@ -10,14 +10,20 @@ Test the 'code' directive in parsers/rst
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import __init__ # noqa: F401
|
import __init__ # noqa: F401
|
||||||
|
+from packaging.version import Version
|
||||||
from test_parsers import DocutilsTestSupport
|
from test_parsers import DocutilsTestSupport
|
||||||
-from docutils.utils.code_analyzer import with_pygments
|
-from docutils.utils.code_analyzer import with_pygments
|
||||||
+from docutils.utils.code_analyzer import with_pygments, pygments_version
|
+from docutils.utils.code_analyzer import with_pygments, pygments_version
|
||||||
@ -15,14 +17,14 @@ Index: docutils-0.19/test/test_parsers/test_rst/test_directives/test_code.py
|
|||||||
if not with_pygments:
|
if not with_pygments:
|
||||||
del(totest['code-parsing'])
|
del(totest['code-parsing'])
|
||||||
+ del(totest['code-parsing-2-14'])
|
+ del(totest['code-parsing-2-14'])
|
||||||
+ elif pygments_version >= '2.14.0':
|
+ elif pygments_version >= Version('2.14.0'):
|
||||||
+ del(totest['code-parsing'])
|
+ del(totest['code-parsing'])
|
||||||
+ else:
|
+ else:
|
||||||
+ del(totest['code-parsing-2-14'])
|
+ del(totest['code-parsing-2-14'])
|
||||||
s.generateTests(totest)
|
s.generateTests(totest)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
@@ -170,6 +175,165 @@ totest['code-parsing'] = [
|
@@ -170,6 +176,165 @@ totest['code-parsing'] = [
|
||||||
\n\
|
\n\
|
||||||
<inline classes="name builtin">
|
<inline classes="name builtin">
|
||||||
print
|
print
|
||||||
@ -192,9 +194,11 @@ Index: docutils-0.19/test/test_parsers/test_rst/test_directives/test_code_long.p
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- docutils-0.19.orig/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
|
+++ 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
|
@@ -10,15 +10,22 @@ Test the 'code' directive in body.py wit
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import __init__ # noqa: F401
|
import __init__ # noqa: F401
|
||||||
|
+from packaging.version import Version
|
||||||
from test_parsers import DocutilsTestSupport
|
from test_parsers import DocutilsTestSupport
|
||||||
-from docutils.utils.code_analyzer import with_pygments
|
-from docutils.utils.code_analyzer import with_pygments
|
||||||
+from docutils.utils.code_analyzer import with_pygments, pygments_version
|
+from docutils.utils.code_analyzer import with_pygments, pygments_version
|
||||||
@ -204,7 +208,7 @@ Index: docutils-0.19/test/test_parsers/test_rst/test_directives/test_code_long.p
|
|||||||
settings = {'syntax_highlight': 'long'}
|
settings = {'syntax_highlight': 'long'}
|
||||||
s = DocutilsTestSupport.ParserTestSuite(suite_settings=settings)
|
s = DocutilsTestSupport.ParserTestSuite(suite_settings=settings)
|
||||||
if with_pygments:
|
if with_pygments:
|
||||||
+ if pygments_version >= '2.14.0':
|
+ if pygments_version >= Version('2.14.0'):
|
||||||
+ del(totest['code-parsing-long'])
|
+ del(totest['code-parsing-long'])
|
||||||
+ else:
|
+ else:
|
||||||
+ del(totest['code-parsing-long-2-14'])
|
+ del(totest['code-parsing-long-2-14'])
|
||||||
@ -214,7 +218,7 @@ Index: docutils-0.19/test/test_parsers/test_rst/test_directives/test_code_long.p
|
|||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
@@ -73,6 +79,94 @@ totest['code-parsing-long'] = [
|
@@ -73,6 +80,94 @@ totest['code-parsing-long'] = [
|
||||||
\n\
|
\n\
|
||||||
<inline classes="name builtin">
|
<inline classes="name builtin">
|
||||||
print
|
print
|
||||||
@ -313,8 +317,11 @@ 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.orig/test/test_parsers/test_rst/test_directives/test_include.py
|
||||||
+++ docutils-0.19/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__':
|
@@ -10,9 +10,10 @@ Tests for misc.py "include" directive.
|
||||||
|
import os.path
|
||||||
|
if __name__ == '__main__':
|
||||||
import __init__ # noqa: F401
|
import __init__ # noqa: F401
|
||||||
|
+from packaging.version import Version
|
||||||
from test_parsers import DocutilsTestSupport
|
from test_parsers import DocutilsTestSupport
|
||||||
from docutils import parsers
|
from docutils import parsers
|
||||||
-from docutils.utils.code_analyzer import with_pygments
|
-from docutils.utils.code_analyzer import with_pygments
|
||||||
@ -322,19 +329,19 @@ Index: docutils-0.19/test/test_parsers/test_rst/test_directives/test_include.py
|
|||||||
|
|
||||||
# optional 3rd-party markdown parser
|
# optional 3rd-party markdown parser
|
||||||
md_parser_name = 'recommonmark'
|
md_parser_name = 'recommonmark'
|
||||||
@@ -27,6 +27,11 @@ def suite():
|
@@ -27,6 +28,11 @@ def suite():
|
||||||
# eventually skip optional parts:
|
# eventually skip optional parts:
|
||||||
if not with_pygments:
|
if not with_pygments:
|
||||||
del(totest['include-code'])
|
del(totest['include-code'])
|
||||||
+ del(totest['include-code-2-14'])
|
+ del(totest['include-code-2-14'])
|
||||||
+ elif pygments_version >= '2.14.0':
|
+ elif pygments_version >= Version('2.14.0'):
|
||||||
+ del(totest['include-code'])
|
+ del(totest['include-code'])
|
||||||
+ else:
|
+ else:
|
||||||
+ del(totest['include-code-2-14'])
|
+ del(totest['include-code-2-14'])
|
||||||
if not md_parser_class:
|
if not md_parser_class:
|
||||||
del(totest['include-markdown'])
|
del(totest['include-markdown'])
|
||||||
s.generateTests(totest)
|
s.generateTests(totest)
|
||||||
@@ -1191,6 +1196,313 @@ Including includes/include14.txt
|
@@ -1191,6 +1197,313 @@ Including includes/include14.txt
|
||||||
<inline classes="punctuation">
|
<inline classes="punctuation">
|
||||||
..
|
..
|
||||||
\n\
|
\n\
|
||||||
@ -656,11 +663,11 @@ Index: docutils-0.19/docutils/utils/code_analyzer.py
|
|||||||
from docutils import ApplicationError
|
from docutils import ApplicationError
|
||||||
try:
|
try:
|
||||||
import pygments
|
import pygments
|
||||||
+ from distutils.version import LooseVersion
|
+ from packaging.version import Version
|
||||||
from pygments.lexers import get_lexer_by_name
|
from pygments.lexers import get_lexer_by_name
|
||||||
from pygments.formatters.html import _get_ttype_class
|
from pygments.formatters.html import _get_ttype_class
|
||||||
with_pygments = True
|
with_pygments = True
|
||||||
+ pygments_version = LooseVersion(pygments.__version__)
|
+ pygments_version = Version(pygments.__version__)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
with_pygments = False
|
with_pygments = False
|
||||||
+ pygments_version = '0'
|
+ pygments_version = '0'
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jan 24 07:15:02 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Refactor pygments-2.14.patch to not use distutils.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Jan 10 15:42:55 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
Tue Jan 10 15:42:55 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
||||||
|
|
||||||
|
@ -45,11 +45,13 @@ Requires(post): update-alternatives
|
|||||||
Requires(postun):update-alternatives
|
Requires(postun):update-alternatives
|
||||||
Recommends: python-Pillow
|
Recommends: python-Pillow
|
||||||
Recommends: python-Pygments
|
Recommends: python-Pygments
|
||||||
|
Requires: python-packaging
|
||||||
Recommends: python-roman
|
Recommends: python-roman
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%if %{with test}
|
%if %{with test}
|
||||||
BuildRequires: %{python_module Pillow}
|
BuildRequires: %{python_module Pillow}
|
||||||
BuildRequires: %{python_module Pygments}
|
BuildRequires: %{python_module Pygments}
|
||||||
|
BuildRequires: %{python_module packaging}
|
||||||
BuildRequires: %{python_module roman}
|
BuildRequires: %{python_module roman}
|
||||||
%endif
|
%endif
|
||||||
%if "%{python_flavor}" == "python3" || "%{?python_provides}" == "python3"
|
%if "%{python_flavor}" == "python3" || "%{?python_provides}" == "python3"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user