Commit 24b0d92c authored by Tristan Gingold's avatar Tristan Gingold

Clarify top_module (could be top_entity or top_manifest).

parent afc58c0b
...@@ -52,7 +52,7 @@ def hdlmake(args): ...@@ -52,7 +52,7 @@ def hdlmake(args):
# Create a ModulePool object, this will become our workspace # Create a ModulePool object, this will become our workspace
action = ActionCore(options) action = ActionCore(options)
action.load_top_module() action.load_top_manifest()
action.run() action.run()
# Execute the appropriated action for the freshly created modules pool # Execute the appropriated action for the freshly created modules pool
......
...@@ -40,20 +40,20 @@ class Action(list): ...@@ -40,20 +40,20 @@ class Action(list):
def __init__(self, options): def __init__(self, options):
super(Action, self).__init__() super(Action, self).__init__()
self.top_module = None self.top_manifest = None
self.parseable_fileset = SourceFileSet() self.parseable_fileset = SourceFileSet()
self.privative_fileset = SourceFileSet() self.privative_fileset = SourceFileSet()
self._deps_solved = False self._deps_solved = False
self.options = options self.options = options
def load_top_module(self): def load_top_manifest(self):
# Top level module. # Top level module.
assert self.top_module is None assert self.top_manifest is None
self.top_module = self.new_module(parent=None, self.top_manifest = self.new_module(parent=None,
url=os.getcwd(), url=os.getcwd(),
source=None, source=None,
fetchto=".") fetchto=".")
self.top_module.parse_manifest() self.top_manifest.parse_manifest()
self.config = self._get_config_dict() self.config = self._get_config_dict()
def run(self): def run(self):
...@@ -85,8 +85,6 @@ class Action(list): ...@@ -85,8 +85,6 @@ class Action(list):
This is the only way to add new modules to the pool This is the only way to add new modules to the pool
Thanks to it the pool can easily control its content Thanks to it the pool can easily control its content
NOTE: the first module added to the pool will become the top_module!.
""" """
self._deps_solved = False self._deps_solved = False
new_module_args = ModuleArgs() new_module_args = ModuleArgs()
...@@ -149,9 +147,9 @@ class Action(list): ...@@ -149,9 +147,9 @@ class Action(list):
logging.info("Detected %d supported files that can be parsed", logging.info("Detected %d supported files that can be parsed",
len(self.parseable_fileset)) len(self.parseable_fileset))
def get_top_module(self): def get_top_manifest(self):
"""Get the Top module from the pool""" """Get the Top module from the pool"""
return self.top_module return self.top_manifest
def _get_config_dict(self): def _get_config_dict(self):
"""Get the combined hierarchical Manifest dictionary from the pool""" """Get the combined hierarchical Manifest dictionary from the pool"""
......
...@@ -137,7 +137,8 @@ class ModuleContent(ModuleCore): ...@@ -137,7 +137,8 @@ class ModuleContent(ModuleCore):
if self.parent is None: if self.parent is None:
include_dirs = self.manifest_dict.get('include_dirs', []) include_dirs = self.manifest_dict.get('include_dirs', [])
else: else:
include_dirs = self.top_module.manifest_dict.get('include_dirs', []) include_dirs = self.top_manifest.manifest_dict.get(
'include_dirs', [])
for path_aux in paths: for path_aux in paths:
if os.path.isdir(path_aux): if os.path.isdir(path_aux):
dir_ = os.listdir(path_aux) dir_ = os.listdir(path_aux)
......
...@@ -118,14 +118,14 @@ class ModuleCore(ModuleConfig): ...@@ -118,14 +118,14 @@ class ModuleCore(ModuleConfig):
self.library = "work" self.library = "work"
self.action = None self.action = None
self.pool = None self.pool = None
self.top_module = None self.top_manifest = None
self.manifest_dict = None self.manifest_dict = None
super(ModuleCore, self).__init__() super(ModuleCore, self).__init__()
def set_pool(self, pool): def set_pool(self, pool):
"""Set the associated pool for the module instance""" """Set the associated pool for the module instance"""
self.pool = pool self.pool = pool
self.top_module = pool.get_top_module() self.top_manifest = pool.get_top_manifest()
def process_manifest(self): def process_manifest(self):
"""Method that process the core manifest section""" """Method that process the core manifest section"""
......
...@@ -118,7 +118,7 @@ PARSE START: %s ...@@ -118,7 +118,7 @@ PARSE START: %s
if self.parent is None: if self.parent is None:
extra_context = {} extra_context = {}
else: else:
extra_context = dict(self.top_module.manifest_dict) extra_context = dict(self.top_manifest.manifest_dict)
extra_context["__manifest"] = self.path extra_context["__manifest"] = self.path
# The parse method is where most of the parser action takes place! # The parse method is where most of the parser action takes place!
......
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