about summary refs log tree commit diff
path: root/src/bootstrap/bootstrap.py
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-28 03:27:33 +0000
committerbors <bors@rust-lang.org>2023-04-28 03:27:33 +0000
commit033aa092ab23ba14cdad27073c5e37ba0eddb428 (patch)
tree79fc618f753407aaadeb4de5aa1e7565e2311495 /src/bootstrap/bootstrap.py
parent9a3258fa52acdc4b63d0a49df2bd989153440d9b (diff)
parent00b9ce5a2ad81db72e77a0bdc63530f130cde482 (diff)
downloadrust-033aa092ab23ba14cdad27073c5e37ba0eddb428.tar.gz
rust-033aa092ab23ba14cdad27073c5e37ba0eddb428.zip
Auto merge of #110919 - JohnTitor:rollup-9phs2vx, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #109702 (configure --set support list as arguments)
 - #110620 (Document `const {}` syntax for `std::thread_local`.)
 - #110721 (format panic message only once)
 - #110881 (refactor(docs): remove macro resolution fallback)
 - #110893 (remove inline const deadcode in typeck)
 - #110898 (Remove unused std::sys_common::thread_local_key::Key)
 - #110909 (Skip `rustc` version detection on macOS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/bootstrap/bootstrap.py')
-rw-r--r--src/bootstrap/bootstrap.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 680a8da6adf..9c6c917ac4a 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -209,19 +209,25 @@ def default_build_triple(verbose):
     # install, use their preference. This fixes most issues with Windows builds
     # being detected as GNU instead of MSVC.
     default_encoding = sys.getdefaultencoding()
-    try:
-        version = subprocess.check_output(["rustc", "--version", "--verbose"],
-                stderr=subprocess.DEVNULL)
-        version = version.decode(default_encoding)
-        host = next(x for x in version.split('\n') if x.startswith("host: "))
-        triple = host.split("host: ")[1]
-        if verbose:
-            print("detected default triple {} from pre-installed rustc".format(triple))
-        return triple
-    except Exception as e:
+
+    if sys.platform == 'darwin':
         if verbose:
-            print("pre-installed rustc not detected: {}".format(e))
+            print("not using rustc detection as it is unreliable on macOS")
             print("falling back to auto-detect")
+    else:
+        try:
+            version = subprocess.check_output(["rustc", "--version", "--verbose"],
+                    stderr=subprocess.DEVNULL)
+            version = version.decode(default_encoding)
+            host = next(x for x in version.split('\n') if x.startswith("host: "))
+            triple = host.split("host: ")[1]
+            if verbose:
+                print("detected default triple {} from pre-installed rustc".format(triple))
+            return triple
+        except Exception as e:
+            if verbose:
+                print("pre-installed rustc not detected: {}".format(e))
+                print("falling back to auto-detect")
 
     required = sys.platform != 'win32'
     ostype = require(["uname", "-s"], exit=required)