pyproject_buildrequires: don't pass config_settings as kwarg

PEP 517 says that the argument should be named config_settings but
pip/pyproject-hooks and other build frontends just pass it as a
positional argument, so some build backends name this argument other
things. Even though those build backends are wrong, it still makes sense
to align pyproject-rpm-macros with what the other frontends do.

Ref: https://github.com/PyO3/maturin/pull/2612
Ref: https://github.com/Rogdham/pyzstd/pull/2

(cherry picked from Fedora commit 570b5a6ee6)
This commit is contained in:
Maxwell G 2025-05-19 16:47:47 -05:00 committed by Miro Hrončok
parent a2c98f1a7f
commit a7d5f09d8e
2 changed files with 6 additions and 3 deletions

View File

@ -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.1
Version: 1.18.2
Release: 1%{?dist}
# Macro files
@ -191,6 +191,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
%changelog
* Mon May 19 2025 Maxwell G <maxwell@gtmx.me> - 1.18.2-1
- Fix handling of config_settings in %%pyproject_buildrequires
* Fri Mar 21 2025 Miro Hrončok <mhroncok@redhat.com> - 1.18.1-1
- Fix reverted conditional in %%pyproject_buildrequires -t/-e Fedora version comparison

View File

@ -299,7 +299,7 @@ def get_backend(requirements):
def generate_build_requirements(backend, requirements):
get_requires = getattr(backend, 'get_requires_for_build_wheel', None)
if get_requires:
new_reqs = get_requires(config_settings=requirements.config_settings)
new_reqs = get_requires(requirements.config_settings)
requirements.extend(new_reqs, source='get_requires_for_build_wheel')
requirements.check(source='get_requires_for_build_wheel')
@ -334,7 +334,7 @@ def generate_run_requirements_hook(backend, requirements):
'table, you can use the -p flag to read them. '
'Alternatively, use the -R flag not to generate runtime dependencies.'
)
dir_basename = prepare_metadata('.', config_settings=requirements.config_settings)
dir_basename = prepare_metadata('.', requirements.config_settings)
with open(dir_basename + '/METADATA') as metadata_file:
name, requires = package_name_and_requires_from_metadata_file(metadata_file)
for key, req in requires.items():