From 70fb1c4a1a92c1d7bb1756a4326adeeae31af60b Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 13 Jun 2024 02:18:09 -0400 Subject: [PATCH] fix: specify full path to non-venv Python (#1881) Signed-off-by: Henry Schreiner --- cibuildwheel/macos.py | 8 ++++---- cibuildwheel/windows.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index c07574df2..d51feedb9 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -201,7 +201,7 @@ def setup_python( dependency_constraint_flags: Sequence[PathOrStr], environment: ParsedEnvironment, build_frontend: BuildFrontendName, -) -> dict[str, str]: +) -> tuple[Path, dict[str, str]]: if build_frontend == "build[uv]" and Version(python_configuration.version) < Version("3.8"): build_frontend = "build" @@ -388,7 +388,7 @@ def setup_python( else: assert_never(build_frontend) - return env + return base_python, env def build(options: Options, tmp_path: Path) -> None: @@ -442,7 +442,7 @@ def build(options: Options, tmp_path: Path) -> None: build_options.dependency_constraints.get_for_python_version(config.version), ] - env = setup_python( + base_python, env = setup_python( identifier_tmp_dir / "build", config, dependency_constraint_flags, @@ -658,7 +658,7 @@ def build(options: Options, tmp_path: Path) -> None: if use_uv: pip_install = functools.partial(call, *pip, "install", *uv_arch_args) - call("uv", "venv", venv_dir, "--python=python", env=env) + call("uv", "venv", venv_dir, f"--python={base_python}", env=env) else: pip_install = functools.partial(call_with_arch, *pip, "install") # Use pip version from the initial env to ensure determinism diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 010657e6e..a3da550db 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -223,7 +223,7 @@ def setup_python( dependency_constraint_flags: Sequence[PathOrStr], environment: ParsedEnvironment, build_frontend: BuildFrontendName, -) -> dict[str, str]: +) -> tuple[Path, dict[str, str]]: tmp.mkdir() implementation_id = python_configuration.identifier.split("-")[0] python_libs_base = None @@ -330,7 +330,7 @@ def setup_python( setup_setuptools_cross_compile(tmp, python_configuration, python_libs_base, env) setup_rust_cross_compile(tmp, python_configuration, python_libs_base, env) - return env + return base_python, env def build(options: Options, tmp_path: Path) -> None: @@ -376,7 +376,7 @@ def build(options: Options, tmp_path: Path) -> None: ] # install Python - env = setup_python( + base_python, env = setup_python( identifier_tmp_dir / "build", config, dependency_constraint_flags, @@ -502,7 +502,7 @@ def build(options: Options, tmp_path: Path) -> None: venv_dir = identifier_tmp_dir / "venv-test" if use_uv: - call("uv", "venv", venv_dir, "--python=python", env=env) + call("uv", "venv", venv_dir, f"--python={base_python}", env=env) else: # Use pip version from the initial env to ensure determinism venv_args = ["--no-periodic-update", f"--pip={pip_version}"]