diff --git a/python-packaging.spec b/python-packaging.spec index 36a7851..fa120ea 100644 --- a/python-packaging.spec +++ b/python-packaging.spec @@ -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}