Commit 22856d26 authored by Pawel Szostek's avatar Pawel Szostek

manifest: add top manifest variables to all descendants

parent e425bcc5
......@@ -175,13 +175,6 @@ class Module(object):
manifest_parser = ManifestParser()
# For non-top modules
if self.parent is not None:
manifest_parser.add_arbitrary_code("target=\""+str(global_mod.top_module.target)+"\"")
manifest_parser.add_arbitrary_code("action=\""+str(global_mod.top_module.action)+"\"")
manifest_parser.add_arbitrary_code("syn_device=\""+str(global_mod.top_module.syn_device)+"\"")
manifest_parser.add_arbitrary_code("sim_tool=\""+str(global_mod.top_module.sim_tool)+"\"")
manifest_parser.add_arbitrary_code("__manifest=\""+self.path+"\"")
manifest_parser.add_arbitrary_code(global_mod.options.arbitrary_code)
......
......@@ -233,7 +233,8 @@ class ConfigParser(object):
def __names(self):
return [o.name for o in self.options if o is not None]
def parse(self):
def parse(self, allow_unknown=False, verbose=False, extra_context=None):
assert isinstance(extra_context, dict) or extra_context is None
options = {}
ret = {}
......@@ -255,7 +256,7 @@ class ConfigParser(object):
import sys
try:
with stdoutIO() as s:
exec(self.arbitrary_code, arbitrary_options)
exec(self.arbitrary_code, extra_context, arbitrary_options)
printed = s.getvalue()
if printed:
print(printed)
......@@ -269,7 +270,7 @@ class ConfigParser(object):
try:
with stdoutIO() as s:
exec(content, options)
exec(content, extra_context, options)
printed = s.getvalue()
if len(printed) > 0:
logging.info("The manifest inside " + self.config_file + " tried to print something:")
......@@ -290,7 +291,9 @@ class ConfigParser(object):
continue
if opt_name not in self.__names():
if opt_name in arbitrary_options:
continue
continue # finish processing of this variable here
elif allow_unknown is True:
ret[opt_name] = val
else:
#if opt_name.startswith("global_"):
# continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment