changeset 7f16cbf197bd in /home/hg/repos/gajim-plugins
author: lovetox forenjunkie@chello.at branches: details:gajim-plugins?cmd=changeset;node=7f16cbf197bd description: Better version check
diffstat:
omemo/__init__.py | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-)
diffs (35 lines):
diff -r 8812bbe6cde1 -r 7f16cbf197bd omemo/__init__.py --- a/omemo/__init__.py Tue Aug 23 00:54:13 2016 +0200 +++ b/omemo/__init__.py Tue Aug 23 01:05:47 2016 +0200 @@ -21,6 +21,7 @@ import logging import os import sqlite3 +import os
from common import caps_cache, gajim, ged from common.pep import SUPPORTED_PERSONAL_USER_EVENTS @@ -74,9 +75,20 @@ log.error(e) ERROR_MSG = AXOLOTL_MISSING
-ver = gajim.config.get('version') -if ver[0:6] != '0.16.5': - ERROR_MSG = GAJIM_VERSION +GAJIM_VER = gajim.config.get('version') + +if os.name != 'nt': + try: + SETUPTOOLS_MISSING = False + from pkg_resources import parse_version + except Exception as e: + log.error(e) + SETUPTOOLS_MISSING = True + ERROR_MSG = 'You are missing the Setuptools package.' + + if not SETUPTOOLS_MISSING: + if parse_version(GAJIM_VER) < parse_version('0.16.5'): + ERROR_MSG = GAJIM_VERSION
# pylint: disable=no-init # pylint: disable=attribute-defined-outside-init