fix: don't error when a global build-frontend is set on pyodide (#2945)

Since #2609, the pyodide platform required the 'pyodide-build' frontend,
but a global build-frontend setting (TOML or CIBW_BUILD_FRONTEND)
overrides the platform default, so previously-working configs like
build-frontend = "build" failed with a ConfigurationError. Even
"default" failed, since it was mapped to "build" before the check.

Resolve "default" to the platform default, and warn and use
pyodide-build when another frontend is set on pyodide, matching
pre-#2609 behavior where the frontend name only affected verbosity
flags.

Assisted-by: ClaudeCode:claude-opus-4.8
This commit is contained in:
Henry Schreiner
2026-07-23 11:40:11 -04:00
committed by GitHub
parent 1520daf8ae
commit b7cac6dfef
4 changed files with 40 additions and 12 deletions
+24 -4
View File
@@ -515,13 +515,33 @@ def test_pyodide_build_frontend_args(tmp_path: Path) -> None:
assert build_frontend.args == ["--exports=whole_archive"]
@pytest.mark.parametrize(
"build_frontend_str",
["default", "pip", "build", "build[uv]", "uv"],
)
def test_pyodide_global_build_frontend_coerced(tmp_path: Path, build_frontend_str: str) -> None:
"""A global non-pyodide frontend setting is coerced to pyodide-build, not an error."""
args = CommandLineArguments.defaults()
args.package_dir = tmp_path
tmp_path.joinpath("pyproject.toml").write_text(
textwrap.dedent(
f"""\
[tool.cibuildwheel]
build-frontend = "{build_frontend_str}"
"""
)
)
options = Options(platform="pyodide", command_line_arguments=args, env={})
build_frontend = options.build_options(identifier=None).build_frontend
assert build_frontend.name == "pyodide-build"
@pytest.mark.parametrize(
("platform", "build_frontend_str"),
[
("pyodide", "pip"),
("pyodide", "build"),
("pyodide", "build[uv]"),
("pyodide", "uv"),
("linux", "pyodide-build"),
("macos", "pyodide-build"),
("windows", "pyodide-build"),