Refactor the checking for remote modules fetch status

parent 125dbf7d
......@@ -83,11 +83,9 @@ class Action(list):
"""
from hdlmake.module import Module, ModuleArgs
self._deps_solved = False
new_module_args = ModuleArgs()
new_module_args.set_args(parent, url, source, fetchto)
new_module = Module(new_module_args, self)
if not self.__contains(new_module):
self._add(new_module)
if not self.top_module:
......@@ -96,21 +94,8 @@ class Action(list):
url = self._guess_origin(self.top_module.path)
if url:
self.top_module.url = url
return new_module
def check_all_fetched_or_quit(self):
"""Check if every module in the pool is fetched"""
if not len([m for m in self if not m.isfetched]) == 0:
logging.error(
"Fetching must be done before continuing.\n"
"The following modules remains unfetched:\n"
"%s",
"\n".join([str(m) for m in self if not m.isfetched])
)
quit()
def _check_manifest_variable_is_set(self, name):
"""Method to check if a specific manifest variable is set"""
if getattr(self.top_module, name) is None:
......@@ -165,12 +150,13 @@ class Action(list):
config_dict = {}
for mod in self:
manifest_dict_tmp = mod.manifest_dict
if 'fetchto' in manifest_dict_tmp:
manifest_dict_tmp['fetchto'] = os.path.relpath(os.path.join(
mod.path,
mod.manifest_dict['fetchto']))
manifest_dict_tmp.update(config_dict)
config_dict = manifest_dict_tmp
if not manifest_dict_tmp == None:
if 'fetchto' in manifest_dict_tmp:
manifest_dict_tmp['fetchto'] = os.path.relpath(os.path.join(
mod.path,
mod.manifest_dict['fetchto']))
manifest_dict_tmp.update(config_dict)
config_dict = manifest_dict_tmp
return config_dict
def _add(self, new_module):
......
......@@ -47,10 +47,21 @@ class ActionCore(Action):
self.svn_backend = Svn()
self.local_backend = Local()
def _check_all_fetched_or_quit(self):
"""Check if every module in the pool is fetched"""
if not len([m for m in self if not m.isfetched]) == 0:
logging.error(
"Fetching must be done before continuing.\n"
"The following modules remains unfetched:\n"
"%s",
"\n".join([str(m) for m in self if not m.isfetched])
)
quit()
def makefile(self):
"""Write the Makefile for the current design"""
self.check_all_fetched_or_quit()
self._check_all_fetched_or_quit()
write_makefile(self)
......
......@@ -32,7 +32,6 @@ class ToolSim(ToolMakefile):
def simulation_makefile(self, pool):
"""Execute the simulation action"""
pool.check_all_fetched_or_quit()
_check_simulation_manifest(pool.config)
fset = pool.build_file_set(
pool.config.get("sim_top"),
......
......@@ -41,7 +41,6 @@ class ToolSyn(ToolMakefile):
def synthesis_makefile(self, pool):
"""Generate a Makefile for the specific synthesis tool"""
pool.check_all_fetched_or_quit()
_check_synthesis_manifest(pool.config)
fileset = pool.build_file_set(
pool.config["syn_top"],
......
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