diff --git a/13610.patch b/13610.patch new file mode 100644 index 0000000..7cebb25 --- /dev/null +++ b/13610.patch @@ -0,0 +1,49 @@ +From 69998bdf8848614eb52ddd80923ffde7af64c0a8 Mon Sep 17 00:00:00 2001 +From: James Addison +Date: Mon, 2 Jun 2025 21:55:15 +0100 +Subject: [PATCH] tests: update LaTeX label test expectations from docutils + r10151 + +--- + tests/test_builders/test_build_latex.py | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/tests/test_builders/test_build_latex.py b/tests/test_builders/test_build_latex.py +index 0d1c607462d..37e708a021e 100644 +--- a/tests/test_builders/test_build_latex.py ++++ b/tests/test_builders/test_build_latex.py +@@ -12,6 +12,7 @@ + from subprocess import CalledProcessError + from typing import TYPE_CHECKING + ++import docutils + import pygments + import pytest + +@@ -1959,10 +1960,16 @@ def test_latex_labels(app: SphinxTestApp) -> None: + + result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8') + ++ # ref: docutils r10151 ++ if docutils.__version_info__[:2] < (0, 22): ++ figure_id, table_id = 'id1', 'id2' ++ else: ++ figure_id, table_id = 'id2', 'id3' ++ + # figures + assert ( + r'\caption{labeled figure}' +- r'\label{\detokenize{index:id1}}' ++ r'\label{\detokenize{index:' + figure_id + '}}' + r'\label{\detokenize{index:figure2}}' + r'\label{\detokenize{index:figure1}}' + r'\end{figure}' +@@ -1988,7 +1995,7 @@ def test_latex_labels(app: SphinxTestApp) -> None: + # tables + assert ( + r'\sphinxcaption{table caption}' +- r'\label{\detokenize{index:id2}}' ++ r'\label{\detokenize{index:' + table_id + '}}' + r'\label{\detokenize{index:table2}}' + r'\label{\detokenize{index:table1}}' + ) in result diff --git a/13883.patch b/13883.patch new file mode 100644 index 0000000..480de01 --- /dev/null +++ b/13883.patch @@ -0,0 +1,30 @@ +From 4d842a2c4909fe360172826a46eb88b442f44858 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?G=C3=BCnter=20Milde?= +Date: Tue, 9 Sep 2025 16:17:15 +0200 +Subject: [PATCH] Fix test setup for directive tests. + +Set the "parent" attribute of RSTState instances to the `document` +instead of None. The attribute holds the state machines "current node" +which is initialized to the `document` in `RSTStateMachine.run()` and +required since Docutils 0.22.1 in `RSTState.nested_parse()` to correctly +support sections in nested parsing. +--- + tests/test_util/test_util_docutils_sphinx_directive.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_util/test_util_docutils_sphinx_directive.py b/tests/test_util/test_util_docutils_sphinx_directive.py +index ecfcab0..7a26e96 100644 +--- a/tests/test_util/test_util_docutils_sphinx_directive.py ++++ b/tests/test_util/test_util_docutils_sphinx_directive.py +@@ -38,7 +38,7 @@ def make_directive_and_state( + inliner = Inliner() + inliner.init_customizations(state.document.settings) + state.inliner = inliner +- state.parent = None ++ state.parent = state.document + state.memo = SimpleNamespace( + document=state.document, + language=english, +-- +2.51.1 + diff --git a/python-sphinx.spec b/python-sphinx.spec index 9572f51..ed77d83 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -61,6 +61,9 @@ Patch: Make-the-first-party-extensions-optional.patch Patch: https://github.com/sphinx-doc/sphinx/commit/8962398b761c3d85a.patch Patch: https://github.com/sphinx-doc/sphinx/commit/e01e42f5fc738815b.patch Patch: https://github.com/sphinx-doc/sphinx/pull/13527.patch +# Compatibility with docutils 0.22+ +Patch: https://github.com/sphinx-doc/sphinx/pull/13610.patch +Patch: https://github.com/sphinx-doc/sphinx/pull/13883.patch BuildArch: noarch @@ -361,6 +364,9 @@ This package contains documentation in the HTML format. sed -i -e '/pytest-xdist/d' pyproject.toml %endif +# Support for docutils 0.22+ +sed -i -e 's/docutils>=0.20,<0.22/docutils>=0.20,<0.23/' pyproject.toml + # Drop test-dependency on defusedxml, # use xml from the standard library instead. # defusedxml is safer but this is only used in tests.