The environment is not being actually checked, store the options directly

parent 5a9b2802
...@@ -78,10 +78,10 @@ def main(): ...@@ -78,10 +78,10 @@ def main():
logging.debug(str(options)) logging.debug(str(options))
# Create a ModulePool object, this will become our workspace # Create a ModulePool object, this will become our workspace
modules_pool = ModulePool() modules_pool = ModulePool(options)
# Set the module_pool environment by providing the options: this is a must! # Set the module_pool environment by providing the options: this is a must!
modules_pool.env = Env(options) #modules_pool.env = Env(options)
# Now, we add the first module, the one from which we are launching # Now, we add the first module, the one from which we are launching
# the program: # the program:
...@@ -111,7 +111,7 @@ def main(): ...@@ -111,7 +111,7 @@ def main():
def _action_runner(modules_pool): def _action_runner(modules_pool):
"""Funtion that decodes and executed the action selected by the user""" """Funtion that decodes and executed the action selected by the user"""
options = modules_pool.env.options options = modules_pool.options
if options.command == "manifest-help": if options.command == "manifest-help":
ManifestParser().print_help() ManifestParser().print_help()
quit() quit()
......
...@@ -37,12 +37,11 @@ class Action(list): ...@@ -37,12 +37,11 @@ class Action(list):
"""This is the base class providing the common Action methods""" """This is the base class providing the common Action methods"""
def __init__(self, *args): def __init__(self, options):
self.top_module = None self.top_module = None
self._deps_solved = False self._deps_solved = False
self.env = None self.options = options
list.__init__(self, *args) super(Action, self).__init__()
super(Action, self).__init__(*args)
def new_module(self, parent, url, source, fetchto): def new_module(self, parent, url, source, fetchto):
"""Add new module to the pool. """Add new module to the pool.
......
...@@ -134,20 +134,20 @@ class ActionCore(Action): ...@@ -134,20 +134,20 @@ class ActionCore(Action):
for mod_aux in unfetched_modules: for mod_aux in unfetched_modules:
logging.warning( logging.warning(
"List incomplete, module %s has not been fetched!", mod_aux) "List incomplete, module %s has not been fetched!", mod_aux)
file_set = self.build_file_set(top_entity=self.env.options.top) file_set = self.build_file_set(top_entity=self.options.top)
file_list = dep_solver.make_dependency_sorted_list(file_set) file_list = dep_solver.make_dependency_sorted_list(file_set)
files_str = [file_aux.path for file_aux in file_list] files_str = [file_aux.path for file_aux in file_list]
if self.env.options.reverse is True: if self.options.reverse is True:
files_str.reverse() files_str.reverse()
if self.env.options.delimiter is None: if self.options.delimiter is None:
delimiter = "\n" delimiter = "\n"
else: else:
delimiter = self.env.options.delimiter delimiter = self.options.delimiter
print(delimiter.join(files_str)) print(delimiter.join(files_str))
def _print_comment(self, message): def _print_comment(self, message):
"""Private method that prints a message to stdout if not terse""" """Private method that prints a message to stdout if not terse"""
if not self.env.options.terse: if not self.options.terse:
print(message) print(message)
def _print_file_list(self, file_list): def _print_file_list(self, file_list):
...@@ -187,7 +187,7 @@ class ActionCore(Action): ...@@ -187,7 +187,7 @@ class ActionCore(Action):
self._print_comment("# * This is the root module") self._print_comment("# * This is the root module")
print("%s\t%s" % (path_mod.relpath(mod_aux.path), print("%s\t%s" % (path_mod.relpath(mod_aux.path),
_convert_to_source_name(mod_aux.source))) _convert_to_source_name(mod_aux.source)))
if self.env.options.withfiles: if self.options.withfiles:
self._print_file_list(mod_aux.files) self._print_file_list(mod_aux.files)
self._print_comment("# MODULE END -> %s" % mod_aux.url) self._print_comment("# MODULE END -> %s" % mod_aux.url)
self._print_comment("") self._print_comment("")
...@@ -197,7 +197,7 @@ class ActionCore(Action): ...@@ -197,7 +197,7 @@ class ActionCore(Action):
self.check_all_fetched_or_quit() self.check_all_fetched_or_quit()
logging.info("Merging all cores into one source file per language.") logging.info("Merging all cores into one source file per language.")
flist = self.build_file_set() flist = self.build_file_set()
base = self.env.options.dest base = self.options.dest
file_header = ( file_header = (
"\n\n\n\n" "\n\n\n\n"
......
...@@ -38,7 +38,7 @@ class ActionTree(Action): ...@@ -38,7 +38,7 @@ class ActionTree(Action):
def _generate_tree_web(self, hierarchy, top_id): def _generate_tree_web(self, hierarchy, top_id):
"""Create a JSON file containing the graph hierarchy from pool""" """Create a JSON file containing the graph hierarchy from pool"""
if self.env.options.web: if self.options.web:
try: try:
import json import json
from networkx.readwrite import json_graph from networkx.readwrite import json_graph
...@@ -57,7 +57,7 @@ class ActionTree(Action): ...@@ -57,7 +57,7 @@ class ActionTree(Action):
twopi, gvcolor, wc, ccomps, tred, sccmap, fdp, twopi, gvcolor, wc, ccomps, tred, sccmap, fdp,
circo, neato, acyclic, nop, gvpr, dot, sfdp circo, neato, acyclic, nop, gvpr, dot, sfdp
""" """
if self.env.options.graphviz: if self.options.graphviz:
try: try:
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import networkx as nx import networkx as nx
...@@ -65,7 +65,7 @@ class ActionTree(Action): ...@@ -65,7 +65,7 @@ class ActionTree(Action):
logging.error(error_import) logging.error(error_import)
quit() quit()
pos = nx.graphviz_layout(hierarchy, pos = nx.graphviz_layout(hierarchy,
prog=self.env.options.graphviz, prog=self.options.graphviz,
root=top_id) root=top_id)
nx.draw(hierarchy, pos, nx.draw(hierarchy, pos,
with_labels=True, with_labels=True,
...@@ -84,7 +84,7 @@ class ActionTree(Action): ...@@ -84,7 +84,7 @@ class ActionTree(Action):
unfetched_modules = False unfetched_modules = False
hierarchy = nx.DiGraph() hierarchy = nx.DiGraph()
if self.env.options.solved: if self.options.solved:
logging.warning("This is the solved tree") logging.warning("This is the solved tree")
else: else:
for mod_aux in self: for mod_aux in self:
...@@ -98,7 +98,7 @@ class ActionTree(Action): ...@@ -98,7 +98,7 @@ class ActionTree(Action):
else: else:
hierarchy.add_node(path.relpath(mod_aux.path)) hierarchy.add_node(path.relpath(mod_aux.path))
top_id = path.relpath(mod_aux.path) top_id = path.relpath(mod_aux.path)
if self.env.options.withfiles: if self.options.withfiles:
if len(mod_aux.files): if len(mod_aux.files):
for file_aux in mod_aux.files: for file_aux in mod_aux.files:
hierarchy.add_edge(path.relpath(mod_aux.path), hierarchy.add_edge(path.relpath(mod_aux.path),
......
...@@ -205,9 +205,9 @@ PARSE START: %s ...@@ -205,9 +205,9 @@ PARSE START: %s
manifest_parser = ManifestParser() manifest_parser = ManifestParser()
manifest_parser.add_prefix_code( manifest_parser.add_prefix_code(
self.pool.env.options.prefix_code) self.pool.options.prefix_code)
manifest_parser.add_sufix_code( manifest_parser.add_sufix_code(
self.pool.env.options.sufix_code) self.pool.options.sufix_code)
manifest_parser.add_manifest(self.path) manifest_parser.add_manifest(self.path)
......
...@@ -42,7 +42,7 @@ class ToolSim(ToolMakefile): ...@@ -42,7 +42,7 @@ class ToolSim(ToolMakefile):
dep_files = fset.filter(DepFile) dep_files = fset.filter(DepFile)
# dep_solver.solve(dep_files) # dep_solver.solve(dep_files)
self.makefile_setup(manifest_project_dict, dep_files, self.makefile_setup(manifest_project_dict, dep_files,
filename=pool.env.options.filename) filename=pool.options.filename)
self.makefile_check_tool('sim_path') self.makefile_check_tool('sim_path')
self.makefile_sim_top() self.makefile_sim_top()
self.makefile_sim_options() self.makefile_sim_options()
......
...@@ -58,7 +58,7 @@ class ToolSyn(ToolMakefile): ...@@ -58,7 +58,7 @@ class ToolSyn(ToolMakefile):
len(privative_files)) len(privative_files))
fileset.add(privative_files) fileset.add(privative_files)
self.makefile_setup(manifest_project_dict, fileset, self.makefile_setup(manifest_project_dict, fileset,
filename=pool.env.options.filename) filename=pool.options.filename)
self.makefile_check_tool('syn_path') self.makefile_check_tool('syn_path')
self.makefile_includes() self.makefile_includes()
self.makefile_syn_top() self.makefile_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