Commit 417d1f93 authored by Tristan Gingold's avatar Tristan Gingold

Minor renaming. Add comments.

parent 82d2f907
......@@ -42,7 +42,7 @@ class Action(object):
def __init__(self, options):
super(Action, self).__init__()
self.top_manifest = None
self.manifests = []
self.all_manifests = []
self.parseable_fileset = SourceFileSet()
self.privative_fileset = SourceFileSet()
self._deps_solved = False
......@@ -55,7 +55,7 @@ class Action(object):
Thanks to it the pool can easily control its content
"""
# If the module is already present, do not create it.
for mod in self.manifests:
for mod in self.all_manifests:
if mod.url == url:
return None
# A new module will be added, dependencies have to be computed.
......@@ -63,7 +63,7 @@ class Action(object):
args = ModuleArgs()
args.set_args(parent, url, source, fetchto)
res = Module(args, self)
self.manifests.append(res)
self.all_manifests.append(res)
return res
def load_all_manifests(self):
......@@ -106,7 +106,7 @@ class Action(object):
"""Build file set with all the files listed in the complete pool"""
logging.debug("Begin build complete file set")
all_manifested_files = SourceFileSet()
for manifest in self.manifests:
for manifest in self.all_manifests:
all_manifested_files.add(manifest.files)
logging.debug("End build complete file set")
return all_manifested_files
......@@ -143,11 +143,10 @@ class Action(object):
def solve_file_set(self):
"""Build file set with only those files required by the top entity"""
if not self._deps_solved:
if self.tool == None:
dep_solver.solve(self.parseable_fileset)
else:
dep_solver.solve(self.parseable_fileset,
self.tool.get_standard_libs())
libs = None
if self.tool is not None:
libs = self.tool.get_standard_libs()
dep_solver.solve(self.parseable_fileset, libs)
self._deps_solved = True
if self.options.all_files:
# If option -all is used, no need to compute dependencies.
......@@ -164,4 +163,4 @@ class Action(object):
def __str__(self):
"""Cast the module list as a list of strings"""
return str([str(m) for m in self.manifests])
return str([str(m) for m in self.all_manifests])
......@@ -51,12 +51,12 @@ class Commands(Action):
def _check_all_fetched(self):
"""Check if every module in the pool is fetched"""
if not len([m for m in self.manifests if not m.isfetched]) == 0:
if not len([m for m in self.all_manifests if not m.isfetched]) == 0:
raise Exception(
"Fetching should be done before continuing.\n"
"The following modules remains unfetched:\n"
" {}".format(
"\n ".join([str(m) for m in self.manifests
"\n ".join([str(m) for m in self.all_manifests
if not m.isfetched])))
def makefile(self):
......@@ -98,7 +98,7 @@ class Commands(Action):
new_modules.extend(module.modules[m])
return new_modules
fetch_queue = self.manifests[:] # Need a copy of the list
fetch_queue = self.all_manifests[:] # Need a copy of the list
while len(fetch_queue) > 0:
cur_mod = fetch_queue.pop()
......@@ -119,12 +119,12 @@ class Commands(Action):
def fetch(self):
"""Fetch the missing required modules from their remote origin"""
logging.info("Fetching needed modules.")
for mod in self.manifests:
for mod in self.all_manifests:
if mod.isfetched and not mod.manifest_dict == None:
if 'fetch_pre_cmd' in mod.manifest_dict:
os.system(mod.manifest_dict.get("fetch_pre_cmd", ''))
self._fetch_all()
for mod in self.manifests:
for mod in self.all_manifests:
if mod.isfetched and not mod.manifest_dict == None:
if 'fetch_post_cmd' in mod.manifest_dict:
os.system(mod.manifest_dict.get("fetch_post_cmd", ''))
......@@ -133,7 +133,7 @@ class Commands(Action):
def clean(self):
"""Delete the local copy of the fetched modules"""
logging.info("Removing fetched modules..")
remove_list = [mod_aux for mod_aux in self.manifests
remove_list = [mod_aux for mod_aux in self.all_manifests
if mod_aux.source in ['git', 'gitsm', 'svn']
and mod_aux.isfetched]
remove_list.reverse() # we will remove modules in backward order
......@@ -177,7 +177,7 @@ class Commands(Action):
def list_files(self):
"""List the files added to the design across the pool hierarchy"""
unfetched_modules = [mod_aux for mod_aux in self.manifests
unfetched_modules = [mod_aux for mod_aux in self.all_manifests
if not mod_aux.isfetched]
for mod_aux in unfetched_modules:
logging.warning(
......@@ -214,7 +214,7 @@ class Commands(Action):
def list_modules(self):
"""List the modules that are contained by the pool"""
for mod_aux in self.manifests:
for mod_aux in self.all_manifests:
if not mod_aux.isfetched:
logging.warning("Module not fetched: %s", mod_aux.url)
self._print_comment("# MODULE UNFETCHED! -> %s" % mod_aux.url)
......
......@@ -49,8 +49,8 @@ def solve(fileset, standard_libs=None):
from .dep_file import DepRelation
assert isinstance(fileset, SourceFileSet)
fset = fileset.filter(DepFile)
# print(fileset)
# print(fset)
# Parse source files
logging.debug("PARSE BEGIN: Here, we will parse all the files in the "
"fileset: no parsing should be done beyond this point")
for investigated_file in fset:
......
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