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.
This commit is contained in:
Karolina Surma 2024-04-26 10:19:02 +02:00
commit fa05224c39
9 changed files with 288 additions and 182 deletions

View file

@ -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