aboutsummaryrefslogtreecommitdiff
path: root/steuermann/nodes.py
diff options
context:
space:
mode:
authorcslocum <cslocum@d34015c8-bcbb-4646-8ac8-8ba5febf221d>2012-12-28 11:55:24 -0500
committercslocum <cslocum@d34015c8-bcbb-4646-8ac8-8ba5febf221d>2012-12-28 11:55:24 -0500
commitc4191477969419683a90c7e5ec1fcb8349492ca2 (patch)
tree649fb034fb31a65f8d390971b9385ae92fdd97bc /steuermann/nodes.py
parentaa99d8b0ea5f55e1992fd880d8f285f38fa4cbc6 (diff)
downloadsteuermann-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/nodes.py')
-rw-r--r--steuermann/nodes.py17
1 files changed, 15 insertions, 2 deletions
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
#####