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.
This commit is contained in:
Jason Erickson 2009-10-07 23:43:14 -06:00 committed by Federico Di Gregorio
parent 5a3e07a610
commit ac1b5ce68a

View File

@ -61,10 +61,13 @@ version_flags = ['dt', 'dec']
PLATFORM_IS_WINDOWS = sys.platform.lower().startswith('win') PLATFORM_IS_WINDOWS = sys.platform.lower().startswith('win')
def get_pg_config(kind, pg_config="pg_config"): def get_pg_config(kind, pg_config="pg_config"):
p = subprocess.Popen([pg_config, "--" + kind], try:
stdin=subprocess.PIPE, p = subprocess.Popen([pg_config, "--" + kind],
stdout=subprocess.PIPE, stdin=subprocess.PIPE,
stderr=subprocess.PIPE) stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
except OSError:
raise Warning("Unable to find 'pg_config' file")
p.stdin.close() p.stdin.close()
r = p.stdout.readline().strip() r = p.stdout.readline().strip()
if not r: if not r: