[PATCH] Add function to parse gpg key ids.
Serafeim Zanikolas
serzan at hellug.gr
Tue Feb 3 00:01:03 CET 2009
---
debexpo/lib/utils.py | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/debexpo/lib/utils.py b/debexpo/lib/utils.py
index 5b93774..92fe878 100644
--- a/debexpo/lib/utils.py
+++ b/debexpo/lib/utils.py
@@ -35,6 +35,7 @@ __author__ = 'Jonny Lamb'
__copyright__ = 'Copyright © 2008 Jonny Lamb'
__license__ = 'MIT'
+import commands
import os
import md5
@@ -105,3 +106,19 @@ def md5sum(filename):
f.close()
return sum.hexdigest()
+
+def parse_key_id(key):
+ """
+ Returns the key id of the given GPG public key.
+
+ ``key``
+ ASCII armored GPG public key.
+ """
+ cmd = 'echo "%s" | gpg2' % key
+ status, output = commands.getstatusoutput(cmd)
+ if status != 0:
+ return None
+ try:
+ return output.split()[1]
+ except KeyError:
+ return None
--
1.5.6.5
--LwW0XdcUbUexiWVK
Content-Type: text/x-diff; charset=iso-8859-1
Content-Disposition: attachment; filename="0002-Make-path-to-gpg-binary-a-configurable-parameter.patch"
Content-Transfer-Encoding: 8bit
More information about the debexpo-devel
mailing list