diff --git a/Changelog.md b/Changelog.md index 65e5d0539..55c3c0db9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ # Changelog +## [Unreleased] + +* Fix usage of `--compatibility` when run as a PEP517 backend in [#1992](https://github.com/PyO3/maturin/pull/1992) + ## [1.5.0] - 2024-03-05 * Bump metadata version from 2.1 to 2.3 in [#1965](https://github.com/PyO3/maturin/pull/1965). Source distributions created by maturin now have reliable metadata, meaning tool such as pip, uv and poetry could skip building them for version resolution. diff --git a/maturin/__init__.py b/maturin/__init__.py index 07753679f..30eda1329 100644 --- a/maturin/__init__.py +++ b/maturin/__init__.py @@ -62,22 +62,26 @@ def _build_wheel( ) -> str: # PEP 517 specifies that only `sys.executable` points to the correct # python interpreter - command = [ + base_command = [ "maturin", "pep517", "build-wheel", "-i", sys.executable, - "--compatibility", - "off", ] - command.extend(_additional_pep517_args()) + options = _additional_pep517_args() if editable: - command.append("--editable") + options.append("--editable") pep517_args = get_maturin_pep517_args(config_settings) if pep517_args: - command.extend(pep517_args) + options.extend(pep517_args) + + if "--compatibility" not in options and "--manylinux" not in options: + # default to off if not otherwise specified + options = ["--compatibility", "off", *options] + + command = [*base_command, *options] print("Running `{}`".format(" ".join(command))) sys.stdout.flush()