#5 Instead of a bcond for bootstrap, use one for docs
Merged 5 years ago by lbalhar. Opened 5 years ago by kanarip.
rpms/ kanarip/python-packaging bcond-docs  into  master

Instead of a bcond for bootstrap, use one for docs
Jeroen van Meeuwen (Kolab Systems) • 5 years ago  
file modified
+15 -8
@@ -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-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}-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 @@ 

  %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 @@ 

  %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 @@ 

  rm -rf html/.{doctrees,buildinfo}

  # Do not bundle fonts

  rm -rf html/_static/fonts/

+ %endif

  

  %install

  %if 0%{?build_wheel}
@@ -170,9 +175,11 @@ 

  %{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

Bootstrapping the builds for python3-sphinx, which down its build dependency chain requires python-packaging basically means we'll need to build python-packaging without documentation.

The former %{without bootstrap} doesn't function [1], and python2-sphinx isn't necessarily available when python3-sphinx isn't. Unlike with bootstrapping, all the minimal build requirements are or can be made available to this package's build, we only have to avoid building the documentation for the first go-around, as to not require sphinx for the build.

[1] http://rpm.org/user_doc/conditional_builds.html

Testing this while bootstrapping Python 3.8. Also, bump @lbalhar.

Builds for me without docs. Please review and eventually merge.

BTW Maybe @python-sig should be added as package maintainers here?

Looks good to me. Sorry for the delay.

Pull-Request has been merged by lbalhar

5 years ago