MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / Arch

Class Arch

misc/python/materialize/xcompile.py:21–49  ·  view source on GitHub ↗

A CPU architecture.

Source from the content-addressed store, hash-verified

19
20
21class Arch(Enum):
22 """A CPU architecture."""
23
24 X86_64 = "x86_64"
25 """The 64-bit x86 architecture."""
26
27 AARCH64 = "aarch64"
28 """The 64-bit ARM architecture."""
29
30 def __str__(self) -> str:
31 return self.value
32
33 def go_str(self) -> str:
34 """Return the architecture name in Go nomenclature: amd64 or arm64."""
35 if self == Arch.X86_64:
36 return "amd64"
37 elif self == Arch.AARCH64:
38 return "arm64"
39 else:
40 raise RuntimeError("unreachable")
41
42 @staticmethod
43 def host() -> "Arch":
44 if platform.machine() == "x86_64":
45 return Arch.X86_64
46 elif platform.machine() in ["aarch64", "arm64"]:
47 return Arch.AARCH64
48 else:
49 raise RuntimeError(f"unknown host architecture {platform.machine()}")
50
51
52def target(arch: Arch) -> str:

Callers 2

_parse_archMethod · 0.90
mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected