Salome HOME
Merge branch 'V7_5_BR'
[modules/kernel.git] / bin / salomeContext.py
index cb580069388fa384bca46f1365d67b9dade68733..954f86fd89344adc396033cb9c4cfccebc004939 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2013-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -36,19 +36,31 @@ def usage():
   #exeName = os.path.splitext(os.path.basename(__file__))[0]
 
   msg = '''\
-Usage: salome [command] [options] [--config=file1,...,filen]
+Usage: salome [command] [options] [--config=<file,folder,...>]
 
 Commands:
-    start         Launches SALOME virtual application [DEFAULT]
-    shell         Executes a script under SALOME application environment
+=========
+    start         Starts a SALOME session (through virtual application)
+    shell         Initializes SALOME environment, and executes scripts passed
+                  as command arguments
     connect       Connects a Python console to the active SALOME session
-    killall       Kill all SALOME running sessions
+    killall       Kill all SALOME running sessions for current user
     info          Display some information about SALOME
     help          Show this message
-    coffee        Yes! SALOME can also make coffee!!"
+    coffee        Yes! SALOME can also make coffee!!
 
-Use salome start --help or salome shell --help
-to show help on start and shell commands.
+If no command is given, default to start.
+
+Command options:
+================
+    Use salome <command> --help to show help on command ; available for start
+    and shell commands.
+
+--config=<file,folder,...>
+==========================
+    Initialize SALOME environment from a list of context files and/or a list
+    of folders containing context files. The list is comma-separated, whithout
+    any blank characters.
 '''
 
   print msg
@@ -209,7 +221,7 @@ class SalomeContext:
       import os
       absoluteAppliPath = os.getenv('ABSOLUTE_APPLI_PATH')
       import sys
-      path = os.path.join(absoluteAppliPath, "bin", "salome")
+      path = os.path.realpath(os.path.join(absoluteAppliPath, "bin", "salome"))
       if not path in sys.path:
         sys.path[:0] = [path]
     except:
@@ -279,6 +291,7 @@ class SalomeContext:
     # set environment
     for reserved in reservedDict:
       a = filter(None, reservedDict[reserved]) # remove empty elements
+      a = [ os.path.realpath(x) for x in a ]
       reformattedVals = os.pathsep.join(a)
       self.addToVariable(reserved, reformattedVals)
       pass
@@ -287,7 +300,9 @@ class SalomeContext:
       self.setVariable(key, val, overwrite=True)
       pass
 
-    sys.path[:0] = os.getenv('PYTHONPATH','').split(os.pathsep)
+    pythonpath = os.getenv('PYTHONPATH','').split(os.pathsep)
+    pythonpath = [ os.path.realpath(x) for x in pythonpath ]
+    sys.path[:0] = pythonpath
   #
 
   def _runAppli(self, args=None):