Build PDF documentation in lieu of HTML

See https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
This commit is contained in:
Benjamin A. Beasley 2021-09-28 16:10:39 -04:00
parent 3f76b2be7f
commit 4a175e72d6

View File

@ -1,3 +1,9 @@
# Sphinx-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# We can generate PDF documentation as a lesser substitute.
%bcond_without doc_pdf
Name: python-sure Name: python-sure
Version: 2.0.0 Version: 2.0.0
Release: %autorelease Release: %autorelease
@ -35,12 +41,16 @@ BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pytest-cov) BuildRequires: python3dist(pytest-cov)
# Documentation dependencies # Documentation dependencies
%if %{with doc_pdf}
BuildRequires: make BuildRequires: make
# development.txt: Sphinx==2.3.1 # development.txt: Sphinx==2.3.1
BuildRequires: python3dist(sphinx) BuildRequires: python3dist(sphinx)
# development.txt: sphinx-rtd-theme==0.4.3 # development.txt: sphinx-rtd-theme==0.4.3
BuildRequires: python3dist(sphinx-rtd-theme) BuildRequires: python3dist(sphinx-rtd-theme)
BuildRequires: python3-docs BuildRequires: python3-docs
BuildRequires: python3-sphinx-latex
BuildRequires: latexmk
%endif
%global common_description %{expand: %global common_description %{expand:
An idiomatic testing library for python with powerful and flexible assertions An idiomatic testing library for python with powerful and flexible assertions
@ -86,8 +96,10 @@ cp -p '%{SOURCE1}' .
%build %build
%pyproject_wheel %pyproject_wheel
env PYTHONPATH="${PWD}" %make_build -C docs/ html SPHINXOPTS='%{?_smp_mflags}' %if %{with doc_pdf}
rm -vf docs/_build/html/.buildinfo env PYTHONPATH="${PWD}" %make_build -C docs/ latex SPHINXOPTS='%{?_smp_mflags}'
%make_build -C docs/build/latex
%endif
%install %install
@ -111,7 +123,9 @@ install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 sure.1
%doc CHANGELOG.md %doc CHANGELOG.md
%doc README.rst %doc README.rst
%doc TODO.rst %doc TODO.rst
%doc docs/build/html %if %{with doc_pdf}
%doc docs/build/latex/Sure.pdf
%endif
%changelog %changelog