Add new bootstrapping bcond
The Python RPM dependency generators now require python3-packaging. In order to bootstrap a new Python version, we need to build this without the generators first. The provides and requires are added manually in that case. At that point, we cannot build the docs or run the tests either, so the bootstrap bcond also disables docs and tests.
This commit is contained in:
parent
233acaa66f
commit
d9a0f9c011
@ -1,10 +1,20 @@
|
||||
%global pypi_name packaging
|
||||
|
||||
# Specify --with bootstrap to build in bootstrap mode
|
||||
# This mode is needed, because python3-rpm-generators need packaging
|
||||
# When bootstrapping, disable tests and docs as well.
|
||||
%bcond_with bootstrap
|
||||
|
||||
%if %{without bootstrap}
|
||||
# Specify --without docs to prevent the dependency loop on python-sphinx
|
||||
%bcond_without docs
|
||||
|
||||
# Specify --without tests to prevent the dependency loop on python-pytest
|
||||
%bcond_without tests
|
||||
%else
|
||||
%bcond_with docs
|
||||
%bcond_with tests
|
||||
%endif
|
||||
|
||||
Name: python-%{pypi_name}
|
||||
Version: 20.9
|
||||
@ -19,23 +29,17 @@ BuildArch: noarch
|
||||
BuildRequires: python%{python3_pkgversion}-devel
|
||||
BuildRequires: pyproject-rpm-macros
|
||||
|
||||
# We specify dependencies to build the wheel manually to avoid circular
|
||||
# dependency on self.
|
||||
# We also don't use the python3dist() form, in case packaging is ever used
|
||||
# in the provides generator.
|
||||
%if %{with bootstrap}
|
||||
BuildRequires: python%{python3_pkgversion}-setuptools
|
||||
BuildRequires: python%{python3_pkgversion}-pip
|
||||
BuildRequires: python%{python3_pkgversion}-wheel
|
||||
%endif
|
||||
|
||||
# Upstream uses nox for testing, we specify the test deps manually as well.
|
||||
%if %{with tests}
|
||||
BuildRequires: python%{python3_pkgversion}-pytest
|
||||
BuildRequires: python%{python3_pkgversion}-pretend
|
||||
BuildRequires: python%{python3_pkgversion}-pyparsing
|
||||
%endif
|
||||
%if %{with docs}
|
||||
BuildRequires: python%{python3_pkgversion}-sphinx
|
||||
BuildRequires: python%{python3_pkgversion}-pyparsing
|
||||
%endif
|
||||
|
||||
|
||||
@ -52,6 +56,12 @@ Summary: %{summary}
|
||||
# This is kept for compatibility with Fedora < 33 only:
|
||||
%py_provides python%{python3_pkgversion}-%{pypi_name}
|
||||
|
||||
%if %{with bootstrap}
|
||||
Provides: python%{python3_pkgversion}dist(packaging) = %{version}
|
||||
Provides: python%{python3_version}dist(packaging) = %{version}
|
||||
Requires: python%{python3_version}dist(pyparsing)
|
||||
%endif
|
||||
|
||||
%description -n python%{python3_pkgversion}-%{pypi_name} %_description
|
||||
|
||||
|
||||
@ -71,8 +81,18 @@ Documentation for python-packaging
|
||||
# furo is not available in Fedora
|
||||
sed -i '/html_theme = "furo"/d' docs/conf.py
|
||||
|
||||
%if %{without bootstrap}
|
||||
%generate_buildrequires
|
||||
%pyproject_buildrequires -r
|
||||
%endif
|
||||
|
||||
|
||||
%build
|
||||
%if %{with bootstrap}
|
||||
%py3_build
|
||||
%else
|
||||
%pyproject_wheel
|
||||
%endif
|
||||
|
||||
%if %{with docs}
|
||||
# generate html docs
|
||||
@ -85,8 +105,13 @@ rm -rf html/_static/fonts/
|
||||
|
||||
|
||||
%install
|
||||
%if %{with bootstrap}
|
||||
%py3_install
|
||||
echo '%{python3_sitelib}/packaging*' > %{pyproject_files}
|
||||
%else
|
||||
%pyproject_install
|
||||
%pyproject_save_files %{pypi_name}
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with tests}
|
||||
|
Loading…
Reference in New Issue
Block a user