This is not entirely correct, as scons doesn't put binaries in a
"src" subdirectory, but doesn't seem to be a problem for now.
# parse the source list file
parser = source_list.SourceListParser()
src = env.File(filename).srcnode()
+
+ parser.add_symbol('top_srcdir', env.Dir('#').abspath)
+ parser.add_symbol('top_builddir', env['build_dir'])
+
sym_table = parser.parse(src.abspath)
if names:
class SourceListParser(object):
def __init__(self):
+ self.symbol_table = {}
self._reset()
def _reset(self, filename=None):
self.line_no = 1
self.line_cont = ''
- self.symbol_table = {}
def _error(self, msg):
raise RuntimeError('%s:%d: %s' % (self.filename, self.line_no, msg))
raise
return self.symbol_table
+
+ def add_symbol(self, name, value):
+ self.symbol_table[name] = value