summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/leap/bitmask/cli/keys.py7
-rw-r--r--src/leap/bitmask/core/mail_services.py42
-rw-r--r--src/leap/bitmask/core/service.py10
3 files changed, 44 insertions, 15 deletions
diff --git a/src/leap/bitmask/cli/keys.py b/src/leap/bitmask/cli/keys.py
index 12191a5d..82de3868 100644
--- a/src/leap/bitmask/cli/keys.py
+++ b/src/leap/bitmask/cli/keys.py
@@ -23,7 +23,12 @@ import sys
from colorama import Fore
from leap.bitmask.cli import command
-from leap.bitmask.keymanager.validation import ValidationLevels
+
+try:
+ from leap.bitmask.keymanager.validation import ValidationLevels
+ HAS_KM = True
+except ImportError:
+ HAS_KM = False
class Keys(command.Command):
diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py
index 9c34c120..20d6a342 100644
--- a/src/leap/bitmask/core/mail_services.py
+++ b/src/leap/bitmask/core/mail_services.py
@@ -33,19 +33,31 @@ from twisted.logger import Logger
from leap.common.events import catalog, emit_async
from leap.common.files import check_and_fix_urw_only
-from leap.bitmask.mua import pixelizer
-from leap.bitmask.hooks import HookableService
+
from leap.bitmask.bonafide import config
-from leap.bitmask.keymanager import KeyManager
-from leap.bitmask.keymanager.errors import KeyNotFound
-from leap.bitmask.keymanager.validation import ValidationLevels
-from leap.bitmask.mail.constants import INBOX_NAME
-from leap.bitmask.mail.mail import Account
-from leap.bitmask.mail.imap import service as imap_service
-from leap.bitmask.mail.smtp import service as smtp_service
-from leap.bitmask.mail.incoming.service import IncomingMail
-from leap.bitmask.mail.incoming.service import INCOMING_CHECK_PERIOD
+from leap.bitmask.hooks import HookableService
from leap.bitmask.util import get_gpg_bin_path, merge_status
+
+try:
+ from leap.bitmask.keymanager import KeyManager
+ from leap.bitmask.keymanager.errors import KeyNotFound
+ from leap.bitmask.keymanager.validation import ValidationLevels
+ from leap.bitmask.mail.constants import INBOX_NAME
+ from leap.bitmask.mail.mail import Account
+ from leap.bitmask.mail.imap import service as imap_service
+ from leap.bitmask.mail.smtp import service as smtp_service
+ from leap.bitmask.mail.incoming.service import IncomingMail
+ from leap.bitmask.mail.incoming.service import INCOMING_CHECK_PERIOD
+ HAS_MAIL = True
+except ImportError:
+ HAS_MAIL = False
+
+try:
+ from leap.bitmask.mua import pixelizer
+ HAS_MUA = True
+except ImportError:
+ HAS_MUA = False
+
from leap.soledad.client.api import Soledad
from leap.bitmask.core.uuid_map import UserMap
@@ -628,7 +640,7 @@ class StandardMailService(service.MultiService, HookableService):
def _maybe_start_pixelated(self, passthrough, userid, soledad, keymanager):
incoming = self.getServiceNamed('incoming_mail')
account = incoming.getServiceNamed(userid).account
- if pixelizer.HAS_PIXELATED:
+ if HAS_MUA and pixelizer.HAS_PIXELATED:
pixelizer.start_pixelated_user_agent(
userid, soledad, keymanager, account)
return passthrough
@@ -646,6 +658,9 @@ class IMAPService(service.Service):
super(IMAPService, self).__init__()
def startService(self):
+ if not HAS_MAIL:
+ self.log.info('Mail module not found')
+ return
self.log.info('Starting IMAP Service')
port, factory = imap_service.run_service(
self._soledad_sessions, factory=self._factory)
@@ -686,6 +701,9 @@ class SMTPService(service.Service):
super(SMTPService, self).__init__()
def startService(self):
+ if not HAS_MAIL:
+ self.log.info('Mail module not found')
+ return
self.log.info('starting smtp service')
port, factory = smtp_service.run_service(
self._soledad_sessions,
diff --git a/src/leap/bitmask/core/service.py b/src/leap/bitmask/core/service.py
index 6244b17e..ec3536f2 100644
--- a/src/leap/bitmask/core/service.py
+++ b/src/leap/bitmask/core/service.py
@@ -35,8 +35,13 @@ from leap.bitmask.core import flags
from leap.bitmask.core import _zmq
from leap.bitmask.core import _session
from leap.bitmask.core.web.service import HTTPDispatcherService
-from leap.bitmask.vpn.service import VPNService
from leap.common.events import server as event_server
+try:
+ from leap.bitmask.vpn.service import VPNService
+ HAS_VPN = True
+except ImportError:
+ HAS_VPN = False
+
backend = flags.BACKEND
@@ -201,7 +206,8 @@ class BitmaskBackend(configurable.ConfigurableService):
self._maybe_init_service('mail', service, self.basedir)
def _init_vpn(self):
- self._maybe_init_service('vpn', VPNService)
+ if HAS_VPN:
+ self._maybe_init_service('vpn', VPNService)
def _init_zmq(self):
zs = _zmq.ZMQServerService(self)