[gm.py] Fix Python2 compatibility

The recent arm64 improvements unintentionally required Python3.

No-Try: true
Change-Id: Ide94ea99cb69c530b3896e6577bd0b536e5374c9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2754407
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73365}
This commit is contained in:
Jakob Kummerow 2021-03-11 22:30:37 +01:00 committed by Commit Bot
parent 220e68c0fb
commit ce90b56d65

View File

@ -214,6 +214,11 @@ def _Notify(summary, body):
else:
print("{} - {}".format(summary, body))
def _GetMachine():
# Once we migrate to Python3, this can use os.uname().machine.
# The index-based access is compatible with all Python versions.
return os.uname()[4]
def GetPath(arch, mode):
subdir = "%s.%s" % (arch, mode)
return os.path.join(OUTDIR, subdir)
@ -246,10 +251,10 @@ class Config(object):
cpu = "arm"
elif self.arch == "android_arm64":
cpu = "arm64"
elif self.arch == "arm64" and os.uname().machine == "aarch64":
elif self.arch == "arm64" and _GetMachine() == "aarch64":
# arm64 build host:
cpu = "arm64"
elif self.arch == "arm" and os.uname().machine == "aarch64":
elif self.arch == "arm" and _GetMachine() == "aarch64":
cpu = "arm"
elif "64" in self.arch or self.arch == "s390x":
# Native x64 or simulator build.
@ -274,7 +279,7 @@ class Config(object):
return []
def GetSpecialCompiler(self):
if os.uname().machine == "aarch64":
if _GetMachine() == "aarch64":
# We have no prebuilt Clang for arm64. Use the system Clang instead.
return ["clang_base_path = \"/usr\"", "clang_use_chrome_plugins = false"]
return []