From c4191477969419683a90c7e5ec1fcb8349492ca2 Mon Sep 17 00:00:00 2001 From: cslocum Date: Fri, 28 Dec 2012 16:55:24 +0000 Subject: 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 --- steuermann/nodes.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'steuermann/nodes.py') diff --git a/steuermann/nodes.py b/steuermann/nodes.py index 095b3d3..871b7c6 100644 --- a/steuermann/nodes.py +++ b/steuermann/nodes.py @@ -330,6 +330,7 @@ import specfile current_file_name = None def read_file_list( file_list ) : + global current_file_name di = command_tree( ) imported = { } @@ -380,11 +381,22 @@ def declare_conditions( text, filename ) : # exec will work if text.startswith(' ') or text.startswith('\t') : text = 'if 1 :\n' + text + + # exec it into cond first, and then move any entries that are unique + # into saved_conditions; this allows us to specify conditions on the + # command line and not have them overwritten by the same variable in + # a CONDITIONS block + cond = {} + exec text in cond + for k, v in cond.items(): + if k not in saved_conditions: + saved_conditions[k] = v + - # exec it into the dict - exec text in saved_conditions + def check_condition( name, filename ) : + if name in saved_conditions : c = saved_conditions[name] if callable(c) : @@ -393,6 +405,7 @@ def check_condition( name, filename ) : ans = c else : ans = False + return ans ##### -- cgit