fix: support empty CIBW_PLATFORM (#1969)
* fix: support empty CIBW_PLATFORM Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * fix: support empty CIBW_PLATFORM * Add test --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: mayeut <mayeut@users.noreply.github.com>
This commit is contained in:
co-authored by
mayeut
parent
c6dd39bd83
commit
3580374b18
@@ -240,7 +240,7 @@ def _compute_platform_auto() -> PlatformName:
|
||||
|
||||
|
||||
def _compute_platform(args: CommandLineArguments) -> PlatformName:
|
||||
platform_option_value = args.platform or os.environ.get("CIBW_PLATFORM", "auto")
|
||||
platform_option_value = args.platform or os.environ.get("CIBW_PLATFORM", "") or "auto"
|
||||
|
||||
if args.only and args.platform is not None:
|
||||
msg = "--platform cannot be specified with --only, it is computed from --only"
|
||||
|
||||
+4
-5
@@ -23,15 +23,14 @@ EMULATED_ARCHS: Final[list[str]] = sorted(
|
||||
)
|
||||
SINGLE_PYTHON_VERSION: Final[tuple[int, int]] = (3, 12)
|
||||
|
||||
platform: str
|
||||
|
||||
if "CIBW_PLATFORM" in os.environ:
|
||||
platform = os.environ["CIBW_PLATFORM"]
|
||||
platform = os.environ.get("CIBW_PLATFORM", "")
|
||||
if platform:
|
||||
pass
|
||||
elif sys.platform.startswith("linux"):
|
||||
platform = "linux"
|
||||
elif sys.platform.startswith("darwin"):
|
||||
platform = "macos"
|
||||
elif sys.platform in ["win32", "cygwin"]:
|
||||
elif sys.platform.startswith(("win32", "cygwin")):
|
||||
platform = "windows"
|
||||
else:
|
||||
msg = f"Unsupported platform {sys.platform!r}"
|
||||
|
||||
@@ -10,7 +10,7 @@ from cibuildwheel.architecture import Architecture
|
||||
from ..conftest import MOCK_PACKAGE_DIR
|
||||
|
||||
|
||||
@pytest.mark.parametrize("option_value", [None, "auto"])
|
||||
@pytest.mark.parametrize("option_value", [None, "auto", ""])
|
||||
def test_platform_unset_or_auto(monkeypatch, intercepted_build_args, option_value):
|
||||
if option_value is None:
|
||||
monkeypatch.delenv("CIBW_PLATFORM", raising=False)
|
||||
|
||||
Reference in New Issue
Block a user