diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index ae5efbdb1..67caed021 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -177,7 +177,7 @@ def _compute_platform_only(only: str) -> PlatformName: return "macos" if "win_" in only or "win32" in only: return "windows" - if "emscripten_" in only: + if "pyodide_" in only: return "pyodide" print( f"Invalid --only='{only}', must be a build selector with a known platform", diff --git a/cibuildwheel/logger.py b/cibuildwheel/logger.py index bfb872c94..105595e4c 100644 --- a/cibuildwheel/logger.py +++ b/cibuildwheel/logger.py @@ -35,7 +35,7 @@ "macosx_x86_64": "macOS x86_64", "macosx_universal2": "macOS Universal 2 - x86_64 and arm64", "macosx_arm64": "macOS arm64 - Apple Silicon", - "emscripten_3_1_32": "Pyodide v0.23.x", + "pyodide_wasm32": "Pyodide v0.23.x", } diff --git a/cibuildwheel/pyodide.py b/cibuildwheel/pyodide.py index 846ab309c..57ac1e00d 100644 --- a/cibuildwheel/pyodide.py +++ b/cibuildwheel/pyodide.py @@ -249,9 +249,13 @@ def build(options: Options, tmp_path: Path) -> None: # This environment variable tells it also to mount our temp # directory. oldmounts = "" + extra_mounts = [str(identifier_tmp_dir)] + if Path(".").resolve().is_relative_to("/tmp"): + extra_mounts.append(str(Path(".").resolve())) + if "_PYODIDE_EXTRA_MOUNTS" in env: oldmounts = env["_PYODIDE_EXTRA_MOUNTS"] + ":" - env["_PYODIDE_EXTRA_MOUNTS"] = oldmounts + str(identifier_tmp_dir) + env["_PYODIDE_EXTRA_MOUNTS"] = oldmounts + ":".join(extra_mounts) compatible_wheel = find_compatible_wheel(built_wheels, config.identifier) if compatible_wheel: diff --git a/cibuildwheel/resources/build-platforms.toml b/cibuildwheel/resources/build-platforms.toml index 424c7c442..d6e29e20c 100644 --- a/cibuildwheel/resources/build-platforms.toml +++ b/cibuildwheel/resources/build-platforms.toml @@ -118,5 +118,5 @@ python_configurations = [ [pyodide] python_configurations = [ - { identifier = "cp311-emscripten_3_1_32", version = "3.11.2", pyodide_version = "0.23.2", emscripten_version = "3.1.32" }, + { identifier = "cp311-pyodide_wasm32", version = "3.11.2", pyodide_version = "0.23.2", emscripten_version = "3.1.32" }, ] diff --git a/test/conftest.py b/test/conftest.py index 481971940..8088d278c 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,9 +1,9 @@ from __future__ import annotations -import os - import pytest +from . import utils + def pytest_addoption(parser) -> None: parser.addoption( @@ -22,6 +22,6 @@ def pytest_addoption(parser) -> None: params=[{"CIBW_BUILD_FRONTEND": "pip"}, {"CIBW_BUILD_FRONTEND": "build"}], ids=["pip", "build"] ) def build_frontend_env(request) -> dict[str, str]: - if os.environ.get("CIBW_PLATFORM", None) == "pyodide": + if utils.platform == "pyodide": pytest.skip("Can't use pip as build frontend for pyodide platform") return request.param # type: ignore[no-any-return] diff --git a/test/test_abi_variants.py b/test/test_abi_variants.py index c6ca9ed77..c35341fe6 100644 --- a/test/test_abi_variants.py +++ b/test/test_abi_variants.py @@ -167,10 +167,8 @@ def test_abi_none(tmp_path, capfd): project_dir, add_env={ "CIBW_TEST_REQUIRES": "pytest", - "CIBW_TEST_COMMAND": "pytest {project}/test", # limit the number of builds for test performance reasons - "CIBW_BUILD": "cp38-* cp311-* pp39-*", - "_PYODIDE_EXTRA_MOUNTS": str(tmp_path), + "CIBW_BUILD": "cp38-* cp310-* pp39-*", }, ) diff --git a/test/test_custom_repair_wheel.py b/test/test_custom_repair_wheel.py index e0939db41..0385c4ad3 100644 --- a/test/test_custom_repair_wheel.py +++ b/test/test_custom_repair_wheel.py @@ -2,6 +2,8 @@ import subprocess from test import test_projects +from contextlib import nullcontext as does_not_raise +import pytest from . import utils @@ -33,15 +35,18 @@ def test(tmp_path, capfd): num_builds = len(utils.cibuildwheel_get_build_identifiers(project_dir)) err = None - try: - utils.cibuildwheel_run( + if num_builds > 1: + expectation = pytest.raises(subprocess.CalledProcessError) + else: + expectation = does_not_raise() + + with expectation: + result = utils.cibuildwheel_run( project_dir, add_env={ "CIBW_REPAIR_WHEEL_COMMAND": "python repair.py {wheel} {dest_dir}", }, ) - except subprocess.CalledProcessError as e: - err = e captured = capfd.readouterr() @@ -57,3 +62,4 @@ def test(tmp_path, capfd): # error is raised assert err is None assert "spam-0.1.0-py2-none-emscripten" in captured.out + assert result[0].startswith("spam-0.1.0-py2-none-") diff --git a/test/test_subdir_package.py b/test/test_subdir_package.py index 4ea731844..900b2d97c 100644 --- a/test/test_subdir_package.py +++ b/test/test_subdir_package.py @@ -53,7 +53,6 @@ def test(capfd, tmp_path): "CIBW_TEST_COMMAND": "python {package}/test/run_tests.py", # this shouldn't depend on the version of python, so build only CPython 3.11 "CIBW_BUILD": "cp311-*", - "_PYODIDE_EXTRA_MOUNTS": str(tmp_path), }, ) diff --git a/test/test_testing.py b/test/test_testing.py index 2982b04dd..1270fe4f6 100644 --- a/test/test_testing.py +++ b/test/test_testing.py @@ -85,7 +85,6 @@ def test(tmp_path): # mac/linux. "CIBW_TEST_COMMAND": "false || pytest {project}/test", "CIBW_TEST_COMMAND_WINDOWS": "COLOR 00 || pytest {project}/test", - "_PYODIDE_EXTRA_MOUNTS": str(tmp_path), }, ) @@ -107,7 +106,6 @@ def test_extras_require(tmp_path): # mac/linux. "CIBW_TEST_COMMAND": "false || pytest {project}/test", "CIBW_TEST_COMMAND_WINDOWS": "COLOR 00 || pytest {project}/test", - "_PYODIDE_EXTRA_MOUNTS": str(tmp_path), }, )