Skip to content

Commit 2561489

Browse files
committed
Workaround oracle/graalpython#491 also when uv is not available
1 parent 07a0347 commit 2561489

File tree

2 files changed

+37
-12
lines changed

2 files changed

+37
-12
lines changed

cibuildwheel/platforms/windows.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -418,18 +418,6 @@ def build(options: Options, tmp_path: Path) -> None:
418418
build_options = options.build_options(config.identifier)
419419
build_frontend = build_options.build_frontend or BuildFrontendConfig("build")
420420

421-
if (
422-
config.identifier.startswith("gp")
423-
and build_frontend.name == "build"
424-
and "--no-isolation" not in build_frontend.args
425-
and "-n" not in build_frontend.args
426-
):
427-
# GraalPy fails to discover its standard library when a venv is created
428-
# from a virtualenv seeded executable. See
429-
# https://github.com/oracle/graalpython/issues/491 and remove this once
430-
# fixed upstream.
431-
build_frontend = BuildFrontendConfig("build[uv]", build_frontend.args)
432-
433421
use_uv = build_frontend.name == "build[uv]" and can_use_uv(config)
434422
log.build_start(config.identifier)
435423

@@ -482,6 +470,22 @@ def build(options: Options, tmp_path: Path) -> None:
482470
build_frontend, build_options.build_verbosity, build_options.config_settings
483471
)
484472

473+
if (
474+
config.identifier.startswith("gp")
475+
and build_frontend.name == "build"
476+
and "--no-isolation" not in extra_flags
477+
and "-n" not in extra_flags
478+
):
479+
# GraalPy fails to discover its standard library when a venv is created
480+
# from a virtualenv seeded executable. See
481+
# https://github.com/oracle/graalpython/issues/491 and remove this once
482+
# fixed upstream.
483+
log.notice(
484+
"Disabling build isolation to workaround GraalPy bug. If the build fails, consider using pip or build[uv] as build frontend."
485+
)
486+
shell("graalpy -m pip install setuptools wheel", env=env)
487+
extra_flags = [*extra_flags, "-n"]
488+
485489
build_env = env.copy()
486490
if not use_uv:
487491
build_env["VIRTUALENV_PIP"] = pip_version

test/test_pep518.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,32 @@ def test_pep518(tmp_path, build_frontend_env):
3333
project_dir = tmp_path / "project"
3434
basic_project.generate(project_dir)
3535

36+
# GraalPy fails to discover its standard library when a venv is created
37+
# from a virtualenv seeded executable. See
38+
# https://github.com/oracle/graalpython/issues/491 and remove this once
39+
# fixed upstream.
40+
if (
41+
build_frontend_env["CIBW_BUILD_FRONTEND"] == "build"
42+
and utils.platform == "windows"
43+
):
44+
build_frontend_env["CIBW_SKIP"] = "gp*"
45+
3646
# build the wheels
3747
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=build_frontend_env)
3848

3949
# check that the expected wheels are produced
4050
expected_wheels = utils.expected_wheels("spam", "0.1.0")
51+
52+
# GraalPy fails to discover its standard library when a venv is created
53+
# from a virtualenv seeded executable. See
54+
# https://github.com/oracle/graalpython/issues/491 and remove this once
55+
# fixed upstream.
56+
if (
57+
build_frontend_env["CIBW_BUILD_FRONTEND"] == "build"
58+
and utils.platform == "windows"
59+
):
60+
expected_wheels = [w for w in expected_wheels if "graalpy" not in w]
61+
4162
assert set(actual_wheels) == set(expected_wheels)
4263

4364
# These checks ensure an extra file is not created when using custom

0 commit comments

Comments
 (0)