Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not use uv to setup python on windows when conditions are not met #2005

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,23 @@ def install_pypy(tmp: Path, url: str) -> Path:
return installation_path / "bin" / "pypy3"


def can_use_uv(python_configuration: PythonConfiguration) -> bool:
conditions = (Version(python_configuration.version) >= Version("3.8"),)
return all(conditions)
Czaki marked this conversation as resolved.
Show resolved Hide resolved


def setup_python(
tmp: Path,
python_configuration: PythonConfiguration,
dependency_constraint_flags: Sequence[PathOrStr],
environment: ParsedEnvironment,
build_frontend: BuildFrontendName,
) -> tuple[Path, dict[str, str]]:
if build_frontend == "build[uv]" and Version(python_configuration.version) < Version("3.8"):
if build_frontend == "build[uv]" and not can_use_uv(python_configuration):
build_frontend = "build"

uv_path = find_uv()
use_uv = build_frontend == "build[uv]" and Version(python_configuration.version) >= Version(
"3.8"
)
use_uv = build_frontend == "build[uv]"

tmp.mkdir()
implementation_id = python_configuration.identifier.split("-")[0]
Expand Down Expand Up @@ -415,9 +418,7 @@ def build(options: Options, tmp_path: Path) -> None:
for config in python_configurations:
build_options = options.build_options(config.identifier)
build_frontend = build_options.build_frontend or BuildFrontendConfig("pip")
use_uv = build_frontend.name == "build[uv]" and Version(config.version) >= Version(
"3.8"
)
use_uv = build_frontend.name == "build[uv]" and can_use_uv(config)
uv_path = find_uv()
if use_uv and uv_path is None:
msg = "uv not found"
Expand Down
23 changes: 13 additions & 10 deletions cibuildwheel/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,14 @@ def setup_rust_cross_compile(
)


def can_use_uv(python_configuration: PythonConfiguration) -> bool:
conditions = (
Version(python_configuration.version) >= Version("3.8"),
not python_configuration.identifier.startswith("pp38-"),
)
return all(conditions)


def setup_python(
tmp: Path,
python_configuration: PythonConfiguration,
Expand Down Expand Up @@ -254,11 +262,10 @@ def setup_python(
raise ValueError(msg)
assert base_python.exists()

use_uv = (
build_frontend == "build[uv]"
and Version(python_configuration.version) >= Version("3.8")
and not python_configuration.identifier.startswith("pp38-")
)
if build_frontend == "build[uv]" and not can_use_uv(python_configuration):
build_frontend = "build"

use_uv = build_frontend == "build[uv]"
uv_path = find_uv()

log.step("Setting up build environment...")
Expand Down Expand Up @@ -368,11 +375,7 @@ def build(options: Options, tmp_path: Path) -> None:
for config in python_configurations:
build_options = options.build_options(config.identifier)
build_frontend = build_options.build_frontend or BuildFrontendConfig("pip")
use_uv = (
build_frontend.name == "build[uv]"
and Version(config.version) >= Version("3.8")
and not config.identifier.startswith("pp38-")
)
use_uv = build_frontend.name == "build[uv]" and can_use_uv(config)
log.build_start(config.identifier)

identifier_tmp_dir = tmp_path / config.identifier
Expand Down
Loading