From bd77693107866b2f71b2f307adf5bc38eae9bf4e Mon Sep 17 00:00:00 2001 From: Dennis van Raaij Date: Tue, 14 Oct 2025 23:09:09 +0200 Subject: [PATCH 1/6] Recommend package make --- python-sphinx.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/python-sphinx.spec b/python-sphinx.spec index 70eab04..472222c 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -157,6 +157,7 @@ Summary: Python documentation generator Recommends: graphviz Recommends: ImageMagick +Recommends: make # Upstream Requires those, but we have a patch to remove the dependency. # We keep them Recommended to preserve the default user experience. From 31b58a66668ea27097888aae766124bba6840ab2 Mon Sep 17 00:00:00 2001 From: Dennis van Raaij Date: Tue, 14 Oct 2025 23:09:41 +0200 Subject: [PATCH 2/6] Require package latexmk --- python-sphinx.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-sphinx.spec b/python-sphinx.spec index 472222c..bbd0cdc 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -92,6 +92,7 @@ BuildRequires: ImageMagick %if %{with latex_tests} BuildRequires: texlive-collection-fontsrecommended BuildRequires: texlive-collection-latex +BuildRequires: latexmk BuildRequires: texlive-dvipng BuildRequires: texlive-dvisvgm BuildRequires: tex(amsmath.sty) @@ -204,6 +205,7 @@ Summary: LaTeX builder dependencies for python%{python3_pkgversion}-sphinx Requires: python%{python3_pkgversion}-sphinx = %{epoch}:%{version}-%{release} Requires: texlive-collection-fontsrecommended Requires: texlive-collection-latex +Requires: latexmk Requires: texlive-dvipng Requires: texlive-dvisvgm Requires: tex(amsmath.sty) From 0009cf4a25c6cb7fb415c74cb1c53b9162f8838a Mon Sep 17 00:00:00 2001 From: Dennis van Raaij Date: Tue, 14 Oct 2025 23:10:00 +0200 Subject: [PATCH 3/6] Update the list of TeX packages required by Sphinx Commands used to find the dependencies: $ find ./sphinx -type f -and \( -name "*.sty" -or -name "*.tex*" \) \ | xargs sed -n -e "s#.*\(RequirePackage.*\}\)#\1#p" \ | sort | uniq $ find ./sphinx -type f -and \( -name "*.sty" -or -name "*.tex*" \) \ | xargs sed -n -e "s#.*\(IfFileExist.*\}\)#\1#p"\ | sort | uniq $ find ./sphinx -type f \ | xargs sed -n -e "s#.*\(usepackage.*\}\).*#\1#p" \ | sort | uniq --- python-sphinx.spec | 107 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 97 insertions(+), 10 deletions(-) diff --git a/python-sphinx.spec b/python-sphinx.spec index bbd0cdc..02b4750 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -92,34 +92,66 @@ BuildRequires: ImageMagick %if %{with latex_tests} BuildRequires: texlive-collection-fontsrecommended BuildRequires: texlive-collection-latex +BuildRequires: texlive-gnu-freefont BuildRequires: latexmk BuildRequires: texlive-dvipng BuildRequires: texlive-dvisvgm +BuildRequires: tex(article.cls) +BuildRequires: tex(utf8x.def) +# Other dependencies. +BuildRequires: tex(alltt.sty) +BuildRequires: tex(amsfonts.sty) BuildRequires: tex(amsmath.sty) +BuildRequires: tex(amssymb.sty) +BuildRequires: tex(amstext.sty) BuildRequires: tex(amsthm.sty) BuildRequires: tex(anyfontsize.sty) -BuildRequires: tex(article.cls) +BuildRequires: tex(atbegshi.sty) +BuildRequires: tex(babel.sty) +BuildRequires: tex(bm.sty) +BuildRequires: tex(booktabs.sty) BuildRequires: tex(capt-of.sty) BuildRequires: tex(cmap.sty) -BuildRequires: tex(color.sty) -BuildRequires: tex(ctablestack.sty) +BuildRequires: tex(colortbl.sty) +BuildRequires: tex(etoolbox.sty) BuildRequires: tex(fancyhdr.sty) BuildRequires: tex(fancyvrb.sty) +BuildRequires: tex(float.sty) BuildRequires: tex(fncychap.sty) +BuildRequires: tex(fontenc.sty) +BuildRequires: tex(fontspec.sty) BuildRequires: tex(framed.sty) -BuildRequires: tex(FreeSerif.otf) BuildRequires: tex(geometry.sty) +BuildRequires: tex(graphicx.sty) +BuildRequires: tex(hypcap.sty) BuildRequires: tex(hyperref.sty) +BuildRequires: tex(inputenc.sty) BuildRequires: tex(kvoptions.sty) +BuildRequires: tex(longtable.sty) +BuildRequires: tex(ltxcmds.sty) BuildRequires: tex(luatex85.sty) +BuildRequires: tex(makeidx.sty) +BuildRequires: tex(multicol.sty) BuildRequires: tex(needspace.sty) BuildRequires: tex(parskip.sty) BuildRequires: tex(polyglossia.sty) +BuildRequires: tex(remreset.sty) +BuildRequires: tex(substitutefont.sty) BuildRequires: tex(tabulary.sty) +BuildRequires: tex(textalpha.sty) +BuildRequires: tex(textcomp.sty) +BuildRequires: tex(tgheros.sty) +BuildRequires: tex(tgtermes.sty) BuildRequires: tex(titlesec.sty) BuildRequires: tex(upquote.sty) -BuildRequires: tex(utf8x.def) +BuildRequires: tex(varwidth.sty) BuildRequires: tex(wrapfig.sty) +BuildRequires: tex(xcolor.sty) +# Other optional dependencies. +BuildRequires: tex(ellipse.sty) +BuildRequires: tex(fontawesome5.sty) +BuildRequires: tex(fontawesome.sty) +BuildRequires: tex(pict2e.sty) %endif %endif @@ -203,36 +235,91 @@ the Python docs: Summary: LaTeX builder dependencies for python%{python3_pkgversion}-sphinx Requires: python%{python3_pkgversion}-sphinx = %{epoch}:%{version}-%{release} +# Required dependencies as stated in the documentation [1]: +# +# - texlive-collection-latexrecommended +# - texlive-collection-fontsrecommended +# - texlive-collection-fontsextra +# - texlive-collection-latexextra +# - texlive-tex-gyre +# - latexmk +# +# [1] https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.latex.LaTeXBuilder +# +# These packages install 2500+ other packages requiring ~3 GiB of space. +# Therefore, a more precise list of dependencies. + Requires: texlive-collection-fontsrecommended Requires: texlive-collection-latex +Requires: texlive-gnu-freefont Requires: latexmk + +# Required by sphinx.ext.imgmath – Render math as images Requires: texlive-dvipng Requires: texlive-dvisvgm +#Requires: tex(preview.sty) Pulls in texlive-collection-latexrecommended + +Requires: tex(article.cls) +Requires: tex(utf8x.def) + +# Other dependencies. +# -- After searching for \RequirePackage{..} and \usepackage{..}. +Requires: tex(alltt.sty) +Requires: tex(amsfonts.sty) Requires: tex(amsmath.sty) +Requires: tex(amssymb.sty) +Requires: tex(amstext.sty) Requires: tex(amsthm.sty) Requires: tex(anyfontsize.sty) -Requires: tex(article.cls) +Requires: tex(atbegshi.sty) +Requires: tex(babel.sty) +Requires: tex(bm.sty) +Requires: tex(booktabs.sty) Requires: tex(capt-of.sty) Requires: tex(cmap.sty) -Requires: tex(color.sty) -Requires: tex(ctablestack.sty) +Requires: tex(colortbl.sty) +Requires: tex(etoolbox.sty) Requires: tex(fancyhdr.sty) Requires: tex(fancyvrb.sty) +Requires: tex(float.sty) Requires: tex(fncychap.sty) +Requires: tex(fontenc.sty) +Requires: tex(fontspec.sty) Requires: tex(framed.sty) -Requires: tex(FreeSerif.otf) Requires: tex(geometry.sty) +Requires: tex(graphicx.sty) +Requires: tex(hypcap.sty) Requires: tex(hyperref.sty) +Requires: tex(inputenc.sty) Requires: tex(kvoptions.sty) +Requires: tex(longtable.sty) +Requires: tex(ltxcmds.sty) Requires: tex(luatex85.sty) +Requires: tex(makeidx.sty) +Requires: tex(multicol.sty) Requires: tex(needspace.sty) Requires: tex(parskip.sty) Requires: tex(polyglossia.sty) +Requires: tex(remreset.sty) +Requires: tex(substitutefont.sty) Requires: tex(tabulary.sty) +Requires: tex(textalpha.sty) +Requires: tex(textcomp.sty) +Requires: tex(tgheros.sty) +Requires: tex(tgtermes.sty) Requires: tex(titlesec.sty) Requires: tex(upquote.sty) -Requires: tex(utf8x.def) +Requires: tex(varwidth.sty) Requires: tex(wrapfig.sty) +Requires: tex(xcolor.sty) +#Requires: tex(xeCJK.sty) Pulls in pLaTeX and upLaTeX + +# The following dependencies are used only if available. +# -- After searching for \IfFileExists{..}, \RequirePackage{..} +Recommends: tex(ellipse.sty) +Recommends: tex(fontawesome5.sty) +Recommends: tex(fontawesome.sty) +Recommends: tex(pict2e.sty) # No files in this package, automatic provides don't work: %py_provides python%{python3_pkgversion}-sphinx-latex From 78fa545ec76807cc3756ad97482460142de1cd39 Mon Sep 17 00:00:00 2001 From: Dennis van Raaij Date: Fri, 17 Oct 2025 10:06:24 +0200 Subject: [PATCH 4/6] Don't build python-sphinx-latex for ELN See also: https://src.fedoraproject.org/rpms/python-sphinx/pull-request/74#comment-286281 --- python-sphinx.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python-sphinx.spec b/python-sphinx.spec index 02b4750..a5e54f5 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -18,6 +18,7 @@ %bcond imagemagick_tests %{undefined rhel} # During texlive updates, sometimes the latex environment is unstable +# NOTE: LaTeX tests are never run when building for ELN. %bcond latex_tests 1 Name: python-sphinx @@ -89,7 +90,7 @@ BuildRequires: texinfo BuildRequires: ImageMagick %endif -%if %{with latex_tests} +%if %{undefined rhel} && %{with latex_tests} BuildRequires: texlive-collection-fontsrecommended BuildRequires: texlive-collection-latex BuildRequires: texlive-gnu-freefont @@ -231,6 +232,7 @@ the Python docs: snippets and inclusion of appropriately formatted docstrings. +%if %{undefined rhel} %package -n python%{python3_pkgversion}-sphinx-latex Summary: LaTeX builder dependencies for python%{python3_pkgversion}-sphinx @@ -334,6 +336,7 @@ useful to many other projects. This package pulls in the TeX dependencies needed by Sphinx's LaTeX builder. +%endif %package doc @@ -497,10 +500,10 @@ k="${k} and not test_check_js_search_indexes" %dir %{_datadir}/sphinx/locale/* %{_mandir}/man1/sphinx-* - +%if %{undefined rhel} %files -n python%{python3_pkgversion}-sphinx-latex # empty, this is a metapackage - +%endif %files doc %license LICENSE.rst From d2412868344221b6aa5cca793447f1ed93c86458 Mon Sep 17 00:00:00 2001 From: Dennis van Raaij Date: Sun, 19 Oct 2025 13:37:55 +0200 Subject: [PATCH 5/6] Make recommended TeX packages mandatory Ensure that these packages are installed when building a package that depends on python-sphinx-latex in a Koji build environment. --- python-sphinx.spec | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/python-sphinx.spec b/python-sphinx.spec index a5e54f5..9572f51 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -114,11 +114,14 @@ BuildRequires: tex(booktabs.sty) BuildRequires: tex(capt-of.sty) BuildRequires: tex(cmap.sty) BuildRequires: tex(colortbl.sty) +BuildRequires: tex(ellipse.sty) BuildRequires: tex(etoolbox.sty) BuildRequires: tex(fancyhdr.sty) BuildRequires: tex(fancyvrb.sty) BuildRequires: tex(float.sty) BuildRequires: tex(fncychap.sty) +BuildRequires: tex(fontawesome.sty) +BuildRequires: tex(fontawesome5.sty) BuildRequires: tex(fontenc.sty) BuildRequires: tex(fontspec.sty) BuildRequires: tex(framed.sty) @@ -135,6 +138,7 @@ BuildRequires: tex(makeidx.sty) BuildRequires: tex(multicol.sty) BuildRequires: tex(needspace.sty) BuildRequires: tex(parskip.sty) +BuildRequires: tex(pict2e.sty) BuildRequires: tex(polyglossia.sty) BuildRequires: tex(remreset.sty) BuildRequires: tex(substitutefont.sty) @@ -148,11 +152,6 @@ BuildRequires: tex(upquote.sty) BuildRequires: tex(varwidth.sty) BuildRequires: tex(wrapfig.sty) BuildRequires: tex(xcolor.sty) -# Other optional dependencies. -BuildRequires: tex(ellipse.sty) -BuildRequires: tex(fontawesome5.sty) -BuildRequires: tex(fontawesome.sty) -BuildRequires: tex(pict2e.sty) %endif %endif @@ -280,11 +279,14 @@ Requires: tex(booktabs.sty) Requires: tex(capt-of.sty) Requires: tex(cmap.sty) Requires: tex(colortbl.sty) +Requires: tex(ellipse.sty) Requires: tex(etoolbox.sty) Requires: tex(fancyhdr.sty) Requires: tex(fancyvrb.sty) Requires: tex(float.sty) Requires: tex(fncychap.sty) +Requires: tex(fontawesome.sty) +Requires: tex(fontawesome5.sty) Requires: tex(fontenc.sty) Requires: tex(fontspec.sty) Requires: tex(framed.sty) @@ -301,6 +303,7 @@ Requires: tex(makeidx.sty) Requires: tex(multicol.sty) Requires: tex(needspace.sty) Requires: tex(parskip.sty) +Requires: tex(pict2e.sty) Requires: tex(polyglossia.sty) Requires: tex(remreset.sty) Requires: tex(substitutefont.sty) @@ -316,13 +319,6 @@ Requires: tex(wrapfig.sty) Requires: tex(xcolor.sty) #Requires: tex(xeCJK.sty) Pulls in pLaTeX and upLaTeX -# The following dependencies are used only if available. -# -- After searching for \IfFileExists{..}, \RequirePackage{..} -Recommends: tex(ellipse.sty) -Recommends: tex(fontawesome5.sty) -Recommends: tex(fontawesome.sty) -Recommends: tex(pict2e.sty) - # No files in this package, automatic provides don't work: %py_provides python%{python3_pkgversion}-sphinx-latex From 574c5a94d687a174538069658fe752653f2aff23 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Thu, 4 Sep 2025 11:51:47 +0200 Subject: [PATCH 6/6] Ensure compatibility with python-docutils 0.22+ --- 13610.patch | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 13883.patch | 30 ++++++++++++++++++++++++++++ python-sphinx.spec | 6 ++++++ 3 files changed, 85 insertions(+) create mode 100644 13610.patch create mode 100644 13883.patch 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.