Commit 2ff181e5 authored by Nicolas Chevillot's avatar Nicolas Chevillot

Replaced sys.exit with exception

parent f6ba3e94
......@@ -38,7 +38,7 @@ def set_logging_level(options):
"""Set the log level and config (A.K.A. log verbosity)"""
numeric_level = getattr(logging, options.log.upper(), None)
if not isinstance(numeric_level, int):
sys.exit('Invalid log level: %s' % options.log)
raise Exception('Invalid log level: %s' % options.log)
if not shell.check_windows() and options.logfile == None:
logging.basicConfig(
......@@ -117,11 +117,10 @@ class Action(list):
def _check_manifest_variable_is_set(self, name):
"""Method to check if a specific manifest variable is set"""
if getattr(self.top_module, name) is None:
logging.error(
raise Exception(
"Variable %s must be set in the manifest "
"to perform current action (%s)",
name, self.__class__.__name__)
sys.exit("\nExiting")
def _check_manifest_variable_value(self, name, value):
"""Method to check if a manifest variable is set to a specific value"""
......@@ -131,10 +130,9 @@ class Action(list):
variable_match = True
if variable_match is False:
logging.error(
raise Exception(
"Variable %s must be set in the manifest and equal to '%s'.",
name, value)
sys.exit("Exiting")
def build_complete_file_set(self):
"""Build file set with all the files listed in the complete pool"""
......
......@@ -83,8 +83,7 @@ class ActionCore(Action):
elif module.source is LOCAL:
result = self.local_backend.fetch(module)
if result is False:
logging.error("Unable to fetch module %s", str(module.url))
sys.exit("Exiting")
raise Exception("Unable to fetch module %s", str(module.url))
module.parse_manifest()
new_modules.extend(module.local)
new_modules.extend(module.svn)
......
......@@ -91,10 +91,9 @@ class ModuleConfig(object):
return False
filepath = os.path.join(self.path, filepath)
if not os.path.exists(filepath):
logging.error(
raise Exception(
"Path specified in manifest in %s doesn't exist: %s",
self.path, filepath)
sys.exit("Exiting")
filepath = path_mod.rel2abs(filepath, self.path)
if os.path.isdir(filepath):
......
......@@ -14,11 +14,9 @@ from hdlmake.srcfile import VerilogFile, VHDLFile, SVFile
def _check_simulation_manifest(manifest_dict):
"""Check if the simulation keys are provided by the top manifest"""
if not manifest_dict["sim_top"]:
logging.error("sim_top variable must be set in the top manifest.")
sys.exit("Exiting")
raise Exception("sim_top variable must be set in the top manifest.")
if not manifest_dict["sim_tool"]:
logging.error("sim_tool variable must be set in the top manifest.")
sys.exit("Exiting")
raise Exception("sim_tool variable must be set in the top manifest.")
class ToolSim(ToolMakefile):
......
......@@ -14,21 +14,17 @@ from hdlmake.srcfile import VerilogFile, SVFile
def _check_synthesis_manifest(manifest_dict):
"""Check the manifest contains all the keys for a synthesis project"""
if not manifest_dict["syn_tool"]:
logging.error(
raise Exception(
"syn_tool variable must be set in the top manifest.")
sys.exit("Exiting")
if not manifest_dict["syn_device"]:
logging.error(
raise Exception(
"syn_device variable must be set in the top manifest.")
sys.exit("Exiting")
if not manifest_dict["syn_grade"]:
logging.error(
raise Exception(
"syn_grade variable must be set in the top manifest.")
sys.exit("Exiting")
if not manifest_dict["syn_package"]:
logging.error(
raise Exception(
"syn_package variable must be set in the top manifest.")
sys.exit("Exiting")
if not manifest_dict["syn_top"]:
logging.error(
"syn_top variable must be set in the top manifest.")
......
......@@ -135,9 +135,8 @@ class ToolQuartus(ToolSyn):
"Auto-guessed syn_family to be %s (%s => %s)",
family, device, key)
if family is None:
logging.error("Could not auto-guess device family, please "
raise Exception("Could not auto-guess device family, please "
"specify in Manifest.py using syn_family!")
sys.exit("\nExiting")
return family
family_string = __get_family_string(
......
......@@ -119,10 +119,9 @@ class VerilogPreprocessor(object):
probable_file = os.path.join(searchdir, filename)
if os.path.isfile(probable_file):
return os.path.abspath(probable_file)
logging.error("Can't find %s for %s in any of the include "
raise Exception("Can't find %s for %s in any of the include "
"directories: %s", filename, self.vlog_file.file_path,
', '.join(self.vlog_file.include_dirs))
sys.exit("\nExiting")
def _parse_macro_def(self, macro):
"""Parse the provided 'macro' and, if it's not a reserved keyword,
......
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