Salome HOME
ajout option d'impression des graphes de dépendance
[tools/sat.git] / commands / compile.py
index 526f70b73a7cc294d1e9adb52d4c438fe4530bd6..252206d073e839d091f11d8c097d639916b11c72 100644 (file)
@@ -104,16 +104,22 @@ def find_path_graph(graph, start, end, path=[]):
 def depth_first_topo_graph(graph, start, visited=[], sorted_nodes=[]):
     visited = visited + [start]
     if start not in graph:
-        raise src.SatException('Error in product dependencies : %s product is referenced in products dependencies but is not present in the application !' % start)
+        # get more explicit error
+        where = [k for k in graph if start in graph[k]]
+        raise src.SatException('Error in product dependencies : %s product is referenced in products dependencies, but is not present in the application, from %s' % (start, where))
+        # may be in debug mode, continue loop to get all problems, (if comment raise)
+        # print("WARNING : %s product is referenced in products dependencies but is not present in the application, from %s" % (start, where))
+        # sorted_nodes = sorted_nodes + [start]
+        # return visited, sorted_nodes
     for node in graph[start]:
         if node not in visited:
             visited,sorted_nodes=depth_first_topo_graph(graph, node, visited,sorted_nodes)
         else:
             if node not in sorted_nodes:
-                raise src.SatException('Error in product dependencies : cycle detection for node %s and %s !' % (start,node))
+                raise src.SatException('Error in product dependencies : cycle detection for node %s and %s' % (start,node))
     
     sorted_nodes = sorted_nodes + [start]
-    return visited,sorted_nodes
+    return visited, sorted_nodes
 
 
 # check for p_name that all dependencies are installed
@@ -198,7 +204,8 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict
                           verbose=0,
                           logger_add_link = logger)
 
-            if options.update:
+            if options.update and src.product.product_is_vcs(p_info):
+            # only VCS products are concerned by update option
                 try: 
                     do_update=False
                     if len(updated_products)>0:
@@ -207,9 +214,10 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict
                         if find_path_graph(all_products_graph, p_name, updated_products):
                             logger.write("\nUpdate product %s (child)" % p_name, 5)
                             do_update=True
-                    if not do_update:
-                        source_time=os.path.getatime(p_info.source_dir)
-                        install_time=os.path.getatime(p_info.install_dir)
+                    if (not do_update) and os.path.isdir(p_info.source_dir) \
+                                       and os.path.isdir(p_info.install_dir):
+                        source_time=os.path.getmtime(p_info.source_dir)
+                        install_time=os.path.getmtime(p_info.install_dir)
                         if install_time<source_time:
                             logger.write("\nupdate product %s" % p_name, 5)
                             do_update=True
@@ -508,6 +516,7 @@ def compile_product_pip(sat,
                              src.environment.Environ(dict(os.environ)),
                              True)
     environ_info = src.product.get_product_dependencies(config,
+                                                        p_name,
                                                         p_info)
     build_environ.silent = (config.USER.output_verbose_level < 5)
     build_environ.set_full_environ(logger, environ_info)