Skip to content

Commit

Permalink
fix: specify full path to non-venv Python (#1881)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Jun 13, 2024
1 parent 405a475 commit 70fb1c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions cibuildwheel/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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}"]
Expand Down

0 comments on commit 70fb1c4

Please sign in to comment.