From 8f5d120071e73be80449448d1625f85a17ec0209 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 7 Jun 2024 13:47:26 +0200 Subject: [PATCH 01/25] Bootstrap for Python 3.13 --- python-sphinx.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-sphinx.spec b/python-sphinx.spec index fd0c7e6..a3bf722 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -1,3 +1,5 @@ +%global _without_sphinxcontrib 1 +%global _without_tests 1 # When bootstrapping sphinx in Fedora, we don't yet have sphinxcontrib-* # Without the packages, we have warnings in docs, but it's not a hard dependency # We don't want to support sphinxcontrib-* in RHEL, hence disabling the dependencies From cc540171662858573bab59fcd6d396e95b0e5521 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Sun, 9 Jun 2024 16:49:43 +0200 Subject: [PATCH 02/25] Rebuilt for Python 3.13 --- python-sphinx.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/python-sphinx.spec b/python-sphinx.spec index a3bf722..fd0c7e6 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -1,5 +1,3 @@ -%global _without_sphinxcontrib 1 -%global _without_tests 1 # When bootstrapping sphinx in Fedora, we don't yet have sphinxcontrib-* # Without the packages, we have warnings in docs, but it's not a hard dependency # We don't want to support sphinxcontrib-* in RHEL, hence disabling the dependencies From fa05224c3931da7a4cbd5630ae336c5161720a3b Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Fri, 26 Apr 2024 10:19:02 +0200 Subject: [PATCH 03/25] Update to 7.3.7 Upstream dropped the dependency on filelock and html5lib, so the relevant conditionals in the specfile were removed. sphinx-test_theming.patch needed to be rebased, so it is now a proper git patch. The pytest --import-mode=importlib problem was fixed upstream. --- .gitignore | 1 + 11774.patch | 69 --------- 12362.patch | 37 +++++ 12373.patch | 145 ++++++++++++++++++ ...-the-first-party-extensions-optional.patch | 121 +++++++-------- python-sphinx.spec | 58 +++---- sources | 2 +- sphinx-test_theming.diff | 12 -- sphinx-test_theming.patch | 25 +++ 9 files changed, 288 insertions(+), 182 deletions(-) delete mode 100644 11774.patch create mode 100644 12362.patch create mode 100644 12373.patch delete mode 100644 sphinx-test_theming.diff create mode 100644 sphinx-test_theming.patch diff --git a/.gitignore b/.gitignore index fd204f3..816d1b8 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ /Sphinx-7.0.1.tar.gz /sphinx-7.1.2.tar.gz /sphinx-7.2.6.tar.gz +/sphinx-7.3.7.tar.gz diff --git a/11774.patch b/11774.patch deleted file mode 100644 index 47370b2..0000000 --- a/11774.patch +++ /dev/null @@ -1,69 +0,0 @@ -From bc8939b34037f81b8610f3b26caec128ee20a2f4 Mon Sep 17 00:00:00 2001 -From: Karolina Surma -Date: Tue, 28 Nov 2023 14:43:58 +0100 -Subject: [PATCH] Adjust the expected string to match Python 3.11+ changed - output - ---- - tests/test_ext_autodoc_configs.py | 21 +++++++++++++++++---- - 1 file changed, 17 insertions(+), 4 deletions(-) - -diff --git a/tests/test_ext_autodoc_configs.py b/tests/test_ext_autodoc_configs.py -index 45bc729b73e..0994c08e899 100644 ---- a/tests/test_ext_autodoc_configs.py -+++ b/tests/test_ext_autodoc_configs.py -@@ -11,6 +11,7 @@ - from .test_ext_autodoc import do_autodoc - - IS_PYPY = platform.python_implementation() == 'PyPy' -+IS_PY311_AND_LATER = sys.version_info >= (3, 11) - - - @contextmanager -@@ -1627,7 +1628,10 @@ def test_autodoc_default_options(app): - assert ' Iterate squares of each value.' in actual - if not IS_PYPY: - assert ' .. py:attribute:: CustomIter.__weakref__' in actual -- assert ' list of weak references to the object (if defined)' in actual -+ if IS_PY311_AND_LATER: -+ assert ' list of weak references to the object' in actual -+ else: -+ assert ' list of weak references to the object (if defined)' in actual - - # :exclude-members: None - has no effect. Unlike :members:, - # :special-members:, etc. where None == "include all", here None means -@@ -1651,7 +1655,10 @@ def test_autodoc_default_options(app): - assert ' Iterate squares of each value.' in actual - if not IS_PYPY: - assert ' .. py:attribute:: CustomIter.__weakref__' in actual -- assert ' list of weak references to the object (if defined)' in actual -+ if IS_PY311_AND_LATER: -+ assert ' list of weak references to the object' in actual -+ else: -+ assert ' list of weak references to the object (if defined)' in actual - assert ' .. py:method:: CustomIter.snafucate()' in actual - assert ' Makes this snafucated.' in actual - -@@ -1698,7 +1705,10 @@ def test_autodoc_default_options_with_values(app): - assert ' Iterate squares of each value.' in actual - if not IS_PYPY: - assert ' .. py:attribute:: CustomIter.__weakref__' not in actual -- assert ' list of weak references to the object (if defined)' not in actual -+ if IS_PY311_AND_LATER: -+ assert ' list of weak references to the object' not in actual -+ else: -+ assert ' list of weak references to the object (if defined)' not in actual - - # with :exclude-members: - app.config.autodoc_default_options = { -@@ -1722,6 +1732,9 @@ def test_autodoc_default_options_with_values(app): - assert ' Iterate squares of each value.' in actual - if not IS_PYPY: - assert ' .. py:attribute:: CustomIter.__weakref__' not in actual -- assert ' list of weak references to the object (if defined)' not in actual -+ if IS_PY311_AND_LATER: -+ assert ' list of weak references to the object' not in actual -+ else: -+ assert ' list of weak references to the object (if defined)' not in actual - assert ' .. py:method:: CustomIter.snafucate()' not in actual - assert ' Makes this snafucated.' not in actual diff --git a/12362.patch b/12362.patch new file mode 100644 index 0000000..d3ca3f7 --- /dev/null +++ b/12362.patch @@ -0,0 +1,37 @@ +From 12f63b3a0425841f2bdcda3f08e656453ea59297 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Wed, 8 May 2024 14:38:35 +0200 +Subject: [PATCH] Move `defusedxml` import into the function using it + +Import `defusedxml` inside the `etree_parse()` function rather than +in global scope of `sphinx.testing.util`. This makes it possible +for reverse dependencies (such as `breathe`) to use this module without +adding an unnecessary transitive dependency on `defusedxml` when it's +not actually used. + +See also issue #12339. +--- + sphinx/testing/util.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sphinx/testing/util.py b/sphinx/testing/util.py +index d1de8ea2b74..b2df709eea8 100644 +--- a/sphinx/testing/util.py ++++ b/sphinx/testing/util.py +@@ -11,7 +11,6 @@ + from types import MappingProxyType + from typing import TYPE_CHECKING + +-from defusedxml.ElementTree import parse as xml_parse + from docutils import nodes + from docutils.parsers.rst import directives, roles + +@@ -73,6 +72,8 @@ def assert_node(node: Node, cls: Any = None, xpath: str = "", **kwargs: Any) -> + # keep this to restrict the API usage and to have a correct return type + def etree_parse(path: str | os.PathLike[str]) -> ElementTree: + """Parse a file into a (safe) XML element tree.""" ++ from defusedxml.ElementTree import parse as xml_parse ++ + return xml_parse(path) + + diff --git a/12373.patch b/12373.patch new file mode 100644 index 0000000..2cb3c12 --- /dev/null +++ b/12373.patch @@ -0,0 +1,145 @@ +From 14da0bb6073a1ec60432340035d17948b3adb22a Mon Sep 17 00:00:00 2001 +From: Chris Sewell +Date: Wed, 15 May 2024 06:20:54 +0200 +Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Fix=20python=203.13=20tests?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + tests/test_extensions/test_ext_autodoc.py | 2 +- + .../test_ext_autodoc_configs.py | 31 +++++++++++++------ + 2 files changed, 22 insertions(+), 11 deletions(-) + +diff --git a/tests/test_extensions/test_ext_autodoc.py b/tests/test_extensions/test_ext_autodoc.py +index a88d111bdb3..5a2e91cb5e9 100644 +--- a/tests/test_extensions/test_ext_autodoc.py ++++ b/tests/test_extensions/test_ext_autodoc.py +@@ -838,7 +838,7 @@ def test_autodoc_special_members(app): + "special-members": None, + } + if sys.version_info >= (3, 13, 0, 'alpha', 5): +- options["exclude-members"] = "__static_attributes__" ++ options["exclude-members"] = "__static_attributes__,__firstlineno__" + actual = do_autodoc(app, 'class', 'target.Class', options) + assert list(filter(lambda l: '::' in l, actual)) == [ + '.. py:class:: Class(arg)', +diff --git a/tests/test_extensions/test_ext_autodoc_configs.py b/tests/test_extensions/test_ext_autodoc_configs.py +index 6c2af5a0652..1262b15162b 100644 +--- a/tests/test_extensions/test_ext_autodoc_configs.py ++++ b/tests/test_extensions/test_ext_autodoc_configs.py +@@ -679,6 +679,10 @@ def test_autodoc_typehints_signature(app): + type_o = "~typing.Any | None" + else: + type_o = "~typing.Any" ++ if sys.version_info[:2] >= (3, 13): ++ type_ppp = "pathlib._local.PurePosixPath" ++ else: ++ type_ppp = "pathlib.PurePosixPath" + + options = {"members": None, + "undoc-members": None} +@@ -703,7 +707,7 @@ def test_autodoc_typehints_signature(app): + '', + '.. py:data:: CONST3', + ' :module: target.typehints', +- ' :type: ~pathlib.PurePosixPath', ++ f' :type: ~{type_ppp}', + " :value: PurePosixPath('/a/b/c')", + '', + ' docstring', +@@ -726,7 +730,7 @@ def test_autodoc_typehints_signature(app): + '', + ' .. py:attribute:: Math.CONST3', + ' :module: target.typehints', +- ' :type: ~pathlib.PurePosixPath', ++ f' :type: ~{type_ppp}', + " :value: PurePosixPath('/a/b/c')", + '', + '', +@@ -748,7 +752,7 @@ def test_autodoc_typehints_signature(app): + '', + ' .. py:property:: Math.path', + ' :module: target.typehints', +- ' :type: ~pathlib.PurePosixPath', ++ f' :type: ~{type_ppp}', + '', + '', + ' .. py:property:: Math.prop', +@@ -773,7 +777,7 @@ def test_autodoc_typehints_signature(app): + '', + ' docstring', + '', +- " alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath`)", ++ f" alias of TypeVar('T', bound=\\ :py:class:`~{type_ppp}`)", + '', + '', + '.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, ' +@@ -802,6 +806,10 @@ def test_autodoc_typehints_signature(app): + @pytest.mark.sphinx('html', testroot='ext-autodoc', + confoverrides={'autodoc_typehints': "none"}) + def test_autodoc_typehints_none(app): ++ if sys.version_info[:2] >= (3, 13): ++ type_ppp = "pathlib._local.PurePosixPath" ++ else: ++ type_ppp = "pathlib.PurePosixPath" + options = {"members": None, + "undoc-members": None} + actual = do_autodoc(app, 'module', 'target.typehints', options) +@@ -887,7 +895,7 @@ def test_autodoc_typehints_none(app): + '', + ' docstring', + '', +- " alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath`)", ++ f" alias of TypeVar('T', bound=\\ :py:class:`~{type_ppp}`)", + '', + '', + '.. py:function:: complex_func(arg1, arg2, arg3=None, *args, **kwargs)', +@@ -1417,7 +1425,10 @@ def test_autodoc_typehints_format_fully_qualified(app): + type_o = "typing.Any | None" + else: + type_o = "typing.Any" +- ++ if sys.version_info[:2] >= (3, 13): ++ type_ppp = "pathlib._local.PurePosixPath" ++ else: ++ type_ppp = "pathlib.PurePosixPath" + options = {"members": None, + "undoc-members": None} + actual = do_autodoc(app, 'module', 'target.typehints', options) +@@ -1441,7 +1452,7 @@ def test_autodoc_typehints_format_fully_qualified(app): + '', + '.. py:data:: CONST3', + ' :module: target.typehints', +- ' :type: pathlib.PurePosixPath', ++ f' :type: {type_ppp}', + " :value: PurePosixPath('/a/b/c')", + '', + ' docstring', +@@ -1464,7 +1475,7 @@ def test_autodoc_typehints_format_fully_qualified(app): + '', + ' .. py:attribute:: Math.CONST3', + ' :module: target.typehints', +- ' :type: pathlib.PurePosixPath', ++ f' :type: {type_ppp}', + " :value: PurePosixPath('/a/b/c')", + '', + '', +@@ -1486,7 +1497,7 @@ def test_autodoc_typehints_format_fully_qualified(app): + '', + ' .. py:property:: Math.path', + ' :module: target.typehints', +- ' :type: pathlib.PurePosixPath', ++ f' :type: {type_ppp}', + '', + '', + ' .. py:property:: Math.prop', +@@ -1511,7 +1522,7 @@ def test_autodoc_typehints_format_fully_qualified(app): + '', + ' docstring', + '', +- " alias of TypeVar('T', bound=\\ :py:class:`pathlib.PurePosixPath`)", ++ f" alias of TypeVar('T', bound=\\ :py:class:`{type_ppp}`)", + '', + '', + '.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, ' diff --git a/Make-the-first-party-extensions-optional.patch b/Make-the-first-party-extensions-optional.patch index ad3985a..8cb1801 100644 --- a/Make-the-first-party-extensions-optional.patch +++ b/Make-the-first-party-extensions-optional.patch @@ -1,25 +1,25 @@ -From 9699465414515f0eba76d05069e755b5bcf34eef Mon Sep 17 00:00:00 2001 +From b74128966fe4edf77a0c3a7936f6a6216833c9ed Mon Sep 17 00:00:00 2001 From: Karolina Surma -Date: Mon, 15 Jan 2024 16:19:32 +0100 +Date: Thu, 25 Apr 2024 15:58:03 +0200 Subject: [PATCH] Make the first party extensions optional, add [extensions] extra Co-authored-by: Miro Hrončok --- - pyproject.toml | 33 +++++++++++++++++++++++++++------ - sphinx/application.py | 6 +++--- - sphinx/registry.py | 9 ++++++--- - sphinx/testing/fixtures.py | 6 ++++++ - tests/test_api_translator.py | 2 ++ - tests/test_build_html.py | 3 +++ - 6 files changed, 47 insertions(+), 12 deletions(-) + pyproject.toml | 33 ++++++++++++++++---- + sphinx/application.py | 6 ++-- + sphinx/registry.py | 9 ++++-- + sphinx/testing/fixtures.py | 7 +++++ + tests/test_builders/test_build_html_maths.py | 3 ++ + tests/test_writers/test_api_translator.py | 2 ++ + 6 files changed, 48 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml -index 8f93701..41c28c5 100644 +index 8aa49aa..10fa20e 100644 --- a/pyproject.toml +++ b/pyproject.toml -@@ -55,12 +55,6 @@ classifiers = [ +@@ -56,12 +56,6 @@ classifiers = [ "Topic :: Utilities", ] dependencies = [ @@ -31,8 +31,8 @@ index 8f93701..41c28c5 100644 - "sphinxcontrib-qthelp", "Jinja2>=3.0", "Pygments>=2.14", - "docutils>=0.18.1,<0.21", -@@ -76,8 +70,35 @@ dependencies = [ + "docutils>=0.18.1,<0.22", +@@ -78,8 +72,35 @@ dependencies = [ dynamic = ["version"] [project.optional-dependencies] @@ -69,10 +69,10 @@ index 8f93701..41c28c5 100644 lint = [ "flake8>=3.5.0", diff --git a/sphinx/application.py b/sphinx/application.py -index d5fbaa9..b030dab 100644 +index 7d16d9a..2a71074 100644 --- a/sphinx/application.py +++ b/sphinx/application.py -@@ -226,7 +226,7 @@ class Sphinx: +@@ -222,7 +222,7 @@ class Sphinx: # load all built-in extension modules, first-party extension modules, # and first-party themes for extension in builtin_extensions: @@ -81,7 +81,7 @@ index d5fbaa9..b030dab 100644 # load all user-given extension modules for extension in self.config.extensions: -@@ -395,7 +395,7 @@ class Sphinx: +@@ -391,7 +391,7 @@ class Sphinx: # ---- general extensibility interface ------------------------------------- @@ -90,7 +90,7 @@ index d5fbaa9..b030dab 100644 """Import and setup a Sphinx extension module. Load the extension given by the module *name*. Use this if your -@@ -403,7 +403,7 @@ class Sphinx: +@@ -399,7 +399,7 @@ class Sphinx: called twice. """ logger.debug('[app] setting up extension: %r', extname) @@ -100,10 +100,10 @@ index d5fbaa9..b030dab 100644 @staticmethod def require_sphinx(version: tuple[int, int] | str) -> None: diff --git a/sphinx/registry.py b/sphinx/registry.py -index 501661d..96d4554 100644 +index 7887858..ca95960 100644 --- a/sphinx/registry.py +++ b/sphinx/registry.py -@@ -430,7 +430,7 @@ class SphinxComponentRegistry: +@@ -436,7 +436,7 @@ class SphinxComponentRegistry: def add_html_theme(self, name: str, theme_path: str) -> None: self.html_themes[name] = theme_path @@ -112,7 +112,7 @@ index 501661d..96d4554 100644 """Load a Sphinx extension.""" if extname in app.extensions: # already loaded return -@@ -446,9 +446,12 @@ class SphinxComponentRegistry: +@@ -452,9 +452,12 @@ class SphinxComponentRegistry: try: mod = import_module(extname) except ImportError as err: @@ -125,24 +125,25 @@ index 501661d..96d4554 100644 - err) from err + raise ExtensionError(msg % extname, err) from err - setup = getattr(mod, 'setup', None) + setup: _ExtensionSetupFunc | None = getattr(mod, 'setup', None) if setup is None: diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py -index 0cc4882..f57f709 100644 +index 6e1a122..f3fe743 100644 --- a/sphinx/testing/fixtures.py +++ b/sphinx/testing/fixtures.py -@@ -22,6 +22,7 @@ DEFAULT_ENABLED_MARKERS = [ - 'sphinx(builder, testroot=None, freshenv=False, confoverrides=None, tags=None,' - ' docutilsconf=None, parallel=0): arguments to initialize the sphinx test application.' +@@ -31,6 +31,7 @@ DEFAULT_ENABLED_MARKERS = [ + 'keep_going=False, builddir=None, docutils_conf=None' + '): arguments to initialize the sphinx test application.' ), + 'sphinxcontrib(...): required sphinxcontrib.* extensions', 'test_params(shared_result=...): test parameters.', ] -@@ -67,6 +68,11 @@ def app_params(request: Any, test_params: dict, shared_result: SharedResult, +@@ -80,6 +81,12 @@ def app_params( + Parameters that are specified by 'pytest.mark.sphinx' for sphinx.application.Sphinx initialization """ - ++ + # ##### process pytest.mark.sphinxcontrib + for info in reversed(list(request.node.iter_markers("sphinxcontrib"))): + for arg in info.args: @@ -150,11 +151,39 @@ index 0cc4882..f57f709 100644 + # ##### process pytest.mark.sphinx - pargs = {} -diff --git a/tests/test_api_translator.py b/tests/test_api_translator.py + pargs: dict[int, Any] = {} +diff --git a/tests/test_builders/test_build_html_maths.py b/tests/test_builders/test_build_html_maths.py +index 900846b..664c86e 100644 +--- a/tests/test_builders/test_build_html_maths.py ++++ b/tests/test_builders/test_build_html_maths.py +@@ -20,6 +20,7 @@ def test_html_math_renderer_is_imgmath(app, status, warning): + assert app.builder.math_renderer_name == 'imgmath' + + ++@pytest.mark.sphinxcontrib('serializinghtml', 'jsmath') + @pytest.mark.sphinx('html', testroot='basic', + confoverrides={'extensions': ['sphinxcontrib.jsmath', + 'sphinx.ext.imgmath']}) +@@ -40,6 +41,7 @@ def test_html_math_renderer_is_duplicated2(app, status, warning): + assert app.builder.math_renderer_name == 'imgmath' # The another one is chosen + + ++@pytest.mark.sphinxcontrib('jsmath') + @pytest.mark.sphinx('html', testroot='basic', + confoverrides={'extensions': ['sphinxcontrib.jsmath', + 'sphinx.ext.imgmath'], +@@ -48,6 +50,7 @@ def test_html_math_renderer_is_chosen(app, status, warning): + assert app.builder.math_renderer_name == 'imgmath' + + ++@pytest.mark.sphinxcontrib('jsmath') + @pytest.mark.sphinx('html', testroot='basic', + confoverrides={'extensions': ['sphinxcontrib.jsmath', + 'sphinx.ext.mathjax'], +diff --git a/tests/test_writers/test_api_translator.py b/tests/test_writers/test_api_translator.py index 9f2bd44..81575b7 100644 ---- a/tests/test_api_translator.py -+++ b/tests/test_api_translator.py +--- a/tests/test_writers/test_api_translator.py ++++ b/tests/test_writers/test_api_translator.py @@ -36,6 +36,7 @@ def test_singlehtml_set_translator_for_singlehtml(app, status, warning): assert translator_class.__name__ == 'ConfSingleHTMLTranslator' @@ -171,34 +200,6 @@ index 9f2bd44..81575b7 100644 @pytest.mark.sphinx('json', testroot='api-set-translator') def test_json_set_translator_for_json(app, status, warning): translator_class = app.builder.get_translator_class() -diff --git a/tests/test_build_html.py b/tests/test_build_html.py -index 07f101d..c512a33 100644 ---- a/tests/test_build_html.py -+++ b/tests/test_build_html.py -@@ -1544,6 +1544,7 @@ def test_html_math_renderer_is_imgmath(app, status, warning): - assert app.builder.math_renderer_name == 'imgmath' - - -+@pytest.mark.sphinxcontrib('serializinghtml', 'jsmath') - @pytest.mark.sphinx('html', testroot='basic', - confoverrides={'extensions': ['sphinxcontrib.jsmath', - 'sphinx.ext.imgmath']}) -@@ -1564,6 +1565,7 @@ def test_html_math_renderer_is_duplicated2(app, status, warning): - assert app.builder.math_renderer_name == 'imgmath' # The another one is chosen - - -+@pytest.mark.sphinxcontrib('jsmath') - @pytest.mark.sphinx('html', testroot='basic', - confoverrides={'extensions': ['sphinxcontrib.jsmath', - 'sphinx.ext.imgmath'], -@@ -1572,6 +1574,7 @@ def test_html_math_renderer_is_chosen(app, status, warning): - assert app.builder.math_renderer_name == 'imgmath' - - -+@pytest.mark.sphinxcontrib('jsmath') - @pytest.mark.sphinx('html', testroot='basic', - confoverrides={'extensions': ['sphinxcontrib.jsmath', - 'sphinx.ext.mathjax'], -- -2.43.0 +2.44.0 diff --git a/python-sphinx.spec b/python-sphinx.spec index fd0c7e6..c47b340 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -14,14 +14,12 @@ # Build without BuildRequires ImageMagick, to skip imgconverter tests %bcond imagemagick_tests %{undefined rhel} -# Same for filelock -- we don't want it in RHEL just to run a handful of tests here -%bcond filelock_tests %{undefined rhel} # During texlive updates, sometimes the latex environment is unstable %bcond latex_tests 1 Name: python-sphinx -%global general_version 7.2.6 +%global general_version 7.3.7 #global prerel ... %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} @@ -38,7 +36,7 @@ Source: %{pypi_source sphinx %{upstream_version}} # Allow extra themes to exist. We pull in python3-sphinx-theme-alabaster # which causes that test to fail. -Patch: sphinx-test_theming.diff +Patch: sphinx-test_theming.patch # Make the first party extensions optional # This removes the runtime dependencies on: @@ -56,9 +54,11 @@ Patch: sphinx-test_theming.diff # https://github.com/sphinx-doc/sphinx/pull/11747 Patch: Make-the-first-party-extensions-optional.patch -# Fix the expected test docstring to match output in Python 3.11.7, 3.12.1 and later -# Proposed upstream. -Patch: https://github.com/sphinx-doc/sphinx/pull/11774.patch +# Fix tests with Python 3.13+ +Patch: https://github.com/sphinx-doc/sphinx/pull/12373.patch + +# Lazily import defusedxml only when necessary +Patch: https://github.com/sphinx-doc/sphinx/pull/12362.patch BuildArch: noarch @@ -265,26 +265,9 @@ This package contains documentation in the HTML format. %autosetup -n sphinx-%{upstream_version} -p1 %if %{without imagemagick_tests} -rm tests/test_ext_imgconverter.py +rm tests/test_extensions/test_ext_imgconverter.py %endif -%if %{without filelock_tests} -sed -i '/filelock/d' pyproject.toml -rm tests/test_build_linkcheck.py tests/test_ext_intersphinx.py -%endif - -%if %{defined rhel} -# unwanted dependency in RHEL, https://bugzilla.redhat.com/show_bug.cgi?id=1945182 -sed -i '/html5lib/d' pyproject.toml -%endif - -# Sphinx' tests import from each other, this feature is not supported by -# the 'importlib' import mode in pytest. Upstream mitigates this by invoking -# `python -m pytest` rather than `pytest` directly, but in the context of the -# RPM build we explicitly want to test the installed library rather than the -# one from PWD. -# https://github.com/sphinx-doc/sphinx/issues/11740 -sed -i '/"--import-mode=importlib",/d' pyproject.toml %generate_buildrequires %pyproject_buildrequires -r %{?with_tests:-x test} @@ -364,25 +347,20 @@ mkdir %{buildroot}%{python3_sitelib}/sphinxcontrib # Currently, all linkcheck tests and test_latex_images need internet # test_build_latex_doc needs internet to download pictures, # but fails also with it enabled, we decided to skip it entirely -# In RHEL builds, skip tests which use html5lib (excluded above) -%pytest \ -%if %{defined rhel} - --ignore tests/test_build_html.py \ - --ignore tests/test_build_latex.py \ - --ignore tests/test_build_texinfo.py \ - --ignore tests/test_domain_std.py \ - --ignore tests/test_smartquotes.py \ -%endif +# test_autodoc_type_aliases fails with Python 3.12.4, 3.13.0b3 +# skip temporarily until resolved: +# https://github.com/sphinx-doc/sphinx/issues/12430 +k="not test_autodoc_type_aliases" %if %{without internet} - -k "not linkcheck and not test_latex_images and not test_build_latex_doc" \ -%endif -; +k="${k} and not linkcheck and not test_latex_images and not test_build_latex_doc" %endif +%pytest -k "${k}" +%endif %files -n python%{python3_pkgversion}-sphinx -f sphinx.lang -%license LICENSE -%doc AUTHORS CHANGES EXAMPLES README.rst +%license LICENSE.rst +%doc README.rst %{_bindir}/sphinx-* %{python3_sitelib}/sphinx/ %dir %{python3_sitelib}/sphinxcontrib/ @@ -398,7 +376,7 @@ mkdir %{buildroot}%{python3_sitelib}/sphinxcontrib %files doc -%license LICENSE +%license LICENSE.rst %doc html diff --git a/sources b/sources index aaab39a..861235a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (sphinx-7.2.6.tar.gz) = 9a42e38c3c54429cc008b58892297ade4ccdd67561ee671e42a1fae976955895bb5383d58cb66a4f9f7edd1cc50dc2d1f083efeef036eac9fffc205979d3ccbc +SHA512 (sphinx-7.3.7.tar.gz) = f450eaaa26a0989e9065174e23488a7f647221750238516c5d06d403540eb4277fd480f03857d24acb6b7335458ae4535ad1ad533eff6d3bbba5521d9a6deb14 diff --git a/sphinx-test_theming.diff b/sphinx-test_theming.diff deleted file mode 100644 index 30994a1..0000000 --- a/sphinx-test_theming.diff +++ /dev/null @@ -1,12 +0,0 @@ -diff -ru Sphinx-1.7.6/tests/test_theming.py Sphinx-1.7.6_patched/tests/test_theming.py ---- Sphinx-1.7.6/tests/test_theming.py 2018-07-16 11:24:40.000000000 +0200 -+++ Sphinx-1.7.6_patched/tests/test_theming.py 2018-07-20 15:17:35.049263077 +0200 -@@ -25,7 +25,7 @@ - themes.append('alabaster') - - # test Theme class API -- assert set(app.registry.html_themes.keys()) == set(themes) -+ assert set(app.registry.html_themes.keys()) >= set(themes) - assert app.registry.html_themes['test-theme'] == str(app.srcdir / 'test_theme' / 'test-theme') - assert app.registry.html_themes['ziptheme'] == str(app.srcdir / 'ziptheme.zip') - assert app.registry.html_themes['staticfiles'] == str(app.srcdir / 'test_theme' / 'staticfiles') diff --git a/sphinx-test_theming.patch b/sphinx-test_theming.patch new file mode 100644 index 0000000..c6515f7 --- /dev/null +++ b/sphinx-test_theming.patch @@ -0,0 +1,25 @@ +From 57433d8036ab1e88ad7d6c4c1a45e438f722e276 Mon Sep 17 00:00:00 2001 +From: Karolina Surma +Date: Thu, 25 Apr 2024 16:07:56 +0200 +Subject: [PATCH] Patch test_theming to accomodate for Fedora-added theme + +--- + tests/test_theming/test_theming.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_theming/test_theming.py b/tests/test_theming/test_theming.py +index 867f8a0..281bb45 100644 +--- a/tests/test_theming/test_theming.py ++++ b/tests/test_theming/test_theming.py +@@ -50,7 +50,7 @@ def test_theme_api(app, status, warning): + ] + + # test Theme class API +- assert set(app.registry.html_themes.keys()) == set(themes) ++ assert set(app.registry.html_themes.keys()) >= set(themes) + assert app.registry.html_themes['test-theme'] == str( + app.srcdir / 'test_theme' / 'test-theme' + ) +-- +2.44.0 + From 379ab359f3708b91c973ef4c6cf327be48dea881 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 19 Jul 2024 15:58:53 +0000 Subject: [PATCH 04/25] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From f1121b8bac0728fb98978c1ee298e9ef859faaaa Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Thu, 22 Aug 2024 11:20:13 +0200 Subject: [PATCH 05/25] Add a smoke test --- .fmf/version | 1 + plan.fmf | 5 +++++ tests/smoke/main.fmf | 9 +++++++++ tests/smoke/source/conf.py | 5 +++++ tests/smoke/source/index.rst | 15 +++++++++++++++ 5 files changed, 35 insertions(+) create mode 100644 .fmf/version create mode 100644 plan.fmf create mode 100644 tests/smoke/main.fmf create mode 100644 tests/smoke/source/conf.py create mode 100644 tests/smoke/source/index.rst diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plan.fmf b/plan.fmf new file mode 100644 index 0000000..94cb32d --- /dev/null +++ b/plan.fmf @@ -0,0 +1,5 @@ +discover: + how: fmf +execute: + how: tmt + diff --git a/tests/smoke/main.fmf b/tests/smoke/main.fmf new file mode 100644 index 0000000..80e8276 --- /dev/null +++ b/tests/smoke/main.fmf @@ -0,0 +1,9 @@ +summary: run the basic documentation build +test: | + sphinx-build -M html source/ build/ && + grep '
' build/html/index.html && + grep '

