Salome HOME
document --keep-paths option
[tools/sat.git] / src / fileEnviron.py
index b6987ae315c461f670b1ca5c69f527bc6315bdd5..d2dffd2f954623e2cc0295e9c9cc9b1117284c37 100644 (file)
@@ -489,11 +489,6 @@ class LauncherFileEnviron(FileEnviron):
         if not self.environ.is_defined("PATH"):
             self.environ.set("PATH","")
 
-        if self.init_path:
-            self.output.write('\n'+self.indent)
-            self.add_echo("Modify this variable to not reset the PATHS")
-            self.output.write(self.indent+'reinitialise_paths=True\n\n')
-
     def add_echo(self, text):
         """Add a comment
         
@@ -749,9 +744,10 @@ then
   # check that the user is not using another shell
   echo
   echo "Warning! SALOME environment not initialized"
-  echo "You must run this script in a bash shell."
+  echo "You must run this script in a BASH shell."
   echo "As you are using another shell. Please first run: bash"
   echo
+  exit 1
 fi
 ##########################################################################
 #
@@ -820,9 +816,20 @@ def main(args):
 
   if args == ['--help']:
     from salomeContext import usage
-    usage()
+    appended_opt_doc = \"""
+--keep-paths
+============
+    With this option the environment variables PATH, PYTHONPATH and LD_LIBRARY_PATH defined into the starting shell are kept.
+    Without this option all values set before starting SALOME are simply ignored.
+\"""
+    usage(appended_opt_doc=appended_opt_doc)
     sys.exit(0)
 
+  reinitialise_paths=True
+  if '--keep-paths' in args:
+    reinitialise_paths=False
+    args.remove('--keep-paths')
+
 
   # Create a SalomeContext which parses configFileNames to initialize environment
   try:
@@ -906,11 +913,22 @@ def main(args):
   # Identify application path then locate configuration files
   __initialize()
 
-  if args == ['--help']:
+  if '--help' in args:
     from salomeContext import usage
-    usage()
+    appended_opt_doc = \"""
+--keep-paths
+============
+    With this option the environment variables PATH, PYTHONPATH and LD_LIBRARY_PATH defined into the starting shell are kept.
+    Without this option all values set before starting SALOME are simply ignored.
+\"""
+    usage(appended_opt_doc=appended_opt_doc)
     sys.exit(0)
 
+  reinitialise_paths=True
+  if '--keep-paths' in args:
+    reinitialise_paths=False
+    args.remove('--keep-paths')
+
   #from salomeContextUtils import getConfigFileNames
   #configFileNames, args, unexisting = getConfigFileNames( args, checkExistence=True )
   #if len(unexisting) > 0: