@@ -209,19 +209,24 @@ 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 :
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" )
225
230
226
231
required = sys .platform != 'win32'
227
232
ostype = require (["uname" , "-s" ], exit = required )
0 commit comments