summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/core/launcher.py
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-09-27 14:18:57 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-09-27 16:19:21 -0400
commit4d8e63e890e88c58feb750dd56ecbf60bed9b462 (patch)
tree29433783bcc71a9fb2516e4ed4aea14584b99532 /src/leap/bitmask/core/launcher.py
parent62d1f7eb5c714aabcb625499dd16d68df76c856b (diff)
[feature] launch backend from the qt gui entrypoint
Diffstat (limited to 'src/leap/bitmask/core/launcher.py')
-rw-r--r--src/leap/bitmask/core/launcher.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/leap/bitmask/core/launcher.py b/src/leap/bitmask/core/launcher.py
index 27e5a26..45acde2 100644
--- a/src/leap/bitmask/core/launcher.py
+++ b/src/leap/bitmask/core/launcher.py
@@ -17,12 +17,11 @@
"""
Run bitmask daemon.
"""
-from os.path import join, abspath
-from sys import argv
+from os.path import join, abspath, dirname
+import sys
from twisted.scripts.twistd import run
-from leap.bitmask.util import here
from leap.bitmask import core
from leap.bitmask.core import flags
from leap.common.config import get_path_prefix
@@ -30,13 +29,27 @@ from leap.common.config import get_path_prefix
pid = abspath(join(get_path_prefix(), 'leap', 'bitmaskd.pid'))
+STANDALONE = getattr(sys, 'frozen', False)
+
+
+def here(module=None):
+ if STANDALONE:
+ # we are running in a |PyInstaller| bundle
+ return sys._MEIPASS
+ else:
+ if module:
+ return dirname(module.__file__)
+ else:
+ return dirname(__file__)
+
+
def run_bitmaskd():
# TODO --- configure where to put the logs... (get --logfile, --logdir
# from the bitmask_cli
- for (index, arg) in enumerate(argv):
+ for (index, arg) in enumerate(sys.argv):
if arg == '--backend':
flags.BACKEND = argv[index + 1]
- argv[1:] = [
+ sys.argv[1:] = [
'-y', join(here(core), "bitmaskd.tac"),
'--pidfile', pid,
'--umask=0022',