feat: support uv with Android (#2587)
This commit is contained in:
+27
-7
@@ -154,19 +154,39 @@ def docker_warmup_fixture(
|
||||
@pytest.fixture(params=["pip", "build"])
|
||||
def build_frontend_env_nouv(request: pytest.FixtureRequest) -> dict[str, str]:
|
||||
frontend = request.param
|
||||
if get_platform() == "pyodide" and frontend == "pip":
|
||||
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")
|
||||
|
||||
return {"CIBW_BUILD_FRONTEND": frontend}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def build_frontend_env(build_frontend_env_nouv: dict[str, str]) -> dict[str, str]:
|
||||
frontend = build_frontend_env_nouv["CIBW_BUILD_FRONTEND"]
|
||||
if frontend != "build" or get_platform() == "pyodide" or find_uv() is None:
|
||||
return build_frontend_env_nouv
|
||||
@pytest.fixture(params=["pip", "build", "build[uv]"])
|
||||
def build_frontend_env(request: pytest.FixtureRequest) -> dict[str, str]:
|
||||
frontend = request.param
|
||||
marks = {m.name for m in request.node.iter_markers()}
|
||||
if "android" in marks:
|
||||
platform = "android"
|
||||
elif "ios" in marks:
|
||||
platform = "ios"
|
||||
elif "pyodide" in marks:
|
||||
platform = "pyodide"
|
||||
else:
|
||||
platform = get_platform()
|
||||
|
||||
return {"CIBW_BUILD_FRONTEND": "build[uv]"}
|
||||
if platform in {"pyodide", "ios", "android"} and frontend == "pip":
|
||||
pytest.skip(f"Can't use pip as build frontend for {platform}")
|
||||
if platform == "pyodide" and frontend == "build[uv]":
|
||||
pytest.skip("Can't use uv with pyodide yet")
|
||||
uv_path = find_uv()
|
||||
if uv_path is None and frontend == "build[uv]":
|
||||
pytest.skip("Can't find uv, so skipping uv tests")
|
||||
if uv_path is not None and frontend == "build" and platform not in {"android", "ios"}:
|
||||
pytest.skip("No need to check build when uv is present")
|
||||
|
||||
return {"CIBW_BUILD_FRONTEND": frontend}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@@ -118,16 +118,17 @@ def test_expected_wheels(tmp_path, spam_env):
|
||||
)
|
||||
|
||||
|
||||
def test_frontend_good(tmp_path):
|
||||
@needs_emulator
|
||||
def test_frontend_good(tmp_path, build_frontend_env):
|
||||
new_c_project().generate(tmp_path)
|
||||
wheels = cibuildwheel_run(
|
||||
tmp_path,
|
||||
add_env={**cp313_env, "CIBW_BUILD_FRONTEND": "build"},
|
||||
add_env={**cp313_env, **build_frontend_env, "CIBW_TEST_COMMAND": "python -m site"},
|
||||
)
|
||||
assert wheels == [f"spam-0.1.0-cp313-cp313-android_21_{native_arch.android_abi}.whl"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("frontend", ["build[uv]", "pip"])
|
||||
@pytest.mark.parametrize("frontend", ["pip"])
|
||||
def test_frontend_bad(frontend, tmp_path, capfd):
|
||||
new_c_project().generate(tmp_path)
|
||||
with pytest.raises(CalledProcessError):
|
||||
|
||||
Reference in New Issue
Block a user