Move nbxmpp import test into do_startup

This commit is contained in:
Philipp Hörist 2017-02-11 21:18:10 +01:00
parent 4bf65a4039
commit 2ea30b3d55
2 changed files with 14 additions and 13 deletions

View File

@ -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(

View File

@ -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()