Quit upon error should generate an error code different than 0

parent 4c8d351c
......@@ -62,7 +62,7 @@ def _action_runner(modules_pool):
options = modules_pool.options
if options.command == "manifest-help":
ManifestParser().print_help()
quit()
quit(0)
elif options.command == "makefile":
modules_pool.makefile()
elif options.command == "fetch":
......
......@@ -93,7 +93,7 @@ class Action(list):
self.top_entity = self.config.get("syn_top")
else:
logging.error("Unknown requested action: %s", action)
quit()
quit(1)
def new_module(self, parent, url, source, fetchto):
"""Add new module to the pool.
......
......@@ -56,7 +56,7 @@ class ActionCore(Action):
"The following modules remains unfetched:\n"
"%s",
"\n".join([str(m) for m in self if not m.isfetched]))
quit()
quit(1)
def makefile(self):
"""Write the Makefile for the current design"""
self._check_all_fetched()
......
......@@ -45,7 +45,7 @@ class ActionTree(Action):
from networkx.readwrite import json_graph
except ImportError as error_import:
logging.error(error_import)
quit()
quit(1)
if self.options.mode == 'dfs':
hierarchy = nx.dfs_tree(hierarchy, top_id)
elif self.options.mode == 'bfs':
......@@ -62,7 +62,7 @@ class ActionTree(Action):
import networkx as nx
except ImportError as error_import:
logging.error(error_import)
quit()
quit(1)
unfetched_modules = False
hierarchy = nx.DiGraph()
......@@ -117,7 +117,7 @@ class ActionTree(Action):
else:
logging.error('Unknown tree mode: %s', self.options.mode)
quit()
quit(1)
if unfetched_modules:
logging.warning("Some of the modules have not been fetched!")
......
......@@ -311,12 +311,12 @@ types:[<type 'int'>]
logging.error("Invalid syntax in the manifest file " +
self.config_file + ":\n" + str(error_syntax))
logging.error(content)
quit()
quit(1)
except SystemExit as error_exit:
logging.error("Exit requested by the manifest file " +
self.config_file + ":\n" + str(error_exit))
logging.error(content)
quit()
quit(1)
except:
logging.error("Encountered unexpected error while parsing " +
self.config_file)
......
......@@ -280,7 +280,7 @@ class ManifestParser(ConfigParser):
"Both manifest.py and Manifest.py" +
"found in the module directory: %s",
path)
quit()
quit(1)
for filename in dir_files:
if filename == "manifest.py" or filename == "Manifest.py":
if not os.path.isdir(filename):
......@@ -297,7 +297,7 @@ class ManifestParser(ConfigParser):
manifest = _search_for_manifest(path)
if manifest is None:
logging.error("No manifest found in path: %s", path)
quit()
quit(1)
else:
logging.debug("Parse manifest in: %s", manifest)
return self.add_config_file(manifest)
......
......@@ -102,7 +102,7 @@ class ModuleContent(ModuleCore):
if path_mod.is_abs_path(path):
logging.error("Found an absolute path (" + path +
") in a manifest(" + self.path + ")")
quit()
quit(1)
path = path_mod.rel2abs(path, self.path)
local_mods.append(self.pool.new_module(parent=self,
url=path,
......
......@@ -78,7 +78,7 @@ class ModuleConfig(object):
logging.error(
"Path to the local module doesn't exist:\n" + url
+ "\nThis module was instantiated in: " + str(self.parent))
quit()
quit(1)
self.path = path_mod.relpath(url)
self.isfetched = True
......
......@@ -169,7 +169,7 @@ PARSE START: %s
logging.error(
"Error while parsing {0}:\n{1}: {2}.".format(
self.path, type(name_error), name_error))
quit()
quit(1)
self.manifest_dict = opt_map
else:
self.manifest_dict = {}
......
......@@ -438,5 +438,5 @@ def create_source_file(path, module, library=None,
else:
logging.error("Cannot create source file %s, "
"unknown file extension %s", path, extension)
quit()
quit(1)
return new_file
......@@ -76,7 +76,7 @@ class ToolISim(ToolSim):
self.manifest_dict["sim_path"], "..", ".."))
else:
logging.error("Cannot calculate xilinx tools base directory")
quit()
quit(1)
hdl_language = 'vhdl' # 'verilog'
if shell.check_windows():
os_prefix = 'nt'
......
......@@ -26,7 +26,7 @@ def load_syn_tool(tool_name):
else:
logging.error("Unknown synthesis tool: %s", tool_name)
logging.error(" Supported synthesis tools are %s", available_tools.keys())
quit()
quit(1)
def load_sim_tool(tool_name):
......@@ -52,4 +52,4 @@ def load_sim_tool(tool_name):
else:
logging.error("Unknown simulation tool: %s", tool_name)
logging.error(" Supported simulation tools are %s", available_tools.keys())
quit()
quit(1)
......@@ -213,7 +213,7 @@ class ToolQuartus(ToolSyn):
logging.error("quartus_preflow file listed in "
+ os.getcwd() + " doesn't exist: "
+ path + ".\nExiting.")
quit()
quit(1)
preflow = '"' + 'quartus_sh:' + path + '"'
command_list.append(self._emit_property(self.SET_GLOBAL_ASSIGNMENT,
{'name_type': 'PRE_FLOW_SCRIPT_FILE',
......@@ -226,7 +226,7 @@ class ToolQuartus(ToolSyn):
logging.error("quartus_postmodule file listed in "
+ os.getcwd() + " doesn't exist: "
+ path + ".\nExiting.")
quit()
quit(1)
postmodule = '"' + 'quartus_sh:' + path + '"'
command_list.append(self._emit_property(self.SET_GLOBAL_ASSIGNMENT,
{'name_type': 'POST_MODULE_SCRIPT_FILE',
......@@ -238,7 +238,7 @@ class ToolQuartus(ToolSyn):
logging.error("quartus_postflow file listed in "
+ os.getcwd() + " doesn't exist: "
+ path + ".\nExiting.")
quit()
quit(1)
postflow = '"' + 'quartus_sh:' + path + '"'
command_list.append(self._emit_property(self.SET_GLOBAL_ASSIGNMENT,
{'name_type': 'POST_FLOW_SCRIPT_FILE',
......
......@@ -47,7 +47,7 @@ def run(command):
except CalledProcessError as process_error:
logging.error("Cannot execute the shell command: %s",
process_error.output)
quit()
quit(1)
def tclpath(path):
......
......@@ -136,7 +136,7 @@ class VerilogPreprocessor(object):
params = []
if name in self.vpp_keywords:
logging.error("Attempt to `define a reserved preprocessor keyword")
quit()
quit(1)
mdef = self.VLDefine(name, params, expansion)
self.vpp_macros.append(mdef)
return mdef
......
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