Nicer error when pkg-config fails

This commit is contained in:
Kovid Goyal 2017-11-21 04:58:35 +05:30
parent 73ce2ccb47
commit 3b0d8ec500
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -40,15 +40,18 @@ PKGCONFIG = os.environ.get('PKGCONFIG_EXE', 'pkg-config')
def pkg_config(pkg, *args):
return list(
filter(
None,
shlex.split(
subprocess.check_output([PKGCONFIG, pkg] + list(args))
.decode('utf-8')
try:
return list(
filter(
None,
shlex.split(
subprocess.check_output([PKGCONFIG, pkg] + list(args))
.decode('utf-8')
)
)
)
)
except subprocess.CalledProcessError:
raise SystemExit('The package {} was not found on your system'.format(pkg))
def at_least_version(package, major, minor=0):