%pyproject_buildrequires: Do not generate BuildRequires from Requires core metadata fields
See https://packaging.python.org/en/latest/specifications/core-metadata/#requires
That field is deprecated and should include importable module names, not distribution packages.
We have no RPM Provides for importable names.
Treating this like python3dist() Requires is wrong and may result in stuff like:
No match for argument: python3dist(pkg-resources)
For packages using python-distutils-extra.
See https://bugzilla.redhat.com/show_bug.cgi?id=2378463#c2
This bug existed from the very beginning of the %pyproject_buildrequires,
but the field is almost unused in real packages, so it was not noticed until
we asked all Python packages to be ported to the new macros.
---
I considered flattening the structure returned from requires_from_parsed_metadata_file,
but then we would need to hardcode "Requires-Dist" in various source= declarations,
so I kept the structure as is.
(cherry picked from Fedora commit a4e0e04344)
This commit is contained in:
parent
07256169d8
commit
0f43efad75
@ -14,7 +14,7 @@ License: MIT
|
||||
# Increment Y and reset Z when new macros or features are added
|
||||
# Increment Z when this is a bugfix or a cosmetic change
|
||||
# Dropping support for EOL Fedoras is *not* considered a breaking change
|
||||
Version: 1.18.2
|
||||
Version: 1.18.3
|
||||
Release: 1%{?dist}
|
||||
|
||||
# Macro files
|
||||
@ -191,6 +191,11 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Jul 11 2025 Miro Hrončok <mhroncok@redhat.com> - 1.18.3-1
|
||||
- %%pyproject_buildrequires: Do not generate BuildRequires from Requires core metadata fields
|
||||
- That field is deprecated and should include importable module names, not distribution packages
|
||||
- Related: rhbz#2378463
|
||||
|
||||
* Mon May 19 2025 Maxwell G <maxwell@gtmx.me> - 1.18.2-1
|
||||
- Fix handling of config_settings in %%pyproject_buildrequires
|
||||
|
||||
|
||||
@ -309,7 +309,7 @@ def parse_metadata_file(metadata_file):
|
||||
|
||||
|
||||
def requires_from_parsed_metadata_file(message):
|
||||
return {k: message.get_all(k, ()) for k in ('Requires', 'Requires-Dist')}
|
||||
return {k: message.get_all(k, ()) for k in ('Requires-Dist',)}
|
||||
|
||||
|
||||
def package_name_from_parsed_metadata_file(message):
|
||||
|
||||
@ -1608,3 +1608,23 @@ tox with dependency_groups:
|
||||
python3dist(pytest) >= 5
|
||||
python3dist(pytest-mock)
|
||||
result: 0
|
||||
|
||||
Plain Requires fields in core metadata is ignored:
|
||||
installed:
|
||||
setuptools: 50
|
||||
wheel: 1
|
||||
include_runtime: true
|
||||
setup.py: |
|
||||
from setuptools import setup
|
||||
setup(
|
||||
name='test',
|
||||
version='0.1',
|
||||
requires=['ignore_me'],
|
||||
)
|
||||
expected:
|
||||
- | # setuptools 70+
|
||||
python3dist(setuptools) >= 40.8
|
||||
- | # setuptools < 70
|
||||
python3dist(setuptools) >= 40.8
|
||||
python3dist(wheel)
|
||||
result: 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user