From 3b0d8ec5005012e78f35521690b07150aa1947c0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 21 Nov 2017 04:58:35 +0530 Subject: [PATCH] Nicer error when pkg-config fails --- setup.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index 7b1849387..95c64d84b 100755 --- a/setup.py +++ b/setup.py @@ -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):