From 2587fba4d6982f39ae031f75cafc49da1901f056 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 2 Oct 2013 11:33:28 -0400 Subject: add sanity check for gnupg package and version --- changes/bug_enforce_correct_version | 1 + src/leap/keymanager/__init__.py | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 changes/bug_enforce_correct_version diff --git a/changes/bug_enforce_correct_version b/changes/bug_enforce_correct_version new file mode 100644 index 0000000..eb03e41 --- /dev/null +++ b/changes/bug_enforce_correct_version @@ -0,0 +1 @@ + o Add a sanity check for the correct version of gnupg. diff --git a/src/leap/keymanager/__init__.py b/src/leap/keymanager/__init__.py index 2f39ad9..76be226 100644 --- a/src/leap/keymanager/__init__.py +++ b/src/leap/keymanager/__init__.py @@ -14,11 +14,28 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . - - """ Key Manager is a Nicknym agent for LEAP client. """ +# let's do a little sanity check to see if we're using the wrong gnupg +import sys + +try: + from gnupg.gnupg import GPGUtilities + assert(GPGUtilities) # pyflakes happy + from gnupg import __version__ + from distutils.version import LooseVersion as V + assert(V(__version__) >= V('1.2.2')) + +except ImportError, AssertionError: + print "Ooops! It looks like there is a conflict in the installed version " + print "of gnupg." + print "Disclaimer: Ideally, we would need to work a patch and propose the " + print "merge to upstream. But until then do: " + print + print "% pip uninstall python-gnupg" + print "% pip install gnupg" + sys.exit(1) import logging import requests -- cgit v1.2.3