From 4cffef6be236b5bb61275f22671cb5ce546b4295 Mon Sep 17 00:00:00 2001 From: Denis Fomin Date: Sat, 18 Dec 2010 11:11:58 +0300 Subject: [PATCH] fix for demandimport --- src/common/gajim.py | 11 ++++++----- src/features_window.py | 19 ++++++------------- src/gajim.py | 2 +- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/common/gajim.py b/src/common/gajim.py index 48762829a..1131bb95e 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -135,22 +135,22 @@ ZEROCONF_ACC_NAME = 'Local' HAVE_ZEROCONF = True try: - import avahi + __import__('avahi') except ImportError: try: - import pybonjour + __import__('pybonjour') except Exception: # Linux raises ImportError, Windows raises WindowsError HAVE_ZEROCONF = False HAVE_PYCRYPTO = True try: - import Crypto + __import__('Crypto') except ImportError: HAVE_PYCRYPTO = False HAVE_GPG = True try: - import gnupg + __import__('gnupg', globals(), locals(), [], -1) except ImportError: HAVE_GPG = False else: @@ -164,7 +164,8 @@ HAVE_LATEX = False HAVE_FARSIGHT = True try: - import farsight, gst + __import__('farsight') + __import__('gst') except ImportError: HAVE_FARSIGHT = False gajim_identity = {'type': 'pc', 'category': 'client', 'name': 'Gajim'} diff --git a/src/features_window.py b/src/features_window.py index 33de37e2f..6a38e6516 100644 --- a/src/features_window.py +++ b/src/features_window.py @@ -165,14 +165,7 @@ class FeaturesWindow: return True def zeroconf_available(self): - try: - import avahi - except Exception: - try: - import pybonjour - except Exception: - return False - return True + return gajim.HAVE_ZEROCONF def dbus_available(self): if os.name == 'nt': @@ -193,7 +186,7 @@ class FeaturesWindow: if os.name == 'nt': return False try: - import gnome.ui + __import__('gnome.ui') except Exception: return False return True @@ -204,7 +197,7 @@ class FeaturesWindow: if kwalletbinding.kwallet_available(): return True try: - import gnomekeyring + __import__('gnomekeyring') except Exception: return False return True @@ -218,7 +211,7 @@ class FeaturesWindow: if os.name == 'nt': return False try: - import gtkspell + __import__('gtkspell') except ImportError: return False return True @@ -230,7 +223,7 @@ class FeaturesWindow: if self.dbus_available() and dbus_support.get_notifications_interface(): return True try: - import pynotify + __import__('pynotify') except Exception: return False return True @@ -248,7 +241,7 @@ class FeaturesWindow: def docutils_available(self): try: - import docutils + __import__('docutils') except Exception: return False return True diff --git a/src/gajim.py b/src/gajim.py index e36de5a90..b70da8bf9 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -39,7 +39,7 @@ from common import demandimport demandimport.enable() demandimport.ignore += ['gobject._gobject', 'libasyncns', 'i18n', 'logging.NullHandler', 'dbus.glib', 'dbus.service', - 'command_system.implementation.standard'] + 'command_system.implementation.standard', 'OpenSSL.SSL', 'OpenSSL.crypto'] import os import sys