Quit upon error should generate an error code different than 0

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