From ff396611ddd6cdccb7f1bb7c7db859aec46377fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 2 Feb 2021 23:31:44 +0100 Subject: [PATCH] Generate python3dist(setuptools/wheel) BuildRequires directly from the macro The macro already checks if pyproject.toml exists and echoes the dependency on python3dist(toml) early. This adds an else branch to echo the default backend. For projects without pyproject.toml, the number of installation rounds is reduced. Previously: 1. (python3-devel +) pip + packaging 2. setuptools + wheel 3. ... Now: 1. (python3-devel +) pip + packaging + setuptools + wheel 2. ... This duplicates the information about the default build backend, because the script still needs to handle projects with pyproject.toml without an explicit build backend option. Hence, the script was not adapted (except a comment). --- macros.pyproject | 4 ++++ pyproject-rpm-macros.spec | 1 + pyproject_buildrequires.py | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/macros.pyproject b/macros.pyproject index 63f127d..70f2aeb 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -87,6 +87,10 @@ echo 'python%{python3_pkgversion}dist(pip) >= 19' echo 'python%{python3_pkgversion}dist(packaging)' if [ -f pyproject.toml ]; then echo 'python%{python3_pkgversion}dist(toml)' +else + # Note: If the default requirements change, also change them in the script! + echo 'python%{python3_pkgversion}dist(setuptools) >= 40.8' + echo 'python%{python3_pkgversion}dist(wheel)' fi # Check if we can generate dependencies on Python extras if [ "%{py_dist_name []}" == "[]" ]; then diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index a32c3c8..16d8ad8 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -107,6 +107,7 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 * Tue Feb 02 2021 Miro HronĨok - 0-37 - Remove support for Python 3.7 from %%pyproject_buildrequires - Generate python3dist(toml) BR with pyproject.toml earlier to avoid extra install round +- Generate python3dist(setutpools/wheel) BR without pyproject.toml earlier as well * Wed Jan 27 2021 Fedora Release Engineering - 0-36 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index 7038ac4..2c9992e 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -177,6 +177,10 @@ def get_backend(requirements): # (either directly, or by implicitly invoking the [following] backend). backend_name = 'setuptools.build_meta:__legacy__' + # Note: For projects without pyproject.toml, this was already echoed + # by the %pyproject_buildrequires macro, but this also handles cases + # with pyproject.toml without a specified build backend. + # If the default requirements change, also change them in the macro! requirements.add('setuptools >= 40.8', source='default build backend') requirements.add('wheel', source='default build backend')