Skip to content

Commit bd61db0

Browse files
committed
Address joerick's review comments pypa#2
1 parent 8018030 commit bd61db0

9 files changed

+22
-17
lines changed

cibuildwheel/__main__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _compute_platform_only(only: str) -> PlatformName:
177177
return "macos"
178178
if "win_" in only or "win32" in only:
179179
return "windows"
180-
if "emscripten_" in only:
180+
if "pyodide_" in only:
181181
return "pyodide"
182182
print(
183183
f"Invalid --only='{only}', must be a build selector with a known platform",

cibuildwheel/logger.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"macosx_x86_64": "macOS x86_64",
3636
"macosx_universal2": "macOS Universal 2 - x86_64 and arm64",
3737
"macosx_arm64": "macOS arm64 - Apple Silicon",
38-
"emscripten_3_1_32": "Pyodide v0.23.x",
38+
"pyodide_wasm32": "Pyodide v0.23.x",
3939
}
4040

4141

cibuildwheel/pyodide.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,13 @@ def build(options: Options, tmp_path: Path) -> None:
249249
# This environment variable tells it also to mount our temp
250250
# directory.
251251
oldmounts = ""
252+
extra_mounts = [str(identifier_tmp_dir)]
253+
if Path(".").resolve().is_relative_to("/tmp"):
254+
extra_mounts.append(str(Path(".").resolve()))
255+
252256
if "_PYODIDE_EXTRA_MOUNTS" in env:
253257
oldmounts = env["_PYODIDE_EXTRA_MOUNTS"] + ":"
254-
env["_PYODIDE_EXTRA_MOUNTS"] = oldmounts + str(identifier_tmp_dir)
258+
env["_PYODIDE_EXTRA_MOUNTS"] = oldmounts + ":".join(extra_mounts)
255259

256260
compatible_wheel = find_compatible_wheel(built_wheels, config.identifier)
257261
if compatible_wheel:

cibuildwheel/resources/build-platforms.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,5 @@ python_configurations = [
118118

119119
[pyodide]
120120
python_configurations = [
121-
{ identifier = "cp311-emscripten_3_1_32", version = "3.11.2", pyodide_version = "0.23.2", emscripten_version = "3.1.32" },
121+
{ identifier = "cp311-pyodide_wasm32", version = "3.11.2", pyodide_version = "0.23.2", emscripten_version = "3.1.32" },
122122
]

test/conftest.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from __future__ import annotations
22

3-
import os
4-
53
import pytest
64

5+
from . import utils
6+
77

88
def pytest_addoption(parser) -> None:
99
parser.addoption(
@@ -22,6 +22,6 @@ def pytest_addoption(parser) -> None:
2222
params=[{"CIBW_BUILD_FRONTEND": "pip"}, {"CIBW_BUILD_FRONTEND": "build"}], ids=["pip", "build"]
2323
)
2424
def build_frontend_env(request) -> dict[str, str]:
25-
if os.environ.get("CIBW_PLATFORM", None) == "pyodide":
25+
if utils.platform == "pyodide":
2626
pytest.skip("Can't use pip as build frontend for pyodide platform")
2727
return request.param # type: ignore[no-any-return]

test/test_abi_variants.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,8 @@ def test_abi_none(tmp_path, capfd):
167167
project_dir,
168168
add_env={
169169
"CIBW_TEST_REQUIRES": "pytest",
170-
"CIBW_TEST_COMMAND": "pytest {project}/test",
171170
# limit the number of builds for test performance reasons
172-
"CIBW_BUILD": "cp38-* cp311-* pp39-*",
173-
"_PYODIDE_EXTRA_MOUNTS": str(tmp_path),
171+
"CIBW_BUILD": "cp38-* cp310-* pp39-*",
174172
},
175173
)
176174

test/test_custom_repair_wheel.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import subprocess
44
from test import test_projects
5+
from contextlib import nullcontext as does_not_raise
6+
import pytest
57

68
from . import utils
79

@@ -33,15 +35,18 @@ def test(tmp_path, capfd):
3335

3436
num_builds = len(utils.cibuildwheel_get_build_identifiers(project_dir))
3537
err = None
36-
try:
37-
utils.cibuildwheel_run(
38+
if num_builds > 1:
39+
expectation = pytest.raises(subprocess.CalledProcessError)
40+
else:
41+
expectation = does_not_raise()
42+
43+
with expectation:
44+
result = utils.cibuildwheel_run(
3845
project_dir,
3946
add_env={
4047
"CIBW_REPAIR_WHEEL_COMMAND": "python repair.py {wheel} {dest_dir}",
4148
},
4249
)
43-
except subprocess.CalledProcessError as e:
44-
err = e
4550

4651
captured = capfd.readouterr()
4752

@@ -57,3 +62,4 @@ def test(tmp_path, capfd):
5762
# error is raised
5863
assert err is None
5964
assert "spam-0.1.0-py2-none-emscripten" in captured.out
65+
assert result[0].startswith("spam-0.1.0-py2-none-")

test/test_subdir_package.py

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def test(capfd, tmp_path):
5353
"CIBW_TEST_COMMAND": "python {package}/test/run_tests.py",
5454
# this shouldn't depend on the version of python, so build only CPython 3.11
5555
"CIBW_BUILD": "cp311-*",
56-
"_PYODIDE_EXTRA_MOUNTS": str(tmp_path),
5756
},
5857
)
5958

test/test_testing.py

-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def test(tmp_path):
8585
# mac/linux.
8686
"CIBW_TEST_COMMAND": "false || pytest {project}/test",
8787
"CIBW_TEST_COMMAND_WINDOWS": "COLOR 00 || pytest {project}/test",
88-
"_PYODIDE_EXTRA_MOUNTS": str(tmp_path),
8988
},
9089
)
9190

@@ -107,7 +106,6 @@ def test_extras_require(tmp_path):
107106
# mac/linux.
108107
"CIBW_TEST_COMMAND": "false || pytest {project}/test",
109108
"CIBW_TEST_COMMAND_WINDOWS": "COLOR 00 || pytest {project}/test",
110-
"_PYODIDE_EXTRA_MOUNTS": str(tmp_path),
111109
},
112110
)
113111

0 commit comments

Comments
 (0)