Test docfile' build/html/index.html && + rm -rf build/ +require: + - python3-sphinx + - python3-sphinx-theme-alabaster diff --git a/tests/smoke/source/conf.py b/tests/smoke/source/conf.py new file mode 100644 index 0000000..3c43798 --- /dev/null +++ b/tests/smoke/source/conf.py @@ -0,0 +1,5 @@ +project = 'Test' +copyright = '2024, Test' +author = 'Test' +release = '0.3.0' +html_theme = 'alabaster' diff --git a/tests/smoke/source/index.rst b/tests/smoke/source/index.rst new file mode 100644 index 0000000..4d6fdff --- /dev/null +++ b/tests/smoke/source/index.rst @@ -0,0 +1,15 @@ +Test docfile +============ + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` From 383e230ab05de6c779bbae50f70fc5c2fcc4e69e Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Fri, 20 Sep 2024 16:10:35 +0200 Subject: [PATCH 06/25] Tests sphinx extensions with the package Tested extensions: - python-sphinx-theme-alabaster - python-sphinx_rtd_theme - python-sphinxcontrib-jquery The tested extensions are the one that we pull to CentOS Stream/RHEL. --- tests/include-sphinxcontrib-jquery/main.fmf | 11 +++++++++++ tests/include-sphinxcontrib-jquery/source/conf.py | 7 +++++++ .../source/index.rst | 0 tests/{smoke => smoke-alabaster}/main.fmf | 1 + tests/{smoke => smoke-alabaster}/source/conf.py | 0 tests/smoke-alabaster/source/index.rst | 15 +++++++++++++++ tests/smoke-rtd-theme/main.fmf | 11 +++++++++++ tests/smoke-rtd-theme/source/conf.py | 8 ++++++++ tests/smoke-rtd-theme/source/index.rst | 15 +++++++++++++++ 9 files changed, 68 insertions(+) create mode 100644 tests/include-sphinxcontrib-jquery/main.fmf create mode 100644 tests/include-sphinxcontrib-jquery/source/conf.py rename tests/{smoke => include-sphinxcontrib-jquery}/source/index.rst (100%) rename tests/{smoke => smoke-alabaster}/main.fmf (83%) rename tests/{smoke => smoke-alabaster}/source/conf.py (100%) create mode 100644 tests/smoke-alabaster/source/index.rst create mode 100644 tests/smoke-rtd-theme/main.fmf create mode 100644 tests/smoke-rtd-theme/source/conf.py create mode 100644 tests/smoke-rtd-theme/source/index.rst diff --git a/tests/include-sphinxcontrib-jquery/main.fmf b/tests/include-sphinxcontrib-jquery/main.fmf new file mode 100644 index 0000000..e447827 --- /dev/null +++ b/tests/include-sphinxcontrib-jquery/main.fmf @@ -0,0 +1,11 @@ +summary: run the basic documentation build +test: | + sphinx-build -M html source/ build/ && + grep '