From f8b0e925e8a85f511419665dd408bd2f18ffed33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 11 Dec 2023 14:29:01 +0100 Subject: [PATCH] Fix %pyproject_buildrequires -w when the build backend is already installed and pip isn't Fixes: https://bugzilla.redhat.com/2169855 --- pyproject-rpm-macros.spec | 2 ++ pyproject_buildrequires.py | 5 +++++ pyproject_buildrequires_testcases.yaml | 2 ++ 3 files changed, 9 insertions(+) diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 5ba4f95..4cfaf7a 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -191,6 +191,8 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 - Fixes: rhbz#2244282 - Show a better error message when %%pyproject_install finds no wheel - Fixes: rhbz#2242452 +- Fix %%pyproject_buildrequires -w when the build backend is already installed and pip isn't +- Fixes: rhbz#2169855 * Wed Sep 13 2023 Python Maint - 1.10.0-1 - Add %%_pyproject_check_import_allow_no_modules for automated environments diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index 7b0fc87..e91111f 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -328,6 +328,11 @@ def generate_run_requirements_wheel(backend, requirements, wheeldir): # Reuse the wheel from the previous round of %pyproject_buildrequires (if it exists) wheel = find_built_wheel(wheeldir) if not wheel: + # pip is already echoed from the macro + # but we need to explicitly restart if has not yet been installed + # see https://bugzilla.redhat.com/2169855 + requirements.add('pip >= 19', source='%pyproject_buildrequires -w') + requirements.check(source='%pyproject_buildrequires -w') import pyproject_wheel returncode = pyproject_wheel.build_wheel( wheeldir=wheeldir, diff --git a/pyproject_buildrequires_testcases.yaml b/pyproject_buildrequires_testcases.yaml index 2e6e91e..892e3c3 100644 --- a/pyproject_buildrequires_testcases.yaml +++ b/pyproject_buildrequires_testcases.yaml @@ -365,6 +365,7 @@ Run dependencies with extras and build wheel option: setuptools: 50 wheel: 1 pyyaml: 1 + pip: 20 include_runtime: true build_wheel: true extras: @@ -375,6 +376,7 @@ Run dependencies with extras and build wheel option: python3dist(wheel) python3dist(wheel) python3dist(setuptools) >= 40 + python3dist(pip) >= 19 python3dist(py) >= 1.5 python3dist(six) >= 1.10 python3dist(setuptools)