feat(python): support macOS x64 runtime wheels

This commit is contained in:
fz
2026-09-03 11:16:34 +08:00
parent 427d210b5e
commit 7dcdcc2965
23 changed files with 181 additions and 63 deletions
@@ -16,8 +16,15 @@ checker = SimpleNamespace(**runpy.run_path(str(SCRIPT)))
def test_otool_parser_uses_the_newest_macho_slice() -> None:
output = """
Load command 8
cmd LC_VERSION_MIN_MACOSX
cmdsize 16
version 10.7
sdk 11.1
Load command 9
cmd LC_BUILD_VERSION
minos 11.0
Load command 10
cmd LC_BUILD_VERSION
minos 13.5
"""
@@ -26,12 +33,34 @@ def test_otool_parser_uses_the_newest_macho_slice() -> None:
def test_otool_parser_requires_a_deployment_target() -> None:
with pytest.raises(ValueError, match="contains no LC_BUILD_VERSION"):
with pytest.raises(ValueError, match="contains no macOS deployment target"):
checker.parse_otool_deployment_target("Load command 0\n")
def test_otool_parser_ignores_unrelated_version_fields() -> None:
output = """
Load command 1
cmd LC_ID_DYLIB
cmdsize 48
current version 14.1.0
compatibility version 1.0.0
"""
with pytest.raises(ValueError, match="contains no macOS deployment target"):
checker.parse_otool_deployment_target(output)
def test_wheel_tag_rejects_a_newer_executable_target() -> None:
checker.ensure_compatible(Path("runtime"), (13, 5), "macosx_14_0_arm64")
checker.ensure_compatible(Path("runtime-x64"), (10, 7), "macosx_14_0_x86_64")
with pytest.raises(RuntimeError, match="requires macOS 14.1"):
checker.ensure_compatible(Path("spawn-helper"), (14, 1), "macosx_14_0_arm64")
def test_wheel_tag_accepts_only_supported_macos_architectures() -> None:
assert checker.claimed_version("macosx_14_0_arm64") == (14, 0)
assert checker.claimed_version("macosx_14_0_x86_64") == (14, 0)
with pytest.raises(ValueError, match="unsupported macOS wheel platform tag"):
checker.claimed_version("macosx_14_0_universal2")
+3 -1
View File
@@ -60,6 +60,8 @@ def test_pep440_version_spells_a_prerelease_the_python_way() -> None:
def test_macos_wheel_tag_does_not_claim_unsupported_node_platforms() -> None:
assert build_python_release.PLATFORMS["macos-arm64"][0] == "macosx_14_0_arm64"
assert build_python_release.PLATFORMS["macos-arm64"][1] == "deepseek-harness-sdk-runtime-macos-arm64"
assert build_python_release.PLATFORMS["macos-x64"][0] == "macosx_14_0_x86_64"
assert build_python_release.PLATFORMS["macos-x64"][1] == "deepseek-harness-sdk-runtime-macos-x64"
def test_windows_wheel_tag_and_payload_are_x64_only() -> None:
@@ -95,7 +97,7 @@ def test_stage_sdk_keeps_distribution_module_and_runtime_pin_distinct(tmp_path:
@pytest.mark.parametrize(
("target", "with_helper"),
[("linux-x64", False), ("macos-arm64", True), ("win-x64.exe", False)],
[("linux-x64", False), ("macos-arm64", True), ("macos-x64", True), ("win-x64.exe", False)],
)
def test_stage_runtime_copies_platform_payload(
tmp_path: Path, target: str, with_helper: bool
+2 -3
View File
@@ -79,12 +79,11 @@ def test_current_platform_supports_windows_x64_only(monkeypatch: pytest.MonkeyPa
runtime._current_platform_tag()
def test_current_platform_rejects_macos_x64(monkeypatch: pytest.MonkeyPatch) -> None:
def test_current_platform_supports_macos_x64(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(runtime.sys, "platform", "darwin")
monkeypatch.setattr(runtime.platform, "machine", lambda: "x86_64")
with pytest.raises(FileNotFoundError, match="macOS arm64"):
runtime._current_platform_tag()
assert runtime._current_platform_tag() == "macos-x64"
def test_runtime_requires_ripgrep_sidecar(