MCPcopy
hub / github.com/astral-sh/python-build-standalone / current_host_platform

Function current_host_platform

pythonbuild/utils.py:32–53  ·  view source on GitHub ↗

Resolve the name of the current machine's host platform. This is conceptually a simplified machine triple.

()

Source from the content-addressed store, hash-verified

30
31
32def current_host_platform() -> str:
33 """Resolve the name of the current machine's host platform.
34
35 This is conceptually a simplified machine triple.
36 """
37 machine = platform.machine()
38 if sys.platform == "linux":
39 if machine == "x86_64":
40 return "linux_x86_64"
41 elif machine == "aarch64":
42 return "linux_aarch64"
43 else:
44 raise Exception(f"unsupported Linux host platform: {machine}")
45 elif sys.platform == "darwin":
46 if machine == "arm64":
47 return "macos_arm64"
48 elif machine == "x86_64":
49 return "macos_x86_64"
50 else:
51 raise Exception(f"unhanded macOS machine type: {machine}")
52 else:
53 raise Exception(f"unsupported host platform: {sys.platform}")
54
55
56def default_target_triple() -> str:

Callers 2

mainFunction · 0.90
default_target_tripleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected