From 2ea30b3d559e0a8bd64148f86aba4f6769b7e01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sat, 11 Feb 2017 21:18:10 +0100 Subject: [PATCH] Move nbxmpp import test into do_startup --- src/application.py | 14 ++++++++++++++ src/gajim.py | 13 ------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/application.py b/src/application.py index 901412887..d18a1d824 100644 --- a/src/application.py +++ b/src/application.py @@ -37,6 +37,8 @@ except ImportError: logging_helpers.init(sys.stderr.isatty()) log = logging.getLogger('gajim.gajim') +MIN_NBXMPP_VER = "0.5.3" + class GajimApplication(Gtk.Application): '''Main class handling activation and command line.''' @@ -85,6 +87,18 @@ class GajimApplication(Gtk.Application): import gtkexcepthook gtkexcepthook.init() + try: + import nbxmpp + except ImportError: + print('Gajim needs python-nbxmpp to run. Quitting…') + sys.exit(1) + + from distutils.version import LooseVersion as V + if V(nbxmpp.__version__) < V(MIN_NBXMPP_VER): + print('Gajim needs python-nbxmpp >= %s to run. ' + 'Quitting…' % MIN_NBXMPP_VER) + sys.exit(1) + # Create and initialize Application Paths & Databases import common.configpaths common.configpaths.gajimpaths.init( diff --git a/src/gajim.py b/src/gajim.py index f1c0aa324..94e071765 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -47,19 +47,6 @@ gi.require_version('Gdk', '3.0') gi.require_version('GObject', '2.0') gi.require_version('Pango', '1.0') -MIN_NBXMPP_VER = "0.5.3" - -try: - import nbxmpp -except ImportError: - print('Gajim needs python-nbxmpp to run. Quiting…') - sys.exit(1) - -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(1) - from application import GajimApplication app = GajimApplication()