[arm/master] Moving version string to argument module

commit ded30ee16b0d2c7ae048c24506f357f68d5d8933 Author: Damian Johnson <atagar@torproject.org> Date: Wed Dec 25 10:57:24 2013 -0800 Moving version string to argument module Few minor revisions, the largest being to move the output of '--version' to the arguments module. Also shortened the name of the start_time attribute. --- arm/arguments.py | 12 ++++++++++++ arm/controller.py | 4 ++-- arm/starter.py | 15 +++++++-------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/arm/arguments.py b/arm/arguments.py index 26d0b01..f449412 100644 --- a/arm/arguments.py +++ b/arm/arguments.py @@ -6,6 +6,8 @@ import collections import getopt import os +import arm + import stem.connection import stem.util.conf @@ -108,3 +110,13 @@ def get_help(): events = DEFAULT_ARGS['logged_events'], event_flags = CONFIG['msg.event_types'], ) + + +def get_version(): + """ + Provides our --version information. + + :returns: **str** with our versioning information + """ + + return "arm version %s (released %s)\n" % (arm.__version__, arm.__release_date__) diff --git a/arm/controller.py b/arm/controller.py index caccfaf..6382acd 100644 --- a/arm/controller.py +++ b/arm/controller.py @@ -49,7 +49,7 @@ CONFIG = conf.config_dict("arm", { "features.confirmQuit": True, "features.graph.type": 1, "features.graph.bw.prepopulate": True, - "attribute.start_time": 0, + "start_time": 0, }, conf_handler) GraphStat = enum.Enum("BANDWIDTH", "CONNECTIONS", "SYSTEM_RESOURCES") @@ -536,7 +536,7 @@ def start_arm(stdscr): stdscr - curses window """ - startTime = CONFIG['attribute.start_time'] + startTime = CONFIG['start_time'] initController(stdscr, startTime) control = getController() diff --git a/arm/starter.py b/arm/starter.py index 481bfb2..7c1e689 100644 --- a/arm/starter.py +++ b/arm/starter.py @@ -56,7 +56,7 @@ CONFIG = stem.util.conf.config_dict("arm", { def main(): config = stem.util.conf.get_config("arm") - config.set('attribute.start_time', str(int(time.time()))) + config.set('start_time', str(int(time.time()))) try: config.load(SETTINGS_PATH) @@ -76,9 +76,8 @@ def main(): if args.print_help: print arm.arguments.get_help() sys.exit() - - if args.print_version: - print "arm version %s (released %s)\n" % (arm.__version__, arm.__release_date__) + elif args.print_version: + print arm.arguments.get_version() sys.exit() if args.debug_path is not None: @@ -328,14 +327,14 @@ def _shutdown_daemons(controller): Stops and joins on worker threads. """ - halt_tor_controller = threading.Thread(target = controller.close) - halt_tor_controller.setDaemon(True) - halt_tor_controller.start() + close_controller = threading.Thread(target = controller.close) + close_controller.setDaemon(True) + close_controller.start() halt_threads = [ arm.controller.stop_controller(), arm.util.tracker.stop_trackers(), - halt_tor_controller, + close_controller, ] for thread in halt_threads:
participants (1)
-
atagar@torproject.org