From: crouzet Date: Fri, 29 Nov 2019 10:12:09 +0000 (+0100) Subject: Suppress stack printing for SAT exceptions (unless debug mode is active) X-Git-Tag: 5.5.0~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=10c7f8795cc52031c623eb1303bf49a8fe9cfe4c;p=tools%2Fsat.git Suppress stack printing for SAT exceptions (unless debug mode is active) and also remplace assert by sat exception in compile.py suppress a confusing warning message in sat message translation modification --- diff --git a/commands/compile.py b/commands/compile.py index 8010b33..e0a1f99 100644 --- a/commands/compile.py +++ b/commands/compile.py @@ -93,11 +93,14 @@ def find_path_graph(graph, start, end, path=[]): # return in sorted_nodes the list of sorted nodes def depth_first_topo_graph(graph, start, visited=[], sorted_nodes=[]): visited = visited + [start] + if start not in graph: + raise src.SatException('Error in product dependencies : %s product is referenced in products dependencies but is not present in the application !' % start) for node in graph[start]: if node not in visited: visited,sorted_nodes=depth_first_topo_graph(graph, node, visited,sorted_nodes) else: - assert node in sorted_nodes, 'Error : cycle detection for node %s and %s !' % (start,node) + if node not in sorted_nodes: + raise src.SatException('Error in product dependencies : cycle detection for node %s and %s !' % (start,node)) sorted_nodes = sorted_nodes + [start] return visited,sorted_nodes diff --git a/sat b/sat index b162b7a..04bdd16 100755 --- a/sat +++ b/sat @@ -68,12 +68,7 @@ if __name__ == "__main__": # no Exception but may be known problem DBG.write("execute_cli return code", returnCode) - if returnCode.isOk(): - # OK no trace - logger.step("sat exit code: %s" % returnCode) - else: - # KO warning as known problem have to say why - logger.warning("sat exit code: %s" % returnCode) + logger.step("sat exit code: %s" % returnCode) logger.close() # important to close logger sys.exit(returnCode.toSys()) diff --git a/src/i18n/fr/LC_MESSAGES/salomeTools.po b/src/i18n/fr/LC_MESSAGES/salomeTools.po index 0fea97d..758dc11 100644 --- a/src/i18n/fr/LC_MESSAGES/salomeTools.po +++ b/src/i18n/fr/LC_MESSAGES/salomeTools.po @@ -1846,7 +1846,7 @@ msgid "shows global help or help on a specific command." msgstr "affiche l'aide générale ou pour une commande spécifique." msgid "overwrites a configuration parameters." -msgstr "écrase un parametre de configuration." +msgstr "modifie un parametre de configuration." msgid "run salomeTools in debug mode." msgstr "lance salomeTools en mode debug." diff --git a/src/salomeTools.py b/src/salomeTools.py index 9c5da61..a49524b 100755 --- a/src/salomeTools.py +++ b/src/salomeTools.py @@ -480,8 +480,18 @@ class Sat(object): if res is None: res = 0 + except src.SatException as e: + # for sat exception do not display the stack, unless debug mode is set + logger_command.write("\n***** ", 1) + logger_command.write(src.printcolors.printcError( + "salomeTools ERROR: sat %s" % __nameCmd__), 1) + logger_command.write(" *****\n", 1) + print(e.message) + if self.options.debug_mode: + logger_command.write("\n" + DBG.format_exception("") + "\n", 1) + except Exception as e: - # Get error + # here we print the stack in addition logger_command.write("\n***** ", 1) logger_command.write(src.printcolors.printcError( "salomeTools ERROR: sat %s" % __nameCmd__), 1)