@@ -209,19 +209,25 @@ def default_build_triple(verbose):
209
209
# install, use their preference. This fixes most issues with Windows builds
210
210
# being detected as GNU instead of MSVC.
211
211
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 :
212
+
213
+ if sys .platform == 'darwin' :
222
214
if verbose :
223
- print ("pre-installed rustc not detected: {}" . format ( e ) )
215
+ print ("not using rustc detection as it is unreliable on macOS" )
224
216
print ("falling back to auto-detect" )
217
+ else :
218
+ try :
219
+ version = subprocess .check_output (["rustc" , "--version" , "--verbose" ],
220
+ stderr = subprocess .DEVNULL )
221
+ version = version .decode (default_encoding )
222
+ host = next (x for x in version .split ('\n ' ) if x .startswith ("host: " ))
223
+ triple = host .split ("host: " )[1 ]
224
+ if verbose :
225
+ print ("detected default triple {} from pre-installed rustc" .format (triple ))
226
+ return triple
227
+ except Exception as e :
228
+ if verbose :
229
+ print ("pre-installed rustc not detected: {}" .format (e ))
230
+ print ("falling back to auto-detect" )
225
231
226
232
required = sys .platform != 'win32'
227
233
ostype = require (["uname" , "-s" ], exit = required )
0 commit comments