Salome HOME
'sat compile' : check the dependencies installations before compiling a product
authorSerge Rehbinder <serge.rehbinder@cea.fr>
Wed, 25 May 2016 07:21:31 +0000 (09:21 +0200)
committerSerge Rehbinder <serge.rehbinder@cea.fr>
Wed, 25 May 2016 07:21:31 +0000 (09:21 +0200)
commands/compile.py

index fb7f8464b244f525606a03cb2430f7b5c2982edc..f48f29d729f669931e8c11866dda4f6a4b332d5e 100644 (file)
@@ -252,6 +252,14 @@ def extend_with_children(config, p_infos):
                 p_infos_res.append(p_name_p_info_child)
     return p_infos_res    
 
+def check_dependencies(config, p_name_p_info):
+    l_depends_not_installed = []
+    fathers = get_recursive_fathers(config, p_name_p_info, without_native_fixed=True)
+    for p_name_father, p_info_father in fathers:
+        if not(src.product.check_installation(p_info_father)):
+            l_depends_not_installed.append(p_name_father)
+    return l_depends_not_installed
+
 def log_step(logger, header, step):
     logger.write("\r%s%s" % (header, " " * 30), 3)
     logger.write("\r%s%s" % (header, step), 3)
@@ -312,10 +320,22 @@ def compile_all_products(sat, config, options, products_infos, logger):
             logger.write(_("Already installed\n"))
             continue
         
+        # If the show option was called, do not launch the compilation
         if options.no_compile:
             logger.write(_("Not installed\n"))
             continue
         
+        # Check if the dependencies are installed
+        l_depends_not_installed = check_dependencies(config, p_name_info)
+        if len(l_depends_not_installed) > 0:
+            logger.write(src.printcolors.printcError(
+                    _("ERROR : the following product(s) is(are) mandatory: ")))
+            for prod_name in l_depends_not_installed:
+                logger.write(src.printcolors.printcError(prod_name + " "))
+            logger.write("\n")
+            continue
+        
+        # Call the function to compile the product
         res_prod = compile_product(sat, p_name_info, config, options, logger, header)
         if res_prod != 0:
             res += 1
@@ -416,7 +436,7 @@ def run(args, runner, logger):
     if (options.clean_all and 
         options.products is None and 
         not runner.options.batch):
-        rep = raw_input(_("You used --clean_all without specifying a product"
+        rep = input(_("You used --clean_all without specifying a product"
                           " are you sure you want to continue? [Yes/No] "))
         if rep.upper() != _("YES").upper():
             return 0