Add version check for python-gnupg

This commit is contained in:
Philipp Hörist 2017-03-28 16:59:02 +02:00
parent a51ea32dc6
commit a2785ba396

View file

@ -32,6 +32,7 @@ import logging
import locale
import gi
import uuid
from distutils.version import LooseVersion as V
from common import config
import nbxmpp
@ -165,7 +166,19 @@ except ImportError:
HAVE_GPG = True
GPG_BINARY = 'gpg'
try:
__import__('gnupg')
import gnupg
'''
We need https://pypi.python.org/pypi/python-gnupg
but https://pypi.python.org/pypi/gnupg shares the same package name.
It cannot be used as a drop-in replacement.
We test with a version check if python-gnupg is installed as it is
on a much lower version number than gnupg
Also we need at least python-gnupg 0.3.8
'''
v_gnupg = gnupg.__version__
if V(v_gnupg) < V('0.3.8') or V(v_gnupg) > V('1.0.0'):
log.info('Gajim needs python-gnupg >= 0.3.8')
HAVE_GPG = False
except ImportError:
HAVE_GPG = False
else: