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

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