fix: change to the iOS testing option semantics (#2363)
* Change to the iOS testing option semantics Don't assume the presence of `python -m` in the test command. Less magic and allows more option reuse between platforms. * Update schema * Add a test for this warning * Don't try to execute a test-command when it doesn't look like a module * Update docs/options.md Co-authored-by: Malcolm Smith <smith@chaquo.com> * Only allow invalid test command if the first part is 'pytest' * Responses to code review from @freakboy3742 * Fixes post-merge --------- Co-authored-by: Malcolm Smith <smith@chaquo.com>
This commit is contained in:
co-authored by
Malcolm Smith
parent
1bc7e904b8
commit
898f0a45c1
+44
-16
@@ -167,8 +167,10 @@ def expected_wheels(
|
||||
package_version: str,
|
||||
manylinux_versions: list[str] | None = None,
|
||||
musllinux_versions: list[str] | None = None,
|
||||
macosx_deployment_target: str = "10.9",
|
||||
macosx_deployment_target: str | None = None,
|
||||
iphoneos_deployment_target: str | None = None,
|
||||
machine_arch: str | None = None,
|
||||
platform: str | None = None,
|
||||
python_abi_tags: list[str] | None = None,
|
||||
include_universal2: bool = False,
|
||||
single_python: bool = False,
|
||||
@@ -177,14 +179,22 @@ def expected_wheels(
|
||||
"""
|
||||
Returns the expected wheels from a run of cibuildwheel.
|
||||
"""
|
||||
platform = platform or get_platform()
|
||||
|
||||
if machine_arch is None:
|
||||
machine_arch = pm.machine()
|
||||
if get_platform() == "linux":
|
||||
if platform == "linux":
|
||||
machine_arch = arch_name_for_linux(machine_arch)
|
||||
|
||||
if macosx_deployment_target is None:
|
||||
macosx_deployment_target = os.environ.get("MACOSX_DEPLOYMENT_TARGET", "10.9")
|
||||
|
||||
if iphoneos_deployment_target is None:
|
||||
iphoneos_deployment_target = os.environ.get("IPHONEOS_DEPLOYMENT_TARGET", "13.0")
|
||||
|
||||
architectures = [machine_arch]
|
||||
if not single_arch:
|
||||
if get_platform() == "linux":
|
||||
if platform == "linux":
|
||||
if machine_arch == "x86_64":
|
||||
architectures.append("i686")
|
||||
elif (
|
||||
@@ -193,22 +203,24 @@ def expected_wheels(
|
||||
and _AARCH64_CAN_RUN_ARMV7
|
||||
):
|
||||
architectures.append("armv7l")
|
||||
elif get_platform() == "windows" and machine_arch == "AMD64":
|
||||
elif platform == "windows" and machine_arch == "AMD64":
|
||||
architectures.append("x86")
|
||||
|
||||
return [
|
||||
wheel
|
||||
for architecture in architectures
|
||||
for wheel in _expected_wheels(
|
||||
package_name,
|
||||
package_version,
|
||||
architecture,
|
||||
manylinux_versions,
|
||||
musllinux_versions,
|
||||
macosx_deployment_target,
|
||||
python_abi_tags,
|
||||
include_universal2,
|
||||
single_python,
|
||||
package_name=package_name,
|
||||
package_version=package_version,
|
||||
machine_arch=architecture,
|
||||
manylinux_versions=manylinux_versions,
|
||||
musllinux_versions=musllinux_versions,
|
||||
macosx_deployment_target=macosx_deployment_target,
|
||||
iphoneos_deployment_target=iphoneos_deployment_target,
|
||||
platform=platform,
|
||||
python_abi_tags=python_abi_tags,
|
||||
include_universal2=include_universal2,
|
||||
single_python=single_python,
|
||||
)
|
||||
]
|
||||
|
||||
@@ -220,6 +232,8 @@ def _expected_wheels(
|
||||
manylinux_versions: list[str] | None,
|
||||
musllinux_versions: list[str] | None,
|
||||
macosx_deployment_target: str,
|
||||
iphoneos_deployment_target: str,
|
||||
platform: str,
|
||||
python_abi_tags: list[str] | None,
|
||||
include_universal2: bool,
|
||||
single_python: bool,
|
||||
@@ -227,8 +241,6 @@ def _expected_wheels(
|
||||
"""
|
||||
Returns a list of expected wheels from a run of cibuildwheel.
|
||||
"""
|
||||
platform = get_platform()
|
||||
|
||||
# per PEP 425 (https://www.python.org/dev/peps/pep-0425/), wheel files shall have name of the form
|
||||
# {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl
|
||||
# {python tag} and {abi tag} are closely related to the python interpreter used to build the wheel
|
||||
@@ -249,7 +261,9 @@ def _expected_wheels(
|
||||
|
||||
if platform == "pyodide" and python_abi_tags is None:
|
||||
python_abi_tags = ["cp312-cp312"]
|
||||
if python_abi_tags is None:
|
||||
elif platform == "ios" and python_abi_tags is None:
|
||||
python_abi_tags = ["cp313-cp313"]
|
||||
elif python_abi_tags is None:
|
||||
python_abi_tags = [
|
||||
"cp38-cp38",
|
||||
"cp39-cp39",
|
||||
@@ -353,6 +367,20 @@ def _expected_wheels(
|
||||
if include_universal2:
|
||||
platform_tags.append(f"macosx_{min_macosx.replace('.', '_')}_universal2")
|
||||
|
||||
elif platform == "ios":
|
||||
if machine_arch == "x86_64":
|
||||
platform_tags = [
|
||||
f"ios_{iphoneos_deployment_target.replace('.', '_')}_x86_64_iphonesimulator"
|
||||
]
|
||||
elif machine_arch == "arm64":
|
||||
platform_tags = [
|
||||
f"ios_{iphoneos_deployment_target.replace('.', '_')}_arm64_iphoneos",
|
||||
f"ios_{iphoneos_deployment_target.replace('.', '_')}_arm64_iphonesimulator",
|
||||
]
|
||||
else:
|
||||
msg = f"Unsupported architecture {machine_arch!r} for iOS"
|
||||
raise Exception(msg)
|
||||
|
||||
elif platform == "pyodide":
|
||||
platform_tags = ["pyodide_2024_0_wasm32"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user