From 1c4a4e6fe44fb6c7d6be6309e557b778b46b4c23 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 13 Mar 2024 23:04:48 -0400 Subject: [PATCH] in pep517 build default compatibility to off instead of always specifying (#1992) * in pep517 build default compatibility to off instead of always specifying * fix * Update __init__.py * Update Changelog.md * Update maturin/__init__.py --------- Co-authored-by: messense --- Changelog.md | 4 ++++ maturin/__init__.py | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Changelog.md b/Changelog.md index 65e5d053..55c3c0db 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 3b2fa1e7..b7482159 100644 --- a/maturin/__init__.py +++ b/maturin/__init__.py @@ -63,22 +63,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()