Instead of a bcond for bootstrap, use one for docs

This commit is contained in:
Jeroen van Meeuwen (Kolab Systems) 2019-02-20 01:35:13 +01:00
parent 727d7901c5
commit 89ba51cee2

View File

@ -5,8 +5,8 @@
%global with_python3 1
%endif
# Use this when bootstraping python3-sphinx
%bcond_with bootstrap
# Specify --without docs to prevent the dependency loop on python-sphinx
%bcond_without docs
%global python2_wheelname %{pypi_name}-%{version}-py2.py3-none-any.whl
%global python3_wheelname %python2_wheelname
@ -32,8 +32,10 @@ BuildRequires: python-setuptools
BuildRequires: python-devel
BuildRequires: pytest
BuildRequires: pyparsing
%if %{with docs}
BuildRequires: python-sphinx
%endif
%endif
BuildRequires: python2-pretend
BuildRequires: python2-six
@ -46,11 +48,8 @@ BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-pretend
BuildRequires: python%{python3_pkgversion}-pyparsing
BuildRequires: python%{python3_pkgversion}-six
%if %{without bootstrap}
%if %{with docs}
BuildRequires: python%{python3_pkgversion}-sphinx
%else
# When bootstrapping, we'll use Python 2 sphinx
BuildRequires: python2-sphinx
%endif
%endif
@ -87,18 +86,22 @@ dealing with versions, specifiers, markers etc.
%package -n python%{python3_pkgversion}-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
Requires: python%{python3_pkgversion}-pyparsing
Requires: python%{python3_pkgversion}-six
%description -n python%{python3_pkgversion}-%{pypi_name}
python3-packaging provides core utilities for Python packages like utilities for
dealing with versions, specifiers, markers etc.
%endif
%if %{with docs}
%package -n python-%{pypi_name}-doc
Summary: python-packaging documentation
%description -n python-%{pypi_name}-doc
Documentation for python-packaging
%endif
%prep
%autosetup -n %{pypi_name}-%{version}
@ -120,8 +123,9 @@ rm -rf %{pypi_name}.egg-info
%endif
%endif
%if %{with docs}
# generate html docs
%if 0%{?with_python3} && %{without bootstrap}
%if 0%{?with_python3}
sphinx-build-3 docs html
%else
sphinx-build docs html
@ -131,6 +135,7 @@ sphinx-build docs html
rm -rf html/.{doctrees,buildinfo}
# Do not bundle fonts
rm -rf html/_static/fonts/
%endif
%install
%if 0%{?build_wheel}
@ -170,9 +175,11 @@ rm -rf html/_static/fonts/
%{python3_sitelib}/%{pypi_name}-*-info/
%endif
%if %{with docs}
%files -n python-%{pypi_name}-doc
%doc html
%license LICENSE LICENSE.APACHE LICENSE.BSD
%endif
%changelog
* Mon Feb 04 2019 Lumír Balhar <lbalhar@redhat.com> - 19.0-1