[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [arm/master] Adding source flag to disable gui while in beta



commit 155c58fe5ddb1734b4b5a46b0a7906cbf01677d5
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Fri Jun 10 08:36:54 2011 -0700

    Adding source flag to disable gui while in beta
    
    Source flag disables the --gui argument (and by extention prevents the gui
    from being run). This isn't perfect in that the gui prereqs are checked
    despite this flag when we have the gui arg, but this is both a temporary hack
    and not a terribly big concern.
---
 src/starter.py |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/starter.py b/src/starter.py
index edb8bb2..d2ac910 100644
--- a/src/starter.py
+++ b/src/starter.py
@@ -30,6 +30,7 @@ import util.uiTools
 import TorCtl.TorCtl
 import TorCtl.TorUtil
 
+INCLUDE_GUI = False
 LOG_DUMP_PATH = os.path.expanduser("~/.arm/log")
 DEFAULT_CONFIG = os.path.expanduser("~/.arm/armrc")
 CONFIG = {"startup.controlPassword": None,
@@ -50,8 +51,13 @@ CONFIG = {"startup.controlPassword": None,
           "log.configDescriptions.persistance.saveFailed": util.log.NOTICE,
           "log.savingDebugLog": util.log.NOTICE}
 
-OPT = "gi:c:dbe:vh"
-OPT_EXPANDED = ["gui", "interface=", "config=", "debug", "blind", "event=", "version", "help"]
+if INCLUDE_GUI:
+  OPT = "gi:c:dbe:vh"
+  OPT_EXPANDED = ["gui", "interface=", "config=", "debug", "blind", "event=", "version", "help"]
+else:
+  OPT = "i:c:dbe:vh"
+  OPT_EXPANDED = ["interface=", "config=", "debug", "blind", "event=", "version", "help"]
+
 HELP_MSG = """Usage arm [OPTION]
 Terminal status monitor for Tor relays.
 
@@ -71,6 +77,11 @@ arm -b -i 1643          hide connection data, attaching to control port 1643
 arm -e we -c /tmp/cfg   use this configuration file with 'WARN'/'ERR' events
 """ % (CONFIG["startup.interface.ipAddress"], CONFIG["startup.interface.port"], DEFAULT_CONFIG, LOG_DUMP_PATH, CONFIG["startup.events"], cli.logPanel.EVENT_LISTING)
 
+# icky and temporary hack to remove the gui help option if it's unavailbe
+if not INCLUDE_GUI:
+  helpComp = HELP_MSG.split("\n")
+  HELP_MSG = "\n".join(helpComp[:3] + helpComp[4:])
+
 # filename used for cached tor config descriptions
 CONFIG_DESC_FILENAME = "torConfigDesc.txt"
 
@@ -239,7 +250,7 @@ if __name__ == '__main__':
       
       param["startup.interface.ipAddress"] = controlAddr
       param["startup.interface.port"] = controlPort
-    elif opt in ("-g", "--gui"): launchGui = True
+    elif opt in ("-g", "--gui") and INCLUDE_GUI: launchGui = True
     elif opt in ("-c", "--config"): configPath = arg  # sets path of user's config
     elif opt in ("-d", "--debug"): isDebugMode = True # dumps all logs
     elif opt in ("-b", "--blind"):

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits