X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=salomeTools.py;h=34ee85c9a761df5e93f1cc3440165abb7a356b19;hb=4e69a3391ebde58cbab948f9a82dd12bff4b7999;hp=4a7aa52d2f9997dfd0403f8a9d83eaeae9b06ccc;hpb=7f04114e1b2d7a21f0a979a4f969cc5c6d59d9ee;p=tools%2Fsat.git diff --git a/salomeTools.py b/salomeTools.py index 4a7aa52..34ee85c 100755 --- a/salomeTools.py +++ b/salomeTools.py @@ -22,6 +22,7 @@ # python imports import os import sys +import tempfile import imp import types import gettext @@ -143,8 +144,13 @@ class Sat(object): # Exception for the jobs command that requires the paramiko module if nameCmd == "jobs": try: + saveout = sys.stderr + ff = tempfile.TemporaryFile() + sys.stderr = ff import paramiko + sys.stderr = saveout except: + sys.stderr = saveout continue # load the module that has name nameCmd in dirPath @@ -207,26 +213,32 @@ class Sat(object): silent = (self.cfg.USER.output_verbose_level == 0) # create log file + micro_command = False + if logger_add_link: + micro_command = True logger_command = src.logger.Logger(self.cfg, silent_sysstd=silent, - all_in_terminal=self.options.all_in_terminal) + all_in_terminal=self.options.all_in_terminal, + micro_command=micro_command) # Check that the path given by the logs_paths_in_file option # is a file path that can be written - if options.logs_paths_in_file: + if self.options.logs_paths_in_file: try: - dir_file = os.path.dirname(options.logs_paths_in_file) + self.options.logs_paths_in_file = os.path.abspath( + self.options.logs_paths_in_file) + dir_file = os.path.dirname(self.options.logs_paths_in_file) if not os.path.exists(dir_file): os.makedirs(dir_file) - if os.path.exists(options.logs_paths_in_file): - os.remove(options.logs_paths_in_file) - file_test = open(options.logs_paths_in_file, "w") + if os.path.exists(self.options.logs_paths_in_file): + os.remove(self.options.logs_paths_in_file) + file_test = open(self.options.logs_paths_in_file, "w") file_test.close() except Exception as e: msg = _("WARNING: the logs_paths_in_file option will " "not be taken into account.\nHere is the error:") logger_command.write("%s\n%s\n\n" % (src.printcolors.printcWarning(msg), str(e))) - options.logs_paths_in_file = None + self.options.logs_paths_in_file = None try: res = None @@ -261,14 +273,10 @@ class Sat(object): # Add a link to the parent command if logger_add_link is not None: - xmlLinks = logger_add_link.xmlFile.xmlroot.find( - "Links") - src.xmlManager.add_simple_node(xmlLinks, - "link", - text = logger_command.logFileName, - attrib = {"command" : __nameCmd__, - "passed" : res, - "launchedCommand" : launchedCommand}) + logger_add_link.add_link(logger_command.logFileName, + __nameCmd__, + res, + launchedCommand) logger_add_link.l_logFiles += logger_command.l_logFiles finally: @@ -288,8 +296,8 @@ class Sat(object): res = 1 # If the logs_paths_in_file was called, write the result # and log files in the given file path - if options.logs_paths_in_file: - file_res = open(options.logs_paths_in_file, "w") + if self.options.logs_paths_in_file: + file_res = open(self.options.logs_paths_in_file, "w") file_res.write(str(res) + "\n") for i, filepath in enumerate(logger_command.l_logFiles): file_res.write(filepath)