diff options
| author | Nico Weber <nicolasweber@gmx.de> | 2019-03-08 12:45:50 +0000 |
|---|---|---|
| committer | Nico Weber <nicolasweber@gmx.de> | 2019-03-08 12:45:50 +0000 |
| commit | 38e6bcc14b6b0bc56f21b224668d69204c5ae812 (patch) | |
| tree | 22d8c6c9543a1cec2102de0f009d4e9e8cc6252b /llvm/utils/gn/gn.py | |
| parent | a3c43cfd63b3d4f925dff0e51b951223a0f0cfa0 (diff) | |
| download | bcm5719-llvm-38e6bcc14b6b0bc56f21b224668d69204c5ae812.tar.gz bcm5719-llvm-38e6bcc14b6b0bc56f21b224668d69204c5ae812.zip | |
gn build: Unbreak get.py and gn.py on Windows
`os.uname()` doesn't exist on Windows, so use `platform.machine()` which
returns `os.uname()[4]` on non-Win and (on 64-bit systems) "AMD64" on Windows.
Also use `sys.platform` instead of `platform` to check for Windows-ness for the
file extension in gn.py (get.py got this right).
Differential Revision: https://reviews.llvm.org/D59115
llvm-svn: 355693
Diffstat (limited to 'llvm/utils/gn/gn.py')
| -rwxr-xr-x | llvm/utils/gn/gn.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/utils/gn/gn.py b/llvm/utils/gn/gn.py index 73f2c80fe9d..62cbaa91e07 100755 --- a/llvm/utils/gn/gn.py +++ b/llvm/utils/gn/gn.py @@ -16,7 +16,8 @@ ROOT_DIR = os.path.join(THIS_DIR, '..', '..', '..') def get_platform(): - if os.uname()[4] != 'x86_64': + import platform + if platform.machine() not in ('AMD64', 'x86_64'): return None if sys.platform.startswith('linux'): return 'linux-amd64' @@ -46,7 +47,7 @@ def main(): if not platform: return print_no_gn(mention_get=False) gn = os.path.join(os.path.dirname(__file__), 'bin', platform, 'gn') - if not os.path.exists(gn + ('.exe' if platform == 'windows' else '')): + if not os.path.exists(gn + ('.exe' if sys.platform == 'win32' else '')): return print_no_gn(mention_get=True) # Compute --dotfile= and --root= args to add. |

