From 0eec41ee8985a31c7ef8cb93f030d3a8141d8e30 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 3 Jan 2017 21:13:27 +0000 Subject: [PATCH] Simplify nbxmpp import error checking to exit(1). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was no reason for distutils’ version support to fail. --- src/gajim.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/gajim.py b/src/gajim.py index ac068c7be..ac6e52f47 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -51,28 +51,18 @@ if os.name == 'nt': warnings.filterwarnings(action='ignore') -HAS_NBXMPP=True MIN_NBXMPP_VER = "0.5.3" from gi.repository import GLib try: import nbxmpp except ImportError: - HAS_NBXMPP=False - -if not HAS_NBXMPP: print('Gajim needs python-nbxmpp to run. Quiting...') - sys.exit() + sys.exit(1) -try: - from distutils.version import LooseVersion as V - if V(nbxmpp.__version__) < V(MIN_NBXMPP_VER): - HAS_NBXMPP=False -except: - HAS_NBXMPP=False - -if not HAS_NBXMPP: +from distutils.version import LooseVersion as V +if V(nbxmpp.__version__) < V(MIN_NBXMPP_VER): print('Gajim needs python-nbxmpp >= %s to run. Quiting...' % MIN_NBXMPP_VER) - sys.exit() + sys.exit(1) if os.name == 'nt': import locale