feat: support GraalPy (#1538)

* Properly close files used for testing

* Add support for GraalPy

* Help GraalPy discover build tools on Windows

* Expect manylinux-interpreters ensure graalpy* warning in pip

* Workaround GraalPy bugs on Windows

* Workaround oracle/graalpython#491 also when uv is not available

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* refacotor: use pathlib.write_text

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Include GraalPy in docker_warmup and remove workaround for installing it late

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
This commit is contained in:
Tim Felgentreff
2025-04-28 18:25:17 -04:00
committed by GitHub
co-authored by pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Henry Schreiner
parent 5f8d06ff55
commit 020a91baa8
22 changed files with 287 additions and 38 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ def test_linux_container_split(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
manylinux-x86_64-image = "normal_container_image"
manylinux-i686-image = "normal_container_image"
build = "*-manylinux_x86_64"
skip = "pp*"
skip = "[gp]p*"
archs = "x86_64 i686"
[[tool.cibuildwheel.overrides]]
+7 -5
View File
@@ -423,9 +423,9 @@ def test_debug_traceback(monkeypatch, method, capfd):
@pytest.mark.parametrize("method", ["unset", "command_line", "env_var"])
def test_enable(method, intercepted_build_args, monkeypatch):
if method == "command_line":
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "pypy"])
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "pypy", "--enable", "graalpy"])
elif method == "env_var":
monkeypatch.setenv("CIBW_ENABLE", "pypy")
monkeypatch.setenv("CIBW_ENABLE", "pypy graalpy")
main()
@@ -434,18 +434,20 @@ def test_enable(method, intercepted_build_args, monkeypatch):
if method == "unset":
assert enable_groups == frozenset()
else:
assert enable_groups == frozenset([EnableGroup.PyPy])
assert enable_groups == frozenset([EnableGroup.PyPy, EnableGroup.GraalPy])
def test_enable_arg_inherits(intercepted_build_args, monkeypatch):
monkeypatch.setenv("CIBW_ENABLE", "pypy")
monkeypatch.setenv("CIBW_ENABLE", "pypy graalpy")
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "cpython-prerelease"])
main()
enable_groups = intercepted_build_args.args[0].globals.build_selector.enable
assert enable_groups == frozenset((EnableGroup.PyPy, EnableGroup.CPythonPrerelease))
assert enable_groups == frozenset(
(EnableGroup.PyPy, EnableGroup.GraalPy, EnableGroup.CPythonPrerelease)
)
def test_enable_arg_error_message(monkeypatch, capsys):
+11 -5
View File
@@ -14,7 +14,7 @@ from cibuildwheel.oci_container import OCIPlatform
from cibuildwheel.util import file
DEFAULT_IDS = {"cp38", "cp39", "cp310", "cp311", "cp312", "cp313"}
ALL_IDS = DEFAULT_IDS | {"cp313t", "pp38", "pp39", "pp310", "pp311"}
ALL_IDS = DEFAULT_IDS | {"cp313t", "pp38", "pp39", "pp310", "pp311", "gp242"}
@pytest.fixture
@@ -103,7 +103,7 @@ def test_build_with_override_launches(monkeypatch, tmp_path):
[tool.cibuildwheel]
manylinux-x86_64-image = "manylinux_2_28"
musllinux-x86_64-image = "musllinux_1_2"
enable = ["pypy", "cpython-freethreading"]
enable = ["pypy", "graalpy", "cpython-freethreading"]
# Before Python 3.10, use manylinux2014
[[tool.cibuildwheel.overrides]]
@@ -155,6 +155,7 @@ before-all = "true"
"pp39",
"pp310",
"pp311",
"gp242",
}
}
assert kwargs["options"].build_options("cp39-manylinux_x86_64").before_all == ""
@@ -176,6 +177,7 @@ before-all = "true"
"pp39",
"pp310",
"pp311",
"gp242",
]
}
@@ -185,14 +187,16 @@ before-all = "true"
assert kwargs["container"]["oci_platform"] == OCIPlatform.i386
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {f"{x}-manylinux_i686" for x in ALL_IDS}
assert identifiers == {f"{x}-manylinux_i686" for x in ALL_IDS if "gp" not in x}
kwargs = build_in_container.call_args_list[4][1]
assert "quay.io/pypa/musllinux_1_2_x86_64" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert kwargs["container"]["oci_platform"] == OCIPlatform.AMD64
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {f"{x}-musllinux_x86_64" for x in ALL_IDS if "pp" not in x}
assert identifiers == {
f"{x}-musllinux_x86_64" for x in ALL_IDS if "pp" not in x and "gp" not in x
}
kwargs = build_in_container.call_args_list[5][1]
assert "quay.io/pypa/musllinux_1_2_i686" in kwargs["container"]["image"]
@@ -200,4 +204,6 @@ before-all = "true"
assert kwargs["container"]["oci_platform"] == OCIPlatform.i386
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {f"{x}-musllinux_i686" for x in ALL_IDS if "pp" not in x}
assert identifiers == {
f"{x}-musllinux_i686" for x in ALL_IDS if "pp" not in x and "gp" not in x
}