@@ -521,7 +521,7 @@ def _GetSdkVersionInfoItem(self, sdk, infoitem):
521521 # most sensible route and should still do the right thing.
522522 try :
523523 return GetStdoutQuiet (["xcrun" , "--sdk" , sdk , infoitem ])
524- except GypError :
524+ except ( GypError , OSError ) :
525525 pass
526526
527527 def _SdkRoot (self , configname ):
@@ -1354,7 +1354,7 @@ def _DefaultSdkRoot(self):
13541354 return default_sdk_root
13551355 try :
13561356 all_sdks = GetStdout (["xcodebuild" , "-showsdks" ])
1357- except GypError :
1357+ except ( GypError , OSError ) :
13581358 # If xcodebuild fails, there will be no valid SDKs
13591359 return ""
13601360 for line in all_sdks .splitlines ():
@@ -1508,7 +1508,8 @@ def XcodeVersion():
15081508 raise GypError ("xcodebuild returned unexpected results" )
15091509 version = version_list [0 ].split ()[- 1 ] # Last word on first line
15101510 build = version_list [- 1 ].split ()[- 1 ] # Last word on last line
1511- except GypError : # Xcode not installed so look for XCode Command Line Tools
1511+ except (GypError , OSError ):
1512+ # Xcode not installed so look for XCode Command Line Tools
15121513 version = CLTVersion () # macOS Catalina returns 11.0.0.0.1.1567737322
15131514 if not version :
15141515 raise GypError ("No Xcode or CLT version detected!" )
@@ -1541,14 +1542,14 @@ def CLTVersion():
15411542 try :
15421543 output = GetStdout (["/usr/sbin/pkgutil" , "--pkg-info" , key ])
15431544 return re .search (regex , output ).groupdict ()["version" ]
1544- except GypError :
1545+ except ( GypError , OSError ) :
15451546 continue
15461547
15471548 regex = re .compile (r"Command Line Tools for Xcode\s+(?P<version>\S+)" )
15481549 try :
15491550 output = GetStdout (["/usr/sbin/softwareupdate" , "--history" ])
15501551 return re .search (regex , output ).groupdict ()["version" ]
1551- except GypError :
1552+ except ( GypError , OSError ) :
15521553 return None
15531554
15541555
0 commit comments