Skip to content

Commit 1b390f4

Browse files
committed
Skip rustc version detection on macOS
1 parent 6ce2273 commit 1b390f4

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/bootstrap/bootstrap.py

+18-13
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,24 @@ def default_build_triple(verbose):
209209
# install, use their preference. This fixes most issues with Windows builds
210210
# being detected as GNU instead of MSVC.
211211
default_encoding = sys.getdefaultencoding()
212-
try:
213-
version = subprocess.check_output(["rustc", "--version", "--verbose"],
214-
stderr=subprocess.DEVNULL)
215-
version = version.decode(default_encoding)
216-
host = next(x for x in version.split('\n') if x.startswith("host: "))
217-
triple = host.split("host: ")[1]
218-
if verbose:
219-
print("detected default triple {} from pre-installed rustc".format(triple))
220-
return triple
221-
except Exception as e:
222-
if verbose:
223-
print("pre-installed rustc not detected: {}".format(e))
224-
print("falling back to auto-detect")
212+
213+
if sys.platform == 'darwin':
214+
print("not using rustc detection as it is unreliable on macOS")
215+
print("falling back to auto-detect")
216+
else:
217+
try:
218+
version = subprocess.check_output(["rustc", "--version", "--verbose"],
219+
stderr=subprocess.DEVNULL)
220+
version = version.decode(default_encoding)
221+
host = next(x for x in version.split('\n') if x.startswith("host: "))
222+
triple = host.split("host: ")[1]
223+
if verbose:
224+
print("detected default triple {} from pre-installed rustc".format(triple))
225+
return triple
226+
except Exception as e:
227+
if verbose:
228+
print("pre-installed rustc not detected: {}".format(e))
229+
print("falling back to auto-detect")
225230

226231
required = sys.platform != 'win32'
227232
ostype = require(["uname", "-s"], exit=required)

0 commit comments

Comments
 (0)