Add a docs bcond

This commit is contained in:
Maxwell G 2022-10-10 17:01:33 -05:00
parent 97ff77069f
commit d49fb37ae7
No known key found for this signature in database
GPG Key ID: F79E4E25E8C661F8

View File

@ -1,3 +1,4 @@
%bcond_without docs
%global pypi_name testpath
Name: python-%{pypi_name}
@ -17,8 +18,10 @@ BuildRequires: python3-devel
BuildRequires: python3-flit
%if %{with docs}
BuildRequires: python3-sphinx
BuildRequires: python3-sphinx_rtd_theme
%endif
# Tests:
BuildRequires: python3-pytest
@ -40,10 +43,12 @@ Summary: %summary
%_description
%if %{with docs}
%package doc
Summary: %{name} documentation
%description doc
Documentation for %{name}.
%endif
%prep
@ -59,10 +64,12 @@ rm -f %{pypi_name}/*.exe
# we use flit to create a wheel from sources
flit build --format wheel
%if %{with docs}
# generate html docs
sphinx-build-3 doc html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%endif
%install
@ -81,8 +88,10 @@ rm -rf html/.{doctrees,buildinfo}
%{python3_sitelib}/%{pypi_name}-%{version}.dist-info/
%{python3_sitelib}/%{pypi_name}/
%if %{with docs}
%files doc
%doc html
%endif
%changelog
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-3