# When bootstrapping sphinx in Fedora, we don't yet have sphinxcontrib-websupport # Without it we have warnings in docs, but it's not a hard dependency # We don't want to support sphinxcontrib-websupport in RHEL, hence disabling the dependency %bcond websupport %{undefined rhel} # Also, we don't have all the tests requirements %bcond tests 1 # Unset -s on python shebang to allow RPM-installed sphinx to be used # with user-installed modules (#1903763) %undefine _py3_shebang_s # No internet in Koji %bcond internet 0 # 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.1.2 #global prerel ... %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} Release: 1%{?dist} Epoch: 1 Summary: Python documentation generator # Unless otherwise noted, the license for code is BSD-2-Clause # sphinx/themes/haiku/static/haiku.css_t has bits licensed with MIT License: BSD-2-Clause AND MIT URL: https://www.sphinx-doc.org/ 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 # Fix test_assets_order for Sphinx 7.1.2 Patch: https://github.com/sphinx-doc/sphinx/commit/85ffb3b0.patch # Fix test_dark_style with Pygments 2.16+ Patch: https://github.com/sphinx-doc/sphinx/commit/083d573b.patch BuildArch: noarch BuildRequires: make BuildRequires: python3-devel BuildRequires: python3-flit-core BuildRequires: python3-cython BuildRequires: python3-filelock BuildRequires: python3-html5lib BuildRequires: pyproject-rpm-macros %if %{with websupport} BuildRequires: python3-sphinxcontrib-websupport %endif %if %{with tests} # tests import _testcapi BuildRequires: python3-test BuildRequires: gcc BuildRequires: gettext BuildRequires: graphviz BuildRequires: texinfo %if %{with imagemagick_tests} BuildRequires: ImageMagick %endif %if %{with latex_tests} BuildRequires: texlive-collection-basic BuildRequires: texlive-dist BuildRequires: texlive-fontsextra %endif %endif %description Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of multiple reStructuredText sources), written by Georg Brandl. It was originally created to translate the new Python documentation, but has now been cleaned up in the hope that it will be useful to many other projects. Sphinx uses reStructuredText as its markup language, and many of its strengths come from the power and straightforwardness of reStructuredText and its parsing and translating suite, the Docutils. Although it is still under constant development, the following features are already present, work fine and can be seen "in action" in the Python docs: * Output formats: HTML (including Windows HTML Help) and LaTeX, for printable PDF versions * Extensive cross-references: semantic markup and automatic links for functions, classes, glossary terms and similar pieces of information * Hierarchical structure: easy definition of a document tree, with automatic links to siblings, parents and children * Automatic indices: general index as well as a module index * Code handling: automatic highlighting using the Pygments highlighter * Various extensions are available, e.g. for automatic testing of snippets and inclusion of appropriately formatted docstrings. %package -n python%{python3_pkgversion}-sphinx Summary: Python documentation generator Recommends: graphviz Recommends: ImageMagick %description -n python%{python3_pkgversion}-sphinx Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of multiple reStructuredText sources), written by Georg Brandl. It was originally created to translate the new Python documentation, but has now been cleaned up in the hope that it will be useful to many other projects. Sphinx uses reStructuredText as its markup language, and many of its strengths come from the power and straightforwardness of reStructuredText and its parsing and translating suite, the Docutils. Although it is still under constant development, the following features are already present, work fine and can be seen "in action" in the Python docs: * Output formats: HTML (including Windows HTML Help) and LaTeX, for printable PDF versions * Extensive cross-references: semantic markup and automatic links for functions, classes, glossary terms and similar pieces of information * Hierarchical structure: easy definition of a document tree, with automatic links to siblings, parents and children * Automatic indices: general index as well as a module index * Code handling: automatic highlighting using the Pygments highlighter * Various extensions are available, e.g. for automatic testing of snippets and inclusion of appropriately formatted docstrings. %package -n python%{python3_pkgversion}-sphinx-latex 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: texlive-dvipng Requires: texlive-dvisvgm Requires: tex(amsmath.sty) Requires: tex(amsthm.sty) Requires: tex(anyfontsize.sty) Requires: tex(article.cls) Requires: tex(capt-of.sty) Requires: tex(cmap.sty) Requires: tex(color.sty) Requires: tex(ctablestack.sty) Requires: tex(fancyhdr.sty) Requires: tex(fancyvrb.sty) Requires: tex(fncychap.sty) Requires: tex(framed.sty) Requires: tex(FreeSerif.otf) Requires: tex(geometry.sty) Requires: tex(hyperref.sty) Requires: tex(kvoptions.sty) Requires: tex(luatex85.sty) Requires: tex(needspace.sty) Requires: tex(parskip.sty) Requires: tex(polyglossia.sty) Requires: tex(tabulary.sty) Requires: tex(titlesec.sty) Requires: tex(upquote.sty) Requires: tex(utf8x.def) Requires: tex(wrapfig.sty) # No files in this package, automatic provides don't work: %py_provides python%{python3_pkgversion}-sphinx-latex %description -n python%{python3_pkgversion}-sphinx-latex Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of multiple reStructuredText sources), written by Georg Brandl. It was originally created to translate the new Python documentation, but has now been cleaned up in the hope that it will be useful to many other projects. This package pulls in the TeX dependencies needed by Sphinx's LaTeX builder. %package doc Summary: Documentation for %{name} License: BSD-2-Clause Recommends: python%{python3_pkgversion}-sphinx = %{epoch}:%{version}-%{release} %description doc Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of multiple reStructuredText sources), written by Georg Brandl. It was originally created to translate the new Python documentation, but has now been cleaned up in the hope that it will be useful to many other projects. This package contains documentation in the HTML format. %prep %autosetup -n sphinx-%{upstream_version} -p1 %if %{without imagemagick_tests} rm tests/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 %generate_buildrequires %pyproject_buildrequires -r %{?with_tests:-x test} %build %pyproject_wheel export PYTHONPATH=$PWD pushd doc export SPHINXBUILD="%{python3} ../sphinx/cmd/build.py" make html SPHINXBUILD="$SPHINXBUILD" make man SPHINXBUILD="$SPHINXBUILD" rm -rf _build/html/.buildinfo # Those files are copied to _build/html/_images and loaded to the # html pages from there - we can safely remove the duplicated and unused files rm -rf _build/html/_static/themes _build/html/_static/tutorial rm -f _build/html/_static/more.png _build/html/_static/translation.svg mv _build/html .. popd %install %pyproject_install # For backwards compatibility. Remove with care, if at all for i in sphinx-{apidoc,autogen,build,quickstart}; do ln -s %{_bindir}/$i %{buildroot}%{_bindir}/$i-%{python3_version} ln -s %{_bindir}/$i %{buildroot}%{_bindir}/$i-3 done # Clean up non-python files rm -f %{buildroot}%{python3_sitelib}/sphinx/locale/.DS_Store rm -rf %{buildroot}%{python3_sitelib}/sphinx/locale/.tx pushd doc # Deliver man pages install -d %{buildroot}%{_mandir}/man1 for f in _build/man/sphinx-*.1; do cp -p $f %{buildroot}%{_mandir}/man1/$(basename $f) done popd # Move language files to /usr/share; # patch to support this incorporated in 0.6.6 pushd %{buildroot}%{python3_sitelib} for lang in `find sphinx/locale -maxdepth 1 -mindepth 1 -type d -not -path '*/\.*' -printf "%f "`; do test $lang == __pycache__ && continue install -d %{buildroot}%{_datadir}/sphinx/locale/$lang install -d %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES mv sphinx/locale/$lang/LC_MESSAGES/sphinx.js \ %{buildroot}%{_datadir}/sphinx/locale/$lang/ mv sphinx/locale/$lang/LC_MESSAGES/sphinx.mo \ %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/ rm -rf sphinx/locale/$lang done popd # Create the sphinxcontrib directory, so we can own it # See https://bugzilla.redhat.com/show_bug.cgi?id=1669790 for rationale mkdir %{buildroot}%{python3_sitelib}/sphinxcontrib %find_lang sphinx # Language files; Since these are javascript, it's not immediately obvious to # find_lang that they need to be marked with a language. (cd %{buildroot} && find . -name 'sphinx.js') | sed -e 's|^.||' | sed -e \ 's:\(.*/locale/\)\([^/_]\+\)\(.*\.js$\):%lang(\2) \1\2\3:' \ >> sphinx.lang %if %{with tests} %check # 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 %if %{without internet} -k "not linkcheck and not test_latex_images and not test_build_latex_doc" \ %endif ; %endif %files -n python%{python3_pkgversion}-sphinx -f sphinx.lang %license LICENSE %doc AUTHORS CHANGES EXAMPLES README.rst %{_bindir}/sphinx-* %{python3_sitelib}/sphinx/ %dir %{python3_sitelib}/sphinxcontrib/ %{python3_sitelib}/sphinx-%{upstream_version}.dist-info/ %dir %{_datadir}/sphinx/ %dir %{_datadir}/sphinx/locale %dir %{_datadir}/sphinx/locale/* %{_mandir}/man1/sphinx-* %files -n python%{python3_pkgversion}-sphinx-latex # empty, this is a metapackage %files doc %license LICENSE %doc html