Salome HOME
nettoyage de la gestion de out_dir_Path et PRODUCT_ROOT_DIR
authorcrouzet <nicolas.crouzet@cea.fr>
Fri, 8 Feb 2019 14:21:28 +0000 (15:21 +0100)
committercrouzet <nicolas.crouzet@cea.fr>
Fri, 8 Feb 2019 14:21:28 +0000 (15:21 +0100)
src/environment.py
src/fileEnviron.py

index ed7970680ab6ef7399ad05c8560b035b29998acb..d342e86871cca1da7e299661e298149ba1f4e6e0 100644 (file)
@@ -383,23 +383,18 @@ class SalomeEnviron:
                 lProdName.append(ProdName)
         return lProdName
 
-    def set_application_env(self, logger, no_PRODUCT_ROOT_DIR=False):
+    def set_application_env(self, logger):
         """\
         Sets the environment defined in the APPLICATION file.
         
         :param logger Logger: The logger instance to display messages
         """
         
-        # add variable PRODUCT_ROOT_DIR as $workdir in APPLICATION.environ section if not present
-        # but if sat launcher or sat package do not duplicate line context.setVariable(r"PRODUCT_ROOT_DIR", ...
-        # no_PRODUCT_ROOT_DIR used only for write_cfgForPy_file
-        if not no_PRODUCT_ROOT_DIR: # do not duplicate context.setVariable(r"PRODUCT_ROOT_DIR"
-          try:
-            tmp = self.cfg.APPLICATION.environ.PRODUCT_ROOT_DIR
-          except:
-            self.cfg.APPLICATION.environ.PRODUCT_ROOT_DIR = src.pyconf.Reference(self.cfg, src.pyconf.DOLLAR, "workdir")
-            DBG.write("set_application_env: add APPLICATION.environ.PRODUCT_ROOT_DIR", self.cfg.APPLICATION.environ)
-          
+        if self.for_package:
+           self.set("PRODUCT_ROOT_DIR", "out_dir_Path")
+        else:
+           self.cfg.APPLICATION.environ.PRODUCT_ROOT_DIR = src.pyconf.Reference(self.cfg, src.pyconf.DOLLAR, "workdir")
+
         # these sensitive variables are reset to avoid bad environment interactions
         self.add_line(1)
         self.add_comment("reset these sensitive variables to avoid bad environment interactions")
@@ -913,7 +908,7 @@ class FileEnvWriter:
 
         else:
             # set env from PRODUCT
-            env.set_application_env(self.logger, no_PRODUCT_ROOT_DIR=True)
+            env.set_application_env(self.logger)
 
             # The list of products to launch
             lProductsName = env.get_names(self.config.APPLICATION.products.keys())
@@ -921,7 +916,6 @@ class FileEnvWriter:
 
             # set the products
             env.set_products(self.logger, src_root=self.src_root)
-            DBG.write("set_application_env without PRODUCT_ROOT_DIR", self.config.APPLICATION.environ)
 
         # Add the additional environment if it is not empty
         if len(additional_env) != 0:
index fa45497f9f8dc1271015ae9c3de0cff712d325ae..ab79916b5a030c22e9223a32d0d453fd44410260 100644 (file)
@@ -25,9 +25,6 @@ bat_header="""\
 
 rem The following variables are used only in case of a sat package
 set out_dir_Path=%~dp0
-set PRODUCT_OUT_DIR=%out_dir_Path%
-set prereq_install_Path=%out_dir_Path%\PREREQUISITES\INSTALL
-set prereq_build_Path=%out_dir_Path%\PREREQUISITES\BUILD
 """
 
 
@@ -70,10 +67,8 @@ out_var=`cleandup $xenv $2`
 export $1=$out_var
 }
 
-# The 3 following variables are used only in case of a sat package
+# This line is used only in case of a sat package
 export out_dir_Path=$(cd $(dirname ${BASH_SOURCE[0]});pwd)
-export PRODUCT_OUT_DIR=${out_dir_Path}
-export PRODUCT_ROOT_DIR=${PRODUCT_OUT_DIR}
 
 ###########################################################################
 """
@@ -851,7 +846,6 @@ def main(args):
     # Logger level error
     context.getLogger().setLevel(40)
 
-    context.setVariable(r"PRODUCT_ROOT_DIR", out_dir_Path, overwrite=True)
     # here your local standalone environment
 
     if len(args) >1 and args[0]=='doc':
@@ -978,7 +972,6 @@ def main(args):
     # Logger level error
     context.getLogger().setLevel(40)
 
-    context.setVariable(r"PRODUCT_ROOT_DIR", out_dir_Path, overwrite=True)
     # here your local standalone environment
 
     if len(args) >1 and args[0]=='doc':