Add pyodide-build as a separate build frontend and update its build verbosity handling (#2609)

This commit is contained in:
Agriya Khetarpal
2026-06-22 00:12:15 +05:30
committed by GitHub
parent 291be6a345
commit 7933323184
16 changed files with 200 additions and 25 deletions
+5 -5
View File
@@ -157,8 +157,8 @@ def build_frontend_env_nouv(request: pytest.FixtureRequest) -> dict[str, str]:
marks = {m.name for m in request.node.iter_markers()}
platform = "pyodide" if "pyodide" in marks else get_platform()
if platform == "pyodide" and frontend == "pip":
pytest.skip("Can't use pip as build frontend for pyodide platform")
if platform == "pyodide":
pytest.skip("pyodide only supports the pyodide-build frontend")
return {"CIBW_BUILD_FRONTEND": frontend}
@@ -176,10 +176,10 @@ def build_frontend_env(request: pytest.FixtureRequest) -> Generator[dict[str, st
else:
platform = get_platform()
if platform in {"pyodide", "ios", "android"} and frontend == "pip":
if platform == "pyodide":
pytest.skip("pyodide only supports the pyodide-build frontend")
if platform in {"ios", "android"} and frontend == "pip":
pytest.skip(f"Can't use pip as build frontend for {platform}")
if platform == "pyodide" and frontend in {"build[uv]", "uv"}:
pytest.skip("Can't use uv with pyodide yet")
uv_path = find_uv()
if uv_path is None and frontend in {"build[uv]", "uv"}:
pytest.skip("Can't find uv, so skipping uv tests")
+1 -1
View File
@@ -50,7 +50,7 @@ def test(tmp_path: Path) -> None:
"""python -c "import pathlib, sys; pathlib.Path('{project}/pythonversion_bb.txt').write_text(sys.version)" && """
f'''python -c "import pathlib, sys; pathlib.Path('{{project}}/pythonprefix_bb.txt').write_text({SYS_PREFIX})"'''
)
frontend = "build"
frontend = "pyodide-build" if utils.get_platform() == "pyodide" else "build"
if utils.get_platform() != "pyodide":
before_build = f"python -m pip install setuptools && {before_build}"
frontend = f"{frontend};args: --no-isolation"
+13 -3
View File
@@ -15,7 +15,17 @@ if TYPE_CHECKING:
"frontend_name",
[
pytest.param("pip", marks=utils.skip_if_pyodide("No pip for pyodide")),
"build",
pytest.param(
"build",
marks=utils.skip_if_pyodide("pyodide only supports the pyodide-build frontend"),
),
pytest.param(
"pyodide-build",
marks=pytest.mark.skipif(
utils.get_platform() != "pyodide",
reason="pyodide-build frontend is only valid on pyodide",
),
),
],
)
def test_build_frontend_args(
@@ -27,7 +37,7 @@ def test_build_frontend_args(
# the build will fail because the frontend is called with '-h' - it prints the help message
add_env = {"CIBW_BUILD_FRONTEND": f"{frontend_name}; args: -h"}
if utils.get_platform() == "pyodide":
if frontend_name == "pyodide-build":
add_env["TERM"] = "dumb" # disable color / style
add_env["NO_COLOR"] = "1"
with pytest.raises(subprocess.CalledProcessError):
@@ -40,7 +50,7 @@ def test_build_frontend_args(
if frontend_name == "pip":
assert "Usage:" in captured.out
assert "Wheel Options:" in captured.out
elif utils.get_platform() == "pyodide":
elif frontend_name == "pyodide-build":
assert "Usage: pyodide build" in captured.out
else:
assert "usage:" in captured.out