diff options
author | cslocum <cslocum@d34015c8-bcbb-4646-8ac8-8ba5febf221d> | 2012-12-28 11:55:24 -0500 |
---|---|---|
committer | cslocum <cslocum@d34015c8-bcbb-4646-8ac8-8ba5febf221d> | 2012-12-28 11:55:24 -0500 |
commit | c4191477969419683a90c7e5ec1fcb8349492ca2 (patch) | |
tree | 649fb034fb31a65f8d390971b9385ae92fdd97bc /steuermann/run_all.py | |
parent | aa99d8b0ea5f55e1992fd880d8f285f38fa4cbc6 (diff) | |
download | steuermann-c4191477969419683a90c7e5ec1fcb8349492ca2.tar.gz |
changes to several files to make command line conditional args work
git-svn-id: https://svn.stsci.edu/svn/ssb/etal/steuermann/trunk@922 d34015c8-bcbb-4646-8ac8-8ba5febf221d
Diffstat (limited to 'steuermann/run_all.py')
-rw-r--r-- | steuermann/run_all.py | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/steuermann/run_all.py b/steuermann/run_all.py index fc15f93..1890820 100644 --- a/steuermann/run_all.py +++ b/steuermann/run_all.py @@ -36,6 +36,7 @@ username=getpass.getuser() ##### def main() : + global xnodes global no_run @@ -50,14 +51,14 @@ def main() : atexit.register(readline.write_history_file, history) -# easyargs spec definition: -# -# '-v' : '', # arg takes no parameter, opt['-v'] is -# # how many times it occurred -# '-f' : '=', # arg takes a parameter -# '-mf' : '=+', # arg takes a parameter, may be specified -# # several times to get a list -# '--verbose' : '-v', # arg is an alias for some other arg + # easyargs spec definition: + # + # '-v' : '', # arg takes no parameter, opt['-v'] is + # # how many times it occurred + # '-f' : '=', # arg takes a parameter + # '-mf' : '=+', # arg takes a parameter, may be specified + # # several times to get a list + # '--verbose' : '-v', # arg is an alias for some other arg allowed_flags = { '--all' : '-a' , @@ -69,15 +70,28 @@ def main() : opt, args = easyargs.get(allowed_flags, allow_unexpected = True) - # - # - all = opt['-a'] no_run = opt['-n'] + + # find any unknown arguments like --something=whatever, set as conditions + arguments = sys.argv[1:] + for a in arguments: + if '--' in a and '=' in a: + + not_allowed_flag = True + for f in allowed_flags.keys(): + if a.startswith(f): + not_allowed_flag = False + break + if not_allowed_flag: + a = a.lstrip('--') + k, v = a.split('=') + nodes.saved_conditions[k] = eval(v) + + sm_files = [a for a in args if ('--' not in a and '=' not in a)] di_nodes = nodes.read_file_list( sm_files ) - xnodes = di_nodes.node_index # get run name @@ -97,21 +111,6 @@ def main() : db = steuermann.config.open_db() - # find any unknown arguments like --something=whatever, set as conditions - arguments = sys.argv[1:] - for a in arguments: - print a - if '--' in a and '=' in a: - not_allowed_flag = True - for f in allowed_flags.keys(): - if a.startswith(f): - not_allowed_flag = False - break - if not_allowed_flag: - a = a.lstrip('--') - k, v = a.split('=') - nodes.saved_conditions[k] = v - if all : run_all(xnodes, run_name, hosts_ini, db) else : |