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