Skip to content

Commit

Permalink
build: avoid bare exceptions in xcode_emulation.py
Browse files Browse the repository at this point in the history
https://realpython.com/the-most-diabolical-python-antipattern/

PR-URL: #1932
Reviewed-By: Rod Vagg <rod@vagg.org>
  • Loading branch information
cclauss authored and rvagg committed Nov 18, 2019
1 parent 7edf765 commit 7bfdb6f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gyp/pylib/gyp/xcode_emulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def _GetSdkVersionInfoItem(self, sdk, infoitem):
# most sensible route and should still do the right thing.
try:
return GetStdoutQuiet(['xcodebuild', '-version', '-sdk', sdk, infoitem])
except:
except GypError:
pass

def _SdkRoot(self, configname):
Expand Down Expand Up @@ -1135,7 +1135,7 @@ def _DefaultSdkRoot(self):
return default_sdk_root
try:
all_sdks = GetStdout(['xcodebuild', '-showsdks'])
except:
except GypError:
# If xcodebuild fails, there will be no valid SDKs
return ''
for line in all_sdks.splitlines():
Expand Down Expand Up @@ -1276,7 +1276,7 @@ def XcodeVersion():
# checking that version.
if len(version_list) < 2:
raise GypError("xcodebuild returned unexpected results")
except:
except GypError:
version = CLTVersion()
if version:
version = ".".join(version.split(".")[:3])
Expand Down Expand Up @@ -1314,7 +1314,7 @@ def CLTVersion():
try:
output = GetStdout(['/usr/sbin/pkgutil', '--pkg-info', key])
return re.search(regex, output).groupdict()['version']
except:
except GypError:
continue


Expand Down

0 comments on commit 7bfdb6f

Please sign in to comment.