]> SALOME platform Git repositories - tools/sat.git/blobdiff - src/salomeTools.py
Salome HOME
sat #8594 : extension des logs de sat log --last_compile au make check
[tools/sat.git] / src / salomeTools.py
index 1ad0b02ae5aa24d35d9101922d17d3a1277e4adc..251d6ea730b715b9c4b9b6e1c41a72ba586cba1c 100755 (executable)
@@ -89,9 +89,9 @@ parser.add_option('v', 'verbose', 'int', "output_verbose_level",
 parser.add_option('b', 'batch', 'boolean', "batch", 
                   _("batch mode (no question)."))
 parser.add_option('t', 'all_in_terminal', 'boolean', "all_in_terminal", 
-                  _("All traces in the terminal (for example compilation logs)."))
+                  _("all traces in the terminal (for example compilation logs)."))
 parser.add_option('l', 'logs_paths_in_file', 'string', "logs_paths_in_file", 
-                  _("Put the command result and paths to log files in ."))
+                  _("put the command results and paths to log files."))
 
 
 ########################################################################
@@ -234,11 +234,14 @@ class Sat(object):
     def setInternals(self, opt=None, datadir=None):
         """set the commands by calling the dedicated function etc..."""
         options, remaindersArgs = parser.parse_args(opt)
+        if options.debug_mode:
+            DBG.push_debug(True)
         self.arguments = opt
         self.options = options # the generic options passed to salomeTools
         self.remaindersArgs = remaindersArgs  # the command and their options
         self.datadir = datadir # default value will be <salomeTools root>/data
         self._setCommands(cmdsdir)
+        DBG.write("Sat.options", self.options, self.options.debug_mode)
 
     def getConfig(self):
         return self.cfg
@@ -461,7 +464,12 @@ class Sat(object):
                                              src.printcolors.printcWarning(msg),
                                              str(e)))
                         self.options.logs_paths_in_file = None
-                
+
+
+                # do nothing more if help is True
+                if self.options.help:
+                  return 0
+
                 options_launched = ""
                 res = None
                 try:
@@ -477,19 +485,11 @@ class Sat(object):
                     # Get error
                     logger_command.write("\n***** ", 1)
                     logger_command.write(src.printcolors.printcError(
-                                                       "salomeTools ERROR:"), 1)
-                    logger_command.write("\n" + str(e) + "\n\n", 1)
-                    # get stack
-                    __, __, exc_traceback = sys.exc_info()
-                    fp = tempfile.TemporaryFile()
-                    traceback.print_tb(exc_traceback, file=fp)
-                    fp.seek(0)
-                    stack = fp.read()
-                    verbosity = 5
-                    if self.options.debug_mode:
-                        verbosity = 1
-                    logger_command.write("TRACEBACK: %s" % stack.replace('"',"'"),
-                                         verbosity)
+                            "salomeTools ERROR: sat %s" % __nameCmd__), 1)
+
+                    logger_command.write("\n" + DBG.format_exception("") + "\n", 1)
+
+
                 finally:
                     # set res if it is not set in the command
                     if res is None:
@@ -719,7 +719,7 @@ def get_help():
     msg += "\n"
     # Explain how to get the help for a specific command
     msg += src.printcolors.printcHeader(
-        _("Getting the help for a specific command: ")) + \
+        _("Get help for a specific command:")) + \
         "\n>> sat --help <command>\n"
     return msg