X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FsalomeTools.py;h=d74ad11122ef877b2bc00c7f5ba1666d166fa240;hb=606f9b6618e0e0659d4029c607eaa04d9b3501cc;hp=ef3857ebc7011f8cf117a20846d3fbff5150c8a7;hpb=0c8ade519224c4058dbc5ae60441269226a5a209;p=tools%2Fsat.git diff --git a/src/salomeTools.py b/src/salomeTools.py index ef3857e..d74ad11 100755 --- a/src/salomeTools.py +++ b/src/salomeTools.py @@ -65,7 +65,10 @@ import commands.config as CONFIG # load resources for internationalization gettext.install("salomeTools", os.path.join(srcdir, "i18n")) -_LANG = os.environ["LANG"] # original locale +try: + _LANG = os.environ["LANG"] # original locale +except: + _LANG = "en_US.utf8" #default # The possible hooks : # pre is for hooks to be executed before commands @@ -86,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.")) ######################################################################## @@ -236,6 +239,7 @@ class Sat(object): self.remaindersArgs = remaindersArgs # the command and their options self.datadir = datadir # default value will be /data self._setCommands(cmdsdir) + DBG.write("Sat.options", self.options, self.options.debug_mode) def getConfig(self): return self.cfg @@ -458,7 +462,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: @@ -474,19 +483,24 @@ 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) + "salomeTools ERROR: sat %s" % __nameCmd__), 1) + + logger_command.write("\n" + DBG.format_exception("") + "\n", 1) + + """ + # have python 3 problems... # get stack __, __, exc_traceback = sys.exc_info() - fp = tempfile.TemporaryFile() + fp = tempfile.TemporaryFile(mode='wt') 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) + logger_command.write("TRACEBACK: %s" % stack.replace('"',"'"), verbosity) + """ + finally: # set res if it is not set in the command if res is None: @@ -716,7 +730,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 \n" return msg