From dc686cf607587dd034b8bdb06606ced9d2644174 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Mon, 19 May 2025 16:17:55 -0500 Subject: [PATCH] bootstrap: fix overriden setuptools PEP 517 hooks config_settings is not supposed to have an underscore as per PEP 517. This changes the argument name to adhere to the PEP. Currently, this breaks pyproject-rpm-macros (Python build frontend used by Fedora Linux) which tries to pass a kwarg named `config_settings` and blows up. (We are considering changing pyproject-rpm-macros to pass it as a positional argument like pyproject-hooks/pip does, but this fix is still valid.) Additionally, the overriden get_requires_for_* hooks still should include the values from setuptools. Older setuptools versions include "wheel" here, for example. --- maturin/bootstrap.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/maturin/bootstrap.py b/maturin/bootstrap.py index 0ab10b65e..f56423d11 100644 --- a/maturin/bootstrap.py +++ b/maturin/bootstrap.py @@ -17,15 +17,23 @@ # noinspection PyUnresolvedReferences from setuptools.build_meta import * # noqa:F403 +from setuptools.build_meta import ( + get_requires_for_build_sdist as _orig_get_requires_for_build_sdist, +) +from setuptools.build_meta import ( + get_requires_for_build_wheel as _orig_get_requires_for_build_wheel, +) -def get_requires_for_build_wheel(_config_settings: dict[str, Any] | None = None) -> list[str]: +def get_requires_for_build_wheel(config_settings: dict[str, Any] | None = None) -> list[str]: + reqs = _orig_get_requires_for_build_wheel() if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"): - return ["puccinialin>=0.1,<0.2"] - return [] + reqs.append("puccinialin>=0.1,<0.2") + return reqs -def get_requires_for_build_sdist(_config_settings: dict[str, Any] | None = None) -> list[str]: +def get_requires_for_build_sdist(config_settings: dict[str, Any] | None = None) -> list[str]: + reqs = _orig_get_requires_for_build_sdist() if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"): - return ["puccinialin>=0.1,<0.2"] - return [] + reqs.append("puccinialin>=0.1,<0.2") + return reqs