| 20 | |
| 21 | |
| 22 | def _platform_arch() -> tuple[str, str]: |
| 23 | if sys_platform := sys.platform: |
| 24 | if sys_platform == "win32": |
| 25 | platform = "win32" |
| 26 | elif sys_platform == "darwin": |
| 27 | platform = "darwin" |
| 28 | else: |
| 29 | platform = "linux" |
| 30 | else: |
| 31 | platform = "linux" |
| 32 | |
| 33 | machine = os.uname().machine.lower() if hasattr(os, "uname") else "amd64" |
| 34 | if machine in ("x86_64", "amd64"): |
| 35 | arch = "x64" |
| 36 | elif machine in ("arm64", "aarch64"): |
| 37 | arch = "arm64" |
| 38 | else: |
| 39 | raise RuntimeError(f"Unsupported architecture for esbuild: {machine}") |
| 40 | return platform, arch |
| 41 | |
| 42 | |
| 43 | def _tarball_url(platform: str, arch: str) -> str: |