bazelisk icon indicating copy to clipboard operation
bazelisk copied to clipboard

bazelisk.py does not support M1 arm architecture

Open chadxzs opened this issue 3 years ago • 1 comments

Hello!

Thank you for the bazelisk project. We use it at Sotheby's and appreciate it.

Our devs have been slowly beginning to use M1 Macs for development and we have noticed that the bazelisk.py throws an error when used on this architecture. One of our devs committed this patch to our version to work around this:

diff --git a/bazel b/bazel
index 8b47deab077..ec41048b5a5 100755
--- a/bazel
+++ b/bazel
@@ -210,26 +210,13 @@ def determine_executable_filename_suffix():
 
 
 def determine_bazel_filename(version):
-    machine = normalized_machine_arch_name()
-    if machine != "x86_64":
-        raise Exception(
-            'Unsupported machine architecture "{}". Bazel currently only supports x86_64.'.format(
-                machine
-            )
-        )
-
+    machine = platform.machine().lower()
     operating_system = get_operating_system()
 
     filename_suffix = determine_executable_filename_suffix()
     return "bazel-{}-{}-{}{}".format(version, operating_system, machine, filename_suffix)
 
 
-def normalized_machine_arch_name():
-    machine = platform.machine().lower()
-    if machine == "amd64":
-        machine = "x86_64"
-    return machine
-
 
 def determine_url(version, is_commit, bazel_filename):
     if is_commit:

We'd love to not be manually patching this in, however this feels like a shotgun approach that may not be a desirable PR. I can throw one up with this change though if you think it is good enough. Thoughts?

chadxzs avatar Jan 24 '22 15:01 chadxzs

Alternatively, should we instead be thinking about how to move away from bazelisk.py? Is it deprecated?

chadxzs avatar Jan 26 '22 19:01 chadxzs