about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-06-26 13:57:37 -0700
committerGitHub <noreply@github.com>2020-06-26 13:57:37 -0700
commitc18e919a79c701d25b33cffa0a183ee21085f2e6 (patch)
treeeb55419ad7c2e13549e5566effd3bf1e5978e819
parentdfbba65786279b5f73cbf26bff4f6d984cb77105 (diff)
parent8b368dbcbb1ee67553f72837b0e9893e6912a5a9 (diff)
downloadrust-c18e919a79c701d25b33cffa0a183ee21085f2e6.tar.gz
rust-c18e919a79c701d25b33cffa0a183ee21085f2e6.zip
Rollup merge of #73691 - ajpaverd:bootstrap-windows-73689, r=Mark-Simulacrum
Bootstrap: detect Windows based on sys.platform

Closes #73689.
-rw-r--r--src/bootstrap/bootstrap.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 82a755c7892..1949d70e5de 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -184,6 +184,7 @@ def default_build_triple():
     ostype = require(["uname", "-s"], exit=required)
     cputype = require(['uname', '-m'], exit=required)
 
+    # If we do not have `uname`, assume Windows.
     if ostype is None or cputype is None:
         return 'x86_64-pc-windows-msvc'
 
@@ -236,6 +237,11 @@ def default_build_triple():
         if ostype.endswith('WOW64'):
             cputype = 'x86_64'
         ostype = 'pc-windows-gnu'
+    elif sys.platform == 'win32':
+        # Some Windows platforms might have a `uname` command that returns a
+        # non-standard string (e.g. gnuwin32 tools returns `windows32`). In
+        # these cases, fall back to using sys.platform.
+        return 'x86_64-pc-windows-msvc'
     else:
         err = "unknown OS type: {}".format(ostype)
         sys.exit(err)