Test enable groups as specified by PR labels (#2357)
* Allow CIBW_ENABLE to control the wheels built in testing * Set CIBW_ENABLE using PR labels * Add docs * Build everything on the main branch * Add CIBW_ENABLE=all option This was mostly for use in the `main` building case, because otherwise it's maybe a bit too easy to forget to update this file when adding an enable group * Remove dead code * Make unit tests robust to the value of CIBW_ENABLE * Fix tests that explicitly choose pypy * Fix test expectation * Don't expect impossible wheels in expected_wheels * Simplify logic in expected_wheels * CircleCI- run with CIBW_ENABLE=all only on the main branch * Azure pipelines - run with CIBW_ENABLE=all on main branch * Update gitlab to run CIBW_ENABLE=all on main * Set CIBW_ENABLE=all on travis - it only runs on main anyway * Fix job name error on CircleCI * Fix tests for graalpy * Update the test configuration to use the label * Remove duplication of default value. Make it affect sample build too * Move the action to after deps are installed * GraalPy workaround for this assumption * Make unit test resilient to changing CIBW_ENABLE
This commit is contained in:
+28
-19
@@ -23,6 +23,9 @@ from cibuildwheel.util.file import CIBW_CACHE_PATH
|
||||
EMULATED_ARCHS: Final[list[str]] = sorted(
|
||||
arch.value for arch in (Architecture.all_archs("linux") - Architecture.auto_archs("linux"))
|
||||
)
|
||||
PYPY_ARCHS = ["x86_64", "i686", "AMD64", "aarch64", "arm64"]
|
||||
GRAALPY_ARCHS = ["x86_64", "AMD64", "aarch64", "arm64"]
|
||||
|
||||
SINGLE_PYTHON_VERSION: Final[tuple[int, int]] = (3, 12)
|
||||
|
||||
_AARCH64_CAN_RUN_ARMV7: Final[bool] = Architecture.aarch64.value not in EMULATED_ARCHS and {
|
||||
@@ -46,7 +49,8 @@ else:
|
||||
|
||||
|
||||
def cibuildwheel_get_build_identifiers(
|
||||
project_path: Path, env: dict[str, str] | None = None, *, prerelease_pythons: bool = False
|
||||
project_path: Path,
|
||||
env: dict[str, str] | None = None,
|
||||
) -> list[str]:
|
||||
"""
|
||||
Returns the list of build identifiers that cibuildwheel will try to build
|
||||
@@ -55,9 +59,6 @@ def cibuildwheel_get_build_identifiers(
|
||||
cmd = [sys.executable, "-m", "cibuildwheel", "--print-build-identifiers", str(project_path)]
|
||||
if env is None:
|
||||
env = os.environ.copy()
|
||||
env["CIBW_ENABLE"] = "cpython-freethreading pypy graalpy"
|
||||
if prerelease_pythons:
|
||||
env["CIBW_ENABLE"] += " cpython-prerelease"
|
||||
|
||||
cmd_output = subprocess.run(
|
||||
cmd,
|
||||
@@ -121,8 +122,6 @@ def cibuildwheel_run(
|
||||
|
||||
_update_pip_cache_dir(env)
|
||||
|
||||
env["CIBW_ENABLE"] = " ".join(EnableGroup.all_groups())
|
||||
|
||||
if single_python:
|
||||
env["CIBW_BUILD"] = "cp{}{}-*".format(*SINGLE_PYTHON_VERSION)
|
||||
|
||||
@@ -222,6 +221,8 @@ def _expected_wheels(
|
||||
# {python tag} and {abi tag} are closely related to the python interpreter used to build the wheel
|
||||
# so we'll merge them below as python_abi_tag
|
||||
|
||||
enable_groups = EnableGroup.parse_option_value(os.environ.get("CIBW_ENABLE", ""))
|
||||
|
||||
if manylinux_versions is None:
|
||||
manylinux_versions = {
|
||||
"armv7l": ["manylinux_2_17", "manylinux2014", "manylinux_2_31"],
|
||||
@@ -243,25 +244,36 @@ def _expected_wheels(
|
||||
"cp311-cp311",
|
||||
"cp312-cp312",
|
||||
"cp313-cp313",
|
||||
"cp313-cp313t",
|
||||
]
|
||||
|
||||
if machine_arch == "ARM64":
|
||||
# no CPython 3.8 on Windows ARM64
|
||||
python_abi_tags.pop(0)
|
||||
if EnableGroup.CPythonFreeThreading in enable_groups:
|
||||
python_abi_tags += [
|
||||
"cp313-cp313t",
|
||||
]
|
||||
|
||||
if machine_arch in ["x86_64", "i686", "AMD64", "aarch64", "arm64"]:
|
||||
if EnableGroup.PyPy in enable_groups:
|
||||
python_abi_tags += [
|
||||
"pp38-pypy38_pp73",
|
||||
"pp39-pypy39_pp73",
|
||||
"pp310-pypy310_pp73",
|
||||
"pp311-pypy311_pp73",
|
||||
]
|
||||
if machine_arch in ["x86_64", "AMD64", "aarch64", "arm64"]:
|
||||
|
||||
if EnableGroup.GraalPy in enable_groups:
|
||||
python_abi_tags += [
|
||||
"graalpy311-graalpy242_311_native",
|
||||
]
|
||||
|
||||
if machine_arch == "ARM64" and platform == "windows":
|
||||
# no CPython 3.8 on Windows ARM64
|
||||
python_abi_tags = [t for t in python_abi_tags if not t.startswith("cp38")]
|
||||
|
||||
if machine_arch not in PYPY_ARCHS:
|
||||
python_abi_tags = [tag for tag in python_abi_tags if not tag.startswith("pp")]
|
||||
|
||||
if machine_arch not in GRAALPY_ARCHS:
|
||||
python_abi_tags = [tag for tag in python_abi_tags if not tag.startswith("graalpy")]
|
||||
|
||||
if single_python:
|
||||
python_tag = "cp{}{}-".format(*SINGLE_PYTHON_VERSION)
|
||||
python_abi_tags = [
|
||||
@@ -272,13 +284,6 @@ def _expected_wheels(
|
||||
)
|
||||
]
|
||||
|
||||
if platform == "pyodide":
|
||||
assert len(python_abi_tags) == 1
|
||||
python_abi_tag = python_abi_tags[0]
|
||||
platform_tag = "pyodide_2024_0_wasm32"
|
||||
yield f"{package_name}-{package_version}-{python_abi_tag}-{platform_tag}.whl"
|
||||
return
|
||||
|
||||
for python_abi_tag in python_abi_tags:
|
||||
platform_tags = []
|
||||
|
||||
@@ -327,6 +332,10 @@ def _expected_wheels(
|
||||
|
||||
if include_universal2:
|
||||
platform_tags.append(f"macosx_{min_macosx.replace('.', '_')}_universal2")
|
||||
|
||||
elif platform == "pyodide":
|
||||
platform_tags = ["pyodide_2024_0_wasm32"]
|
||||
|
||||
else:
|
||||
msg = f"Unsupported platform {platform!r}"
|
||||
raise Exception(msg)
|
||||
|
||||
Reference in New Issue
Block a user