Bug 2169855
| Summary: | %pyproject_buildrequires -w fails when the build backend is already installed and pip isn't | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Miro Hrončok <mhroncok> |
| Component: | pyproject-rpm-macros | Assignee: | Miro Hrončok <mhroncok> |
| Status: | NEW --- | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | low | ||
| Version: | 39 | CC: | maxwell, mhroncok, pviktori, python-packagers-sig, torsava |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | Type: | Bug | |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle. Changing version to 39. |
Description of problem: When the %pyproject_buildrequires macro is used with the -w option (build wheel and read the metadata from it) and the build backend is already installed but pip isn't, then the build fails with: Requirement satisfied: hatchling (installed: hatchling 1.13.0) /usr/bin/python3: No module named pip Traceback (most recent call last): File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 532, in main generate_requires( File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 444, in generate_requires generate_run_requirements(backend, requirements, build_wheel=build_wheel, wheeldir=wheeldir) File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 352, in generate_run_requirements generate_run_requirements_wheel(backend, requirements, wheeldir) File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 333, in generate_run_requirements_wheel raise RuntimeError('Failed to build the wheel for %pyproject_buildrequires -w.') RuntimeError: Failed to build the wheel for %pyproject_buildrequires -w. This is caused by the fact that the macro echoes pip but the %generate_buildrequires section does not restart before using it. Version-Release number of selected component: 1.6.2-1 How reproducible: Always. Steps to Reproduce: 1. Take e.g. https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/tests/python-userpath.spec 2. Apply this change: BuildRequires: python3-devel +BuildRequires: python3-hatchling ... %generate_buildrequires -%pyproject_buildrequires requirements-dev.txt -w +%pyproject_buildrequires -w ... %check -%pytest +#pytest (The requirements-dev.txt argument must be removed because it hides this problem.) 3. Build the spec in mock/koji. Actual results: /usr/bin/python3: No module named pip ... RuntimeError: Failed to build the wheel for %pyproject_buildrequires -w. Expected results: pip is installed, package builds fine. Additional info: Possible fix: Before calling pyproject_wheel.build_wheel(...), requirements.add('pip', ...) and requirements.check(...).