]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
prise en compte d'un champ build_depend pour le calcul des dépendance compile time
authorcrouzet <nicolas.crouzet@cea.fr>
Tue, 28 Jul 2020 14:24:52 +0000 (16:24 +0200)
committercrouzet <nicolas.crouzet@cea.fr>
Tue, 28 Jul 2020 14:24:52 +0000 (16:24 +0200)
commands/compile.py
commands/config.py
src/environment.py
src/product.py

index 4d3a35c7b17238a461d92e989ca19432b52c9463..f2b98d68a0b533b9ee5f17f82a53a847dfbc32ad 100644 (file)
@@ -64,10 +64,16 @@ parser.add_option('', 'clean_build_after', 'boolean', 'clean_build_after',
 
 # from sat product infos, represent the product dependencies in a simple python graph
 # keys are nodes, the list of dependencies are values
-def get_dependencies_graph(p_infos):
+def get_dependencies_graph(p_infos, compile_time=True):
     graph={}
     for (p_name,p_info) in p_infos:
-        graph[p_name]=p_info.depend
+        depprod=[]
+        for d in p_info.depend:
+            depprod.append(d)
+        if compile_time and "build_depend" in p_info:
+            for d in p_info.build_depend:
+                depprod.append(d)
+        graph[p_name]=depprod
     return graph
 
 # this recursive function calculates all the dependencies of node start
@@ -740,12 +746,7 @@ def run(args, runner, logger):
     # store at beginning compile time products, we need to compile them before!
     for n in sorted_nodes:
         if n in products_list:
-            if src.product.product_is_compile_time(all_products_dict[n][1]) or\
-               src.product.product_is_compile_and_runtime(all_products_dict[n][1]):
-                product_list_compiletime.append(n)
-            else:
-                product_list_runtime.append(n)
-    sorted_product_list = product_list_compiletime + product_list_runtime
+            sorted_product_list.append(n)
     logger.write("Sorted list of products to compile : %s\n" % sorted_product_list, 5)
     
     # from the sorted list of products to compile, build a sorted list of products infos
@@ -754,7 +755,7 @@ def run(args, runner, logger):
         products_infos.append(all_products_dict[product])
 
     # for all products to compile, store in "depend_all" field the complete dependencies (recursive) 
-    # (will be used by check_dependencies funvtion)
+    # (will be used by check_dependencies function)
     for pi in products_infos:
         dep_prod=[]
         dep_prod=depth_search_graph(all_products_graph,pi[0], dep_prod)
index f5e539c2a0223af6fbb13a034335087a372d4643..abba1a8a14c610d8745373080d82a24f28e86711 100644 (file)
@@ -649,6 +649,10 @@ def show_product_info(config, name, logger):
     if "opt_depend" in pinfo:
         src.printcolors.print_value(logger, "optional", sorted(pinfo.opt_depend), 2)
 
+    if "build_depend" in pinfo:
+        src.printcolors.print_value(logger, "build depend on", sorted(pinfo.build_depend), 2)
+
+
     # information on pyconf
     logger.write("\n", 2)
     logger.write(src.printcolors.printcLabel("configuration:") + "\n", 2)
index 62943389339565b15113bf4f9259be26f1db232f..17029b1b1131a455268eb811fb2f6933694f34d8 100644 (file)
@@ -234,7 +234,7 @@ class SalomeEnviron:
                                  self.cfg.APPLICATION.products,
                                  self.cfg)
         
-        all_products_graph=get_dependencies_graph(all_products_infos)
+        all_products_graph=get_dependencies_graph(all_products_infos, self.forBuild)
         visited_nodes=[]
         sorted_nodes=[]
         for n in all_products_graph:
@@ -246,15 +246,6 @@ class SalomeEnviron:
                                                sorted_nodes)
         self.sorted_product_list=sorted_nodes
 
-        # store the list of compile time products
-        # they should be added in build env
-        compile_time_products=[]
-        for (pname,pinfo) in all_products_infos:
-           if src.product.product_is_compile_time(pinfo) or\
-              src.product.product_is_compile_and_runtime(pinfo) :
-               compile_time_products.append(pname)
-        self.compile_time_products=compile_time_products
-
 
     def append(self, key, value, sep=os.pathsep):
         """\
@@ -763,19 +754,10 @@ class SalomeEnviron:
             self.set_a_product("Python", logger)
             self.set_python_libdirs()
 
-        # for a build environment, add compile time products (like cmake)
-        if self.forBuild :
-            for product in self.compile_time_products:
-                if product == "Python":
-                    continue
-                self.set_a_product(product, logger)
-
         # The loop on the products
         for product in self.sorted_product_list:
             if product == "Python":
                 continue
-            if self.forBuild and product in self.compile_time_products:
-                continue
             self.set_a_product(product, logger)
  
     def set_full_environ(self, logger, env_info):
@@ -802,19 +784,10 @@ class SalomeEnviron:
             self.set_a_product("Python", logger)
             self.set_python_libdirs()
 
-        # for a build environment, add compile time products (like cmake)
-        if self.forBuild :
-            for product in self.compile_time_products:
-                if product == "Python":
-                    continue
-                self.set_a_product(product, logger)
-
         # set products
         for product in sorted_product_list:
             if product == "Python":
                 continue
-            if self.forBuild and product in self.compile_time_products:
-                continue
             self.set_a_product(product, logger)
 
 class FileEnvWriter:
index e0bc0871409854b1c79292d54252600fd7f06b82..7311ba722b90705ae87d990dc310f47630d3bd75 100644 (file)
@@ -608,7 +608,13 @@ def add_compile_config_file(p_info, config):
     res.addMapping(p_info.name, src.pyconf.Mapping(res), "")
     res[p_info.name]= p_info.version
 
-    for prod_name in p_info.depend:
+    depprod=[]
+    for d in p_info.depend:
+        depprod.append(d)
+    if "build_depend" in p_info:
+        for d in p_info.build_depend:
+            depprod.append(d)
+    for prod_name in depprod:
       if prod_name not in res:
         res.addMapping(prod_name, src.pyconf.Mapping(res), "")
       prod_dep_info = src.product.get_product_config(config, prod_name, False)
@@ -808,10 +814,19 @@ def get_product_dependencies(config, product_info):
     :return: the list of products in dependence
     :rtype: list
     """
-    if "depend" not in product_info or product_info.depend == []:
+    depend_all=[]
+    if "depend" in product_info:
+        for d in product_info.depend:
+            depend_all.append(d)
+    if "build_depend" in product_info:
+        for d in product_info.build_depend:
+            depend_all.append(d)
+
+    if len(depend_all) == 0:
         return []
+
     res = []
-    for prod in product_info.depend:
+    for prod in depend_all:
         if prod == product_info.name:
             continue
         if prod not in res: