diff options
author | Tomas Touceda <chiiph@leap.se> | 2013-05-10 09:57:18 -0300 |
---|---|---|
committer | Tomas Touceda <chiiph@leap.se> | 2013-05-10 09:57:18 -0300 |
commit | 132c8e47b74dd8ee0db51f0558c024fd4066681b (patch) | |
tree | 13d599fcbd87af69afdc2c54f33174cb91336d1e | |
parent | 28ce0c44e7995e7e4629c1fa33f0f1793ba7bfaf (diff) |
Make running Thandy configurable
-rw-r--r-- | src/launcher.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/launcher.py b/src/launcher.py index 7d95336..5b44f92 100644 --- a/src/launcher.py +++ b/src/launcher.py @@ -2,6 +2,7 @@ import os import platform import time import threading +import ConfigParser from leap.app import main as leap_client from leap.common.events import server @@ -15,6 +16,9 @@ bundles_per_platform = { "Linux" : "/bundleinfo/LEAPClient/", } +GENERAL_SECTION = "General" +UPDATES_KEY = "Updates" + class Thandy(threading.Thread): def run(self): while True: @@ -35,14 +39,27 @@ class Thandy(threading.Thread): except Exception as e: print "ERROR:", e finally: + # TODO: Make this delay configurable time.sleep(60) if __name__ == "__main__": server.ensure_server(port=8090) - thandy_thread = Thandy() - thandy_thread.daemon = True - thandy_thread.start() + config = ConfigParser.ConfigParser() + config.read("launcher.conf") + + launch_thandy = False + try: + launch_thandy = config.getboolean(GENERAL_SECTION, UPDATES_KEY) + except ConfigParser.NoSectionError as ns: + pass + except ConfigParser.NoOptionError as no: + pass + + if launch_thandy: + thandy_thread = Thandy() + thandy_thread.daemon = True + thandy_thread.start() leap_client() |