python: Do not rely on subprocess.DEVNULL.

* lang/python/setup.py.in: Do not rely on subprocess.DEVNULL.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2016-09-12 16:18:31 +02:00
parent dfd99ab50c
commit b48b852a84

View File

@ -43,16 +43,21 @@ if os.path.exists("../../src/gpgme-config"):
IN_TREE_BUILD=1, IN_TREE_BUILD=1,
) )
if hasattr(subprocess, "DEVNULL"):
devnull = subprocess.DEVNULL
else:
devnull = open(os.devnull, "w")
try: try:
subprocess.check_call([gpg_error_config, '--version'], subprocess.check_call([gpg_error_config, '--version'],
stdout=subprocess.DEVNULL) stdout=devnull)
except: except:
sys.exit("Could not find gpg-error-config. " + sys.exit("Could not find gpg-error-config. " +
"Please install the libgpg-error development package.") "Please install the libgpg-error development package.")
try: try:
subprocess.check_call([gpgme_config, '--version'], subprocess.check_call([gpgme_config, '--version'],
stdout=subprocess.DEVNULL) stdout=devnull)
except: except:
sys.exit("Could not find gpgme-config. " + sys.exit("Could not find gpgme-config. " +
"Please install the libgpgme development package.") "Please install the libgpgme development package.")