From 4bd1522a2913faa2d9fe0a125ff567401cc81135 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 11 May 2021 21:17:31 +0000 Subject: [PATCH] gclient: Stop running git under "arch" on macOS We now have an arm python binary, so this should no longer be needed. Bug: 1103326,1184767,1103236 Change-Id: I5510bf2c61adc2d0d505a886956a6677303df271 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2888957 Auto-Submit: Nico Weber Commit-Queue: Dirk Pranke Reviewed-by: Dirk Pranke --- gclient_scm.py | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/gclient_scm.py b/gclient_scm.py index ea8f7734d..dc406d57f 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -1377,22 +1377,6 @@ class GitWrapper(SCMWrapper): revision = self._Capture(['rev-parse', 'FETCH_HEAD']) return revision - def _IsRunningUnderRosetta(self): - if sys.platform != 'darwin': - return False - if self._running_under_rosetta is None: - # If we are running under Rosetta, platform.machine() is - # 'x86_64'; we need to use a sysctl to see if we're being - # translated. - import ctypes - libSystem = ctypes.CDLL("libSystem.dylib") - ret = ctypes.c_int(0) - size = ctypes.c_size_t(4) - e = libSystem.sysctlbyname(ctypes.c_char_p(b'sysctl.proc_translated'), - ctypes.byref(ret), ctypes.byref(size), None, 0) - self._running_under_rosetta = e == 0 and ret.value == 1 - return self._running_under_rosetta - def _Run(self, args, options, **kwargs): # Disable 'unused options' warning | pylint: disable=unused-argument kwargs.setdefault('cwd', self.checkout_path) @@ -1401,18 +1385,6 @@ class GitWrapper(SCMWrapper): env = scm.GIT.ApplyEnvVars(kwargs) cmd = ['git'] + args - - if self._IsRunningUnderRosetta(): - # We currently only ship an Intel Python binary in depot_tools. - # Intel binaries run under Rosetta on ARM Macs, and by default - # prefer to run their subprocesses as Intel under Rosetta too. - # Intel git running under Rosetta has a bug where it fails to - # clone src.git (rdar://7868319), so until we ship a native - # ARM python3 binary, explicitly use `arch` to let git run - # the native ARM slice instead of the Intel slice. - # TODO(thakis): Remove this again once we ship an arm64 python3 - # binary. - cmd = ['arch', '-arch', 'arm64e', '-arch', 'arm64'] + cmd gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs)