summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/app.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-08-13 17:07:58 -0300
committerTomás Touceda <chiiph@leap.se>2013-08-13 17:07:58 -0300
commit4cdaa7320b1d0624b7e6c1f08161451a7b70b373 (patch)
tree954bc9ee09ca41a8754662df00a1153b80e19480 /src/leap/bitmask/app.py
parent10f937feffeb2e267a6426cdd5d3287783da866d (diff)
Set the standalone flag before using it
This reorders imports and delays them after the args are processed.
Diffstat (limited to 'src/leap/bitmask/app.py')
-rw-r--r--src/leap/bitmask/app.py38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py
index 3c418258..6ffa1d25 100644
--- a/src/leap/bitmask/app.py
+++ b/src/leap/bitmask/app.py
@@ -24,27 +24,15 @@ from functools import partial
from PySide import QtCore, QtGui
-from leap.bitmask.gui import locale_rc
-from leap.bitmask.gui import twisted_main
-from leap.bitmask.gui.mainwindow import MainWindow
-from leap.bitmask.platform_init import IS_MAC
-from leap.bitmask.platform_init.locks import we_are_the_one_and_only
-#from leap.bitmask.services.tx import leap_services
-from leap.bitmask.util import __version__ as VERSION
from leap.bitmask.util import leap_argparse
from leap.bitmask.util.leap_log_handler import LeapLogHandler
from leap.bitmask.util.streamtologger import StreamToLogger
-from leap.bitmask.util.requirement_checker import check_requirements
from leap.common.events import server as event_server
-
import codecs
codecs.register(lambda name: codecs.lookup('utf-8')
if name == 'cp65001' else None)
-# pylint: avoid unused import
-assert(locale_rc)
-
def sigint_handler(*args, **kwargs):
"""
@@ -144,6 +132,29 @@ def main():
logfile = opts.log_file
openvpn_verb = opts.openvpn_verb
+ #############################################################
+ # Given how paths and bundling works, we need to delay the imports
+ # of certain parts that depend on this path settings.
+ # So first we set all the places where standalone might be queried.
+ from leap.bitmask.config.providerconfig import ProviderConfig
+ from leap.common.config.baseconfig import BaseConfig
+ from leap.bitmask.services.eip.eipconfig import EIPConfig
+ BaseConfig.standalone = standalone
+ ProviderConfig.standalone = standalone
+ EIPConfig.standalone = standalone
+
+ # And then we import all the other stuff
+ from leap.bitmask.gui import locale_rc
+ from leap.bitmask.gui import twisted_main
+ from leap.bitmask.gui.mainwindow import MainWindow
+ from leap.bitmask.platform_init import IS_MAC
+ from leap.bitmask.platform_init.locks import we_are_the_one_and_only
+ from leap.bitmask.util import __version__ as VERSION
+ from leap.bitmask.util.requirement_checker import check_requirements
+
+ # pylint: avoid unused import
+ assert(locale_rc)
+
logger = add_logger_handlers(debug, logfile)
replace_stdout_stderr_with_logging(logger)
@@ -162,6 +173,9 @@ def main():
logger.info('Starting app')
+ ProviderConfig.standalone = standalone
+ EIPConfig.standalone = standalone
+
# We force the style if on KDE so that it doesn't load all the kde
# libs, which causes a compatibility issue in some systems.
# For more info, see issue #3194