Salome HOME
spns #26801 : bug sat package, le lanceur ne faisait pas le réinit
[tools/sat.git] / src / environment.py
index 17029b1b1131a455268eb811fb2f6933694f34d8..3bf34cb5bb10c2b7492b268d07c8e3c10c946fa4 100644 (file)
@@ -229,11 +229,11 @@ class SalomeEnviron:
         return "%s(\n%s\n)" % (self.__class__.__name__, PP.pformat(res))
 
     def __set_sorted_products_list(self):
-        from compile import get_dependencies_graph, depth_first_topo_graph
         all_products_infos = src.product.get_products_infos(
                                  self.cfg.APPLICATION.products,
                                  self.cfg)
         
+        from compile import get_dependencies_graph,depth_first_topo_graph
         all_products_graph=get_dependencies_graph(all_products_infos, self.forBuild)
         visited_nodes=[]
         sorted_nodes=[]
@@ -245,6 +245,7 @@ class SalomeEnviron:
                                                visited_nodes,
                                                sorted_nodes)
         self.sorted_product_list=sorted_nodes
+        self.all_products_graph=all_products_graph
 
 
     def append(self, key, value, sep=os.pathsep):
@@ -388,14 +389,6 @@ class SalomeEnviron:
         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")
-        self.add_comment("comment these to lines if you wish a different behaviour")
-        if not src.architecture.is_windows():
-           self.set("LD_LIBRARY_PATH", "")
-        self.set("PYTHONPATH", "")
-        self.add_line(1)
 
         # Set the variables defined in the "environ" section
         if 'environ' in self.cfg.APPLICATION:
@@ -762,7 +755,7 @@ class SalomeEnviron:
  
     def set_full_environ(self, logger, env_info):
         """\
-        Sets the full environment for products 
+        Sets the full environment for products, with their dependencies 
         specified in env_info dictionary. 
         
         :param logger Logger: The logger instance to display messages
@@ -775,9 +768,13 @@ class SalomeEnviron:
 
         # use the sorted list of all products to sort the list of products 
         # we have to set
+        visited=[]
+        from compile import depth_search_graph # to get the dependencies
+        for p_name in env_info:
+            visited=depth_search_graph(self.all_products_graph, p_name, visited)
         sorted_product_list=[]
         for n in self.sorted_product_list:
-            if n in env_info:
+            if n in visited:
                 sorted_product_list.append(n)
 
         if "Python" in sorted_product_list:
@@ -916,6 +913,7 @@ class FileEnvWriter:
         :return: The path to the generated file
         :rtype: str
         """
+        additional_env["sat_dist"]=self.config.VARS.dist
         if not self.silent:
             self.logger.write(_("Create environment file %s\n") % 
                               src.printcolors.printcLabel(filename), 3)