Compare commits

...
Sign in to create a new pull request.

6 commits

Author SHA1 Message Date
Karolina Surma
574c5a94d6 Ensure compatibility with python-docutils 0.22+ 2025-11-19 11:48:53 +01:00
Dennis van Raaij
d241286834 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.
2025-10-20 21:18:27 +02:00
Dennis van Raaij
78fa545ec7 Don't build python-sphinx-latex for ELN
See also:
https://src.fedoraproject.org/rpms/python-sphinx/pull-request/74#comment-286281
2025-10-17 10:31:10 +02:00
Dennis van Raaij
0009cf4a25 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
2025-10-14 23:11:35 +02:00
Dennis van Raaij
31b58a6666 Require package latexmk 2025-10-14 23:11:35 +02:00
Dennis van Raaij
bd77693107 Recommend package make 2025-10-14 23:11:25 +02:00
3 changed files with 187 additions and 13 deletions

49
13610.patch Normal file
View file

@ -0,0 +1,49 @@
From 69998bdf8848614eb52ddd80923ffde7af64c0a8 Mon Sep 17 00:00:00 2001
From: James Addison <jay@jp-hosting.net>
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

30
13883.patch Normal file
View file

@ -0,0 +1,30 @@
From 4d842a2c4909fe360172826a46eb88b442f44858 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnter=20Milde?= <milde@users.sf.net>
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

View file

@ -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
@ -60,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
@ -89,36 +93,68 @@ 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
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(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)
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(pict2e.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)
%endif
%endif
@ -157,6 +193,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.
@ -197,39 +234,93 @@ 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
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(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)
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(pict2e.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
# No files in this package, automatic provides don't work:
%py_provides python%{python3_pkgversion}-sphinx-latex
@ -244,6 +335,7 @@ useful to many other projects.
This package pulls in the TeX dependencies needed by Sphinx's LaTeX
builder.
%endif
%package doc
@ -272,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.
@ -407,10 +502,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