Commit 84b4f4be authored by Tristan Gingold's avatar Tristan Gingold

refactoring

parent 9d0312ec
...@@ -73,10 +73,12 @@ class Action(list): ...@@ -73,10 +73,12 @@ class Action(list):
def load_top_module(self): def load_top_module(self):
# Top level module. # Top level module.
self.new_module(parent=None, assert self.top_module is None
url=os.getcwd(), self.top_module = self.new_module(parent=None,
source=None, url=os.getcwd(),
fetchto=".") source=None,
fetchto=".")
self.top_module.parse_manifest()
self.config = self._get_config_dict() self.config = self._get_config_dict()
def run(self): def run(self):
...@@ -118,9 +120,6 @@ class Action(list): ...@@ -118,9 +120,6 @@ class Action(list):
new_module = Module(new_module_args, self) new_module = Module(new_module_args, self)
if not self.__contains(new_module): if not self.__contains(new_module):
self._add(new_module) self._add(new_module)
if not self.top_module:
self.top_module = new_module
new_module.parse_manifest()
return new_module return new_module
def build_complete_file_set(self): def build_complete_file_set(self):
...@@ -197,8 +196,7 @@ class Action(list): ...@@ -197,8 +196,7 @@ class Action(list):
def _add(self, new_module): def _add(self, new_module):
"""Add the given new module if this is not already in the pool""" """Add the given new module if this is not already in the pool"""
from hdlmake.module import Module from hdlmake.module import Module
if not isinstance(new_module, Module): assert isinstance(new_module, Module), "Expect a Module instance"
raise RuntimeError("Expecting a Module instance")
if self.__contains(new_module): if self.__contains(new_module):
return False return False
if new_module.isfetched: if new_module.isfetched:
......
...@@ -46,9 +46,7 @@ class SourceFile(DepFile): ...@@ -46,9 +46,7 @@ class SourceFile(DepFile):
self.library = library self.library = library
if not library: if not library:
self.library = "work" self.library = "work"
DepFile.__init__(self, DepFile.__init__(self, file_path=path, module=module)
file_path=path,
module=module)
def __hash__(self): def __hash__(self):
return hash(self.path + self.library) return hash(self.path + self.library)
......
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