python: Do not rely on subprocess.DEVNULL.
authorJustus Winter <justus@g10code.com>
Mon, 12 Sep 2016 14:18:31 +0000 (16:18 +0200)
committerJustus Winter <justus@g10code.com>
Mon, 12 Sep 2016 14:18:31 +0000 (16:18 +0200)
* lang/python/setup.py.in: Do not rely on subprocess.DEVNULL.

Signed-off-by: Justus Winter <justus@g10code.com>
lang/python/setup.py.in

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