diff --git a/python-fasteners.spec b/python-fasteners.spec index f6c518f..12acfae 100644 --- a/python-fasteners.spec +++ b/python-fasteners.spec @@ -1,4 +1,11 @@ %bcond_without tests + +# 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 substitute. +%bcond_without doc_pdf + # The python-diskcache package, used in some of the tests, has been retired. %bcond_with diskcache @@ -21,6 +28,13 @@ BuildArch: noarch BuildRequires: python3-devel +%if %{with doc_pdf} +BuildRequires: make +BuildRequires: python3dist(sphinx) +BuildRequires: python3-sphinx-latex +BuildRequires: latexmk +%endif + %global common_description %{expand: \ Cross platform locks for threads and processes} @@ -35,6 +49,13 @@ Summary: A python package that provides useful locks %{common_description} +%package doc +Summary: Documentation for fasteners + +%description doc +%{common_description} + + %prep %autosetup -p1 -n fasteners-%{version} %if %{without diskcache} @@ -49,6 +70,11 @@ sed -r -i '/\b(diskcache)\b/d' requirements-test.txt %build %pyproject_wheel +%if %{with doc_pdf} +PYTHONPATH="${PWD}" sphinx-build -b latex doc/source %{_vpath_builddir}/_latex +%make_build -C %{_vpath_builddir}/_latex LATEXMKOPTS='-quiet' +%endif + %install %pyproject_install @@ -65,8 +91,15 @@ sed -r -i '/\b(diskcache)\b/d' requirements-test.txt %files -n python3-fasteners -f %{pyproject_files} # pyproject_files handles LICENSE; verify with “rpm -qL -p …” + + +%files doc +%license LICENSE %doc CHANGELOG %doc README.md +%if %{with doc_pdf} +%doc %{_vpath_builddir}/_latex/Fasteners.pdf +%endif %changelog