From ac1b5ce68ac5974f33f2cb89d74ac62459276604 Mon Sep 17 00:00:00 2001 From: Jason Erickson Date: Wed, 7 Oct 2009 23:43:14 -0600 Subject: [PATCH] Unclear error message when no pg_config found If unable to find pg_config, a warning will be printed instead of stopping the build process and displaying a generic error message. --- setup.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 8574a9e1..51b443a9 100644 --- a/setup.py +++ b/setup.py @@ -61,10 +61,13 @@ version_flags = ['dt', 'dec'] PLATFORM_IS_WINDOWS = sys.platform.lower().startswith('win') def get_pg_config(kind, pg_config="pg_config"): - p = subprocess.Popen([pg_config, "--" + kind], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + try: + p = subprocess.Popen([pg_config, "--" + kind], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + except OSError: + raise Warning("Unable to find 'pg_config' file") p.stdin.close() r = p.stdout.readline().strip() if not r: