From fc62c3a7b74dcd29eb2050f8e2a7aa439425c42e Mon Sep 17 00:00:00 2001 From: Ken Micklas Date: Fri, 25 Mar 2022 11:46:11 -0400 Subject: [PATCH] Remove repo fetch-time uname dependency, use new os.arch instead --- toolchain/defs.bzl | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl index 810db50..840976d 100644 --- a/toolchain/defs.bzl +++ b/toolchain/defs.bzl @@ -221,17 +221,14 @@ _ZIG_TOOLS = [ ] def _zig_repository_impl(repository_ctx): - res = repository_ctx.execute(["uname", "-m"]) - if res.return_code != 0: - fail("failed to run uname -m") - arch = res.stdout.strip() + arch = repository_ctx.os.arch + if arch == "amd64": + arch = "x86_64" - os = "linux" - if repository_ctx.os.name.lower().startswith("mac os"): + os = repository_ctx.os.name.lower() + if os.startswith("mac os"): os = "macos" - if arch == "arm64": - # uname -m reports arm64 on an M1 Mac. - arch = "aarch64" + host_platform = "{}-{}".format(os, arch) zig_include_root = repository_ctx.attr.host_platform_include_root[host_platform]