From a5afe5f657f5812ea95c5eb476eb355de6afa5a9 Mon Sep 17 00:00:00 2001 From: sienkiew Date: Wed, 18 Jan 2012 22:36:05 +0000 Subject: new sm files for nightly builds IMPORT feature in specification language checkpointing of various uncommitted changes git-svn-id: https://svn.stsci.edu/svn/ssb/etal/steuermann/trunk@538 d34015c8-bcbb-4646-8ac8-8ba5febf221d --- steuermann/nodes.py | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'steuermann/nodes.py') diff --git a/steuermann/nodes.py b/steuermann/nodes.py index 476734a..3ad4639 100644 --- a/steuermann/nodes.py +++ b/steuermann/nodes.py @@ -11,6 +11,11 @@ import fnmatch class command_tree(object): + # list of additional files to import after this one; this is just + # here so we have a place to put it. It is appended by the parser + # and consumed by read_file_list() + import_list = [ ] + # a dict that maps currently known node names to node objects node_index = None @@ -315,11 +320,34 @@ current_file_name = None def read_file_list( file_list ) : global current_file_name di = command_tree( ) - for x in file_list : - current_file_name = x - sc = specfile.specfileScanner( open(x,'r').read() ) + imported = { } + while len(file_list) > 0 : + + print "START",file_list + # first name off the list + current_file_name = file_list[0] + file_list = file_list[1:] + print "LIST",file_list + + # see if it imported already + if current_file_name in imported : + print "SKIP",current_file_name + continue + imported[current_file_name] = 1 + + print "READING ",current_file_name + # read/parse + sc = specfile.specfileScanner( open(current_file_name,'r').read() ) p = specfile.specfile( scanner=sc, data=di ) + result = specfile.wrap_error_reporter( p, 'start' ) + + # if there were any import statements in the file, add those files to the list + file_list += di.import_list + di.import_list = [ ] + + print "END",file_list + di.finish() return di @@ -328,5 +356,3 @@ if __name__=='__main__': n = read_file_list( sys.argv[1:] ) print show_nodes(n.node_index) - - -- cgit