[Pgp-tools-commit] r613 - trunk/keyart

Aaron Toponce atoponce-guest at moszumanska.debian.org
Tue May 13 21:50:32 UTC 2014


Author: atoponce-guest
Date: 2014-05-13 21:50:32 +0000 (Tue, 13 May 2014)
New Revision: 613

Modified:
   trunk/keyart/keyart
Log:
Add try/except for gpg(1) in $PATH with exit.


Modified: trunk/keyart/keyart
===================================================================
--- trunk/keyart/keyart	2014-05-13 21:42:20 UTC (rev 612)
+++ trunk/keyart/keyart	2014-05-13 21:50:32 UTC (rev 613)
@@ -1,7 +1,6 @@
 #!/usr/bin/env python
 
 import os
-import os.path
 import subprocess
 import sys
 
@@ -18,10 +17,14 @@
     print "{0} is not readable. Check permissions.".format(keyfile)
     sys.exit(3)
 
-gpg = subprocess.Popen(
-    ('gpg','--with-fingerprint','--with-colons', keyfile),
-    stdout=subprocess.PIPE)
-out = gpg.communicate()
+try:
+    gpg = subprocess.Popen(
+        ('gpg','--with-fingerprint','--with-colons', keyfile),
+        stdout=subprocess.PIPE)
+    out = gpg.communicate()
+except OSError:
+    print "Please install GnuPG before using this script."
+    sys.exit(4)
 
 key_size = [i.strip() for i in out[0].split(':')][2]
 key_algo = [i.strip() for i in out[0].split(':')][3]




More information about the Pgp-tools-commit mailing list