Salome HOME
sat as no link
authorChristian Van Wambeke <christian.van-wambeke@cea.fr>
Wed, 27 Jun 2018 10:50:13 +0000 (12:50 +0200)
committerChristian Van Wambeke <christian.van-wambeke@cea.fr>
Wed, 27 Jun 2018 10:50:13 +0000 (12:50 +0200)
salomeTools.py [deleted file]
sat [changed from symlink to file mode: 0755]
src/logger.py
src/loggingSimple.py
src/xmlManager.py

diff --git a/salomeTools.py b/salomeTools.py
deleted file mode 100755 (executable)
index a8e1fd6..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-
-#  Copyright (C) 2010-2018  CEA/DEN
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-
-"""
-This file is the main entry file to use salomeTools,
-in mode Command Line Argument(s) (CLI)
-"""
-
-import os
-import sys
-
-# exit OKSYS and KOSYS seems equal on linux or windows
-OKSYS = 0  # OK
-KOSYS = 1  # KO
-
-# get path to salomeTools sources
-satdir = os.path.dirname(os.path.realpath(__file__))
-srcdir = os.path.join(satdir, 'src')
-cmdsdir = os.path.join(satdir, 'commands')
-
-# Make the src & commands package accessible from all code
-sys.path.insert(0, satdir)
-sys.path.insert(0, srcdir) # TODO remove that
-sys.path.insert(0, cmdsdir) # TODO remove that
-
-import src.logger as LOG
-import src.debug as DBG # Easy print stderr (for DEBUG only)
-
-logger = LOG.getDefaultLogger()
-
-#################################
-# MAIN
-#################################
-if __name__ == "__main__":
-    from src.salomeTools import Sat # it is time to do import
-
-    _debug = False # Have to be False in production (for programmers DEBUG only)
-    DBG.push_debug(_debug) # as __main__ with sys.exit so no need pop_debug
-
-    args = sys.argv[1:] # skip useless "sat'
-    sat = Sat(logger) # instantiate the salomeTools class
-
-    try:
-      returnCode = sat.execute_cli(args)
-    except Exception as e:
-      # error as may be unknown problem
-      # verbose debug message with traceback if developers
-      msg = "Exception raised for execute_cli('%s'):\n" % " ".join(args)
-      logger.critical(DBG.format_exception(msg))
-      logger.close() # important to close logger
-      sys.exit(KOSYS)
-
-    # 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.close() # important to close logger
-    sys.exit(returnCode.toSys())
-
-
-else:
-    logger.critical("forbidden/unexpected mode for __name__ '%s'" % __name__)
-    logger.close() # important to close logger
-    sys.exit(KOSYS)
-
-
-
diff --git a/sat b/sat
deleted file mode 120000 (symlink)
index 19cd1ab237a6dee557b56423fd42d2beb877d616..0000000000000000000000000000000000000000
--- a/sat
+++ /dev/null
@@ -1 +0,0 @@
-salomeTools.py
\ No newline at end of file
diff --git a/sat b/sat
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..a8e1fd6de949d37000c264a961d7bf2d9ae6f38b
--- /dev/null
+++ b/sat
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+#  Copyright (C) 2010-2018  CEA/DEN
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+
+"""
+This file is the main entry file to use salomeTools,
+in mode Command Line Argument(s) (CLI)
+"""
+
+import os
+import sys
+
+# exit OKSYS and KOSYS seems equal on linux or windows
+OKSYS = 0  # OK
+KOSYS = 1  # KO
+
+# get path to salomeTools sources
+satdir = os.path.dirname(os.path.realpath(__file__))
+srcdir = os.path.join(satdir, 'src')
+cmdsdir = os.path.join(satdir, 'commands')
+
+# Make the src & commands package accessible from all code
+sys.path.insert(0, satdir)
+sys.path.insert(0, srcdir) # TODO remove that
+sys.path.insert(0, cmdsdir) # TODO remove that
+
+import src.logger as LOG
+import src.debug as DBG # Easy print stderr (for DEBUG only)
+
+logger = LOG.getDefaultLogger()
+
+#################################
+# MAIN
+#################################
+if __name__ == "__main__":
+    from src.salomeTools import Sat # it is time to do import
+
+    _debug = False # Have to be False in production (for programmers DEBUG only)
+    DBG.push_debug(_debug) # as __main__ with sys.exit so no need pop_debug
+
+    args = sys.argv[1:] # skip useless "sat'
+    sat = Sat(logger) # instantiate the salomeTools class
+
+    try:
+      returnCode = sat.execute_cli(args)
+    except Exception as e:
+      # error as may be unknown problem
+      # verbose debug message with traceback if developers
+      msg = "Exception raised for execute_cli('%s'):\n" % " ".join(args)
+      logger.critical(DBG.format_exception(msg))
+      logger.close() # important to close logger
+      sys.exit(KOSYS)
+
+    # 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.close() # important to close logger
+    sys.exit(returnCode.toSys())
+
+
+else:
+    logger.critical("forbidden/unexpected mode for __name__ '%s'" % __name__)
+    logger.close() # important to close logger
+    sys.exit(KOSYS)
+
+
+
index f50ae77e85510555dd0b6eee0bffbe8d8023fe92..44005401e71493f929bc03adacdca7fea05c00eb 100755 (executable)
@@ -468,7 +468,7 @@ def setCurrentLogger(logger):
   """temporary send all in stdout as simple logging logger"""
   if len(_currentLogger) == 0:
     _currentLogger.append(logger)
-    logger.warning("set current logger as %s" % logger.name)
+    logger.debug("set current logger as %s" % logger.name)
   else:
     if _currentLogger[0].name != logger.name:
       # logger.debug("quit current logger as default %s" % _currentLogger[0].name)
index 7073e4d5882becbce8c832c7817057b0f731fb95..07bae8805509725663d7289849b7132427c88faa 100755 (executable)
@@ -410,7 +410,7 @@ def initLoggerAsDefault(logger, fmt=None, level=None):
   if level is not None:  # level could be modified during execution
     handler.setLevel(level)  # on screen log as user wants
   else:
-    handler.setLevel(LOGI.STEP)  # on screen no log step, which are in xml files
+    handler.setLevel(LOGI.INFO)  # on screen no log step, which are in xml files
   return
 
 
index d619980da281368a9bf182596bca6b5517c17dee..20ef4e5906303577d31aca93aec52f05c69f9298 100644 (file)
@@ -77,7 +77,7 @@ class XmlLogFile(object):
         return res
 
 
-def write_tree(self, stylesheet=None, file_path = None):
+    def write_tree(self, stylesheet=None, file_path = None):
         '''Write the xml tree in the log file path. Add the stylesheet if asked.
         
         :param stylesheet str: The stylesheet to apply to the xml file
@@ -241,4 +241,4 @@ def write_report(filename, xmlroot, stylesheet):
         f.write("<?xml-stylesheet type='text/xsl' href='%s'?>\n" % stylesheet)
     f.write(etree.tostring(xmlroot, encoding='utf-8'))
     f.close()   
-    
\ No newline at end of file
+