Commit ce90b56d authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[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/+/2754407Reviewed-by: 's avatarIgor 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}
parent 220e68c0
...@@ -214,6 +214,11 @@ def _Notify(summary, body): ...@@ -214,6 +214,11 @@ def _Notify(summary, body):
else: else:
print("{} - {}".format(summary, body)) 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): def GetPath(arch, mode):
subdir = "%s.%s" % (arch, mode) subdir = "%s.%s" % (arch, mode)
return os.path.join(OUTDIR, subdir) return os.path.join(OUTDIR, subdir)
...@@ -246,10 +251,10 @@ class Config(object): ...@@ -246,10 +251,10 @@ class Config(object):
cpu = "arm" cpu = "arm"
elif self.arch == "android_arm64": elif self.arch == "android_arm64":
cpu = "arm64" cpu = "arm64"
elif self.arch == "arm64" and os.uname().machine == "aarch64": elif self.arch == "arm64" and _GetMachine() == "aarch64":
# arm64 build host: # arm64 build host:
cpu = "arm64" cpu = "arm64"
elif self.arch == "arm" and os.uname().machine == "aarch64": elif self.arch == "arm" and _GetMachine() == "aarch64":
cpu = "arm" cpu = "arm"
elif "64" in self.arch or self.arch == "s390x": elif "64" in self.arch or self.arch == "s390x":
# Native x64 or simulator build. # Native x64 or simulator build.
...@@ -274,7 +279,7 @@ class Config(object): ...@@ -274,7 +279,7 @@ class Config(object):
return [] return []
def GetSpecialCompiler(self): def GetSpecialCompiler(self):
if os.uname().machine == "aarch64": if _GetMachine() == "aarch64":
# We have no prebuilt Clang for arm64. Use the system Clang instead. # We have no prebuilt Clang for arm64. Use the system Clang instead.
return ["clang_base_path = \"/usr\"", "clang_use_chrome_plugins = false"] return ["clang_base_path = \"/usr\"", "clang_use_chrome_plugins = false"]
return [] return []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment