Build PDF docs instead of HTML

Sphinx-generated HTML documentation is not suitable for packaging; see
https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
This commit is contained in:
Benjamin A. Beasley 2021-09-27 13:52:52 -04:00
parent 7858ed545f
commit 420fad1c89

View File

@ -1,6 +1,12 @@
%global forgeurl https://gitlab.gnome.org/GNOME/%{name}/
%global tag %{version}
# 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: gi-docgen
Version: 2021.7
%forgemeta
@ -46,9 +52,13 @@ BuildArch: noarch
BuildRequires: python3-devel
# Documentation
%if %{with doc_pdf}
BuildRequires: make
BuildRequires: python3dist(sphinx)
BuildRequires: python3dist(sphinx-rtd-theme)
BuildRequires: python3-sphinx-latex
BuildRequires: latexmk
%endif
# Unbundling fonts:
BuildRequires: font(redhatdisplay)
@ -136,8 +146,10 @@ find . -type f \( -name '*.woff' -o -name '*.woff2' \) -print -delete
%build
%pyproject_wheel
%make_build -C docs
rm -rvf docs/_build/.buildinfo docs/_build/.doctrees
%if %{with doc_pdf}
sphinx-build -b latex docs %{_vpath_builddir}/_latex
%make_build -C %{_vpath_builddir}/_latex
%endif
%install
@ -149,7 +161,10 @@ install -t '%{buildroot}%{_pkgdocdir}' -D -m 0644 -p \
CONTRIBUTING.md \
docs/CODEOWNERS \
README.md
cp -rp docs/_build '%{buildroot}%{_pkgdocdir}/html'
%if %{with doc_pdf}
install -t '%{buildroot}%{_pkgdocdir}' -p -m 0644 \
'%{_vpath_builddir}/_latex/gi-docgen.pdf'
%endif
cp -rp examples '%{buildroot}%{_pkgdocdir}/'