Always catch PermissionError while looking for Ninja

Also convert a few other generic `except Exception`s to be more specific

Closes #1088
pull/1055/merge
Nirbheek Chauhan 8 years ago committed by Jussi Pakkanen
parent ac56f8d8fb
commit 09fd24ea78
  1. 6
      mesonbuild/dependencies.py
  2. 3
      mesonbuild/environment.py

@ -233,7 +233,7 @@ class PkgConfigDependency(Dependency):
'(%s)' % out.decode().strip())
PkgConfigDependency.pkgconfig_found = True
return
except Exception:
except (FileNotFoundError, PermissionError):
pass
PkgConfigDependency.pkgconfig_found = False
if not self.silent:
@ -358,7 +358,7 @@ class WxDependency(Dependency):
self.wxc = wxc
WxDependency.wx_found = True
return
except Exception:
except (FileNotFoundError, PermissionError):
pass
WxDependency.wxconfig_found = False
mlog.log('Found wx-config:', mlog.red('NO'))
@ -1040,7 +1040,7 @@ class GnuStepDependency(Dependency):
gp = subprocess.Popen([confprog, '--help'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
gp.communicate()
except FileNotFoundError:
except (FileNotFoundError, PermissionError):
self.args = None
mlog.log('Dependency GnuStep found:', mlog.red('NO'), '(no gnustep-config)')
return

@ -43,7 +43,8 @@ def detect_ninja():
for n in ['ninja', 'ninja-build']:
try:
p = subprocess.Popen([n, '--version'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
except FileNotFoundError:
except (FileNotFoundError, PermissionError):
# Doesn't exist in PATH or isn't executable
continue
version = p.communicate()[0].decode(errors='ignore')
# Perhaps we should add a way for the caller to know the failure mode

Loading…
Cancel
Save