Skip to content

Commit 8f044b2

Browse files
build_sdk.py: host targets cleanup
Signed-off-by: Ivan Velickovic <i.velickovic@unsw.edu.au>
1 parent 7d781b1 commit 8f044b2

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

build_sdk.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -477,22 +477,29 @@ def tar_filter(tarinfo: TarInfo) -> TarInfo:
477477
return tarinfo
478478

479479

480+
SUPPORTED_HOST_TARGETS = {
481+
"linux-x86-64": "x86_64-unknown-linux-musl",
482+
"linux-aarch64": "aarch64-unknown-linux-musl",
483+
"macos-aarch64": "aarch64-apple-darwin",
484+
"macos-x86-64": "x86_64-apple-darwin",
485+
}
486+
480487
def get_tool_target_triple() -> str:
481488
host_system = host_platform.system()
482489
if host_system == "Linux":
483490
host_arch = host_platform.machine()
484491
if host_arch == "x86_64":
485-
return "x86_64-unknown-linux-musl"
492+
return SUPPORTED_HOST_TARGETS["linux-x86-64"]
486493
elif host_arch == "aarch64":
487-
return "aarch64-unknown-linux-musl"
494+
return SUPPORTED_HOST_TARGETS["linux-aarch64"]
488495
else:
489496
raise Exception(f"Unexpected Linux architecture: {host_arch}")
490497
elif host_system == "Darwin":
491498
host_arch = host_platform.machine()
492499
if host_arch == "x86_64":
493-
return "x86_64-apple-darwin"
500+
return SUPPORTED_HOST_TARGETS["macos-x86-64"]
494501
elif host_arch == "arm64":
495-
return "aarch64-apple-darwin"
502+
return SUPPORTED_HOST_TARGETS["macos-aarch64"]
496503
else:
497504
raise Exception(f"Unexpected Darwin architecture: {host_arch}")
498505
else:
@@ -952,14 +959,8 @@ def main() -> None:
952959
for filename in filenames:
953960
tar.add(filename, arcname=source_prefix / filename, filter=tar_filter)
954961

955-
RELEASE_TARGETS = [
956-
("linux-aarch64", "aarch64-unknown-linux-musl"),
957-
("linux-x86-64", "x86_64-unknown-linux-musl"),
958-
("macos-aarch64", "aarch64-apple-darwin"),
959-
("macos-x86-64", "x86_64-apple-darwin"),
960-
]
961962
if args.release_packaging:
962-
for (target, tool_target) in RELEASE_TARGETS:
963+
for (target, tool_target) in SUPPORTED_HOST_TARGETS.items():
963964
dest = Path("release") / f"{NAME}-sdk-{version}-{target}"
964965
dest.parent.mkdir(exist_ok=True, parents=True)
965966
dest.unlink(missing_ok=True)

0 commit comments

Comments
 (0)