Salome HOME
bug fix in generate command
[tools/sat.git] / commands / make.py
index a64ec11411b318883bf319bc51c7f1d3408c8154..a3b77cae3df16720c5703a5d029c6eb0b68934cf 100644 (file)
@@ -36,7 +36,8 @@ def get_products_list(options, cfg, logger):
     :param options Options: The Options instance that stores the commands 
                             arguments
     :param cfg Config: The global configuration
-    :param logger Logger: The logger instance to use for the display and logging
+    :param logger Logger: The logger instance to use for the display and 
+                          logging
     :return: The list of (product name, product_informations).
     :rtype: List
     '''
@@ -58,7 +59,9 @@ def get_products_list(options, cfg, logger):
     # the products name and their definition
     products_infos = src.product.get_products_infos(products, cfg)
     
-    products_infos = [pi for pi in products_infos if not(src.product.product_is_native(pi[1]) or src.product.product_is_fixed(pi[1]))]
+    products_infos = [pi for pi in products_infos if not(
+                                     src.product.product_is_native(pi[1]) or 
+                                     src.product.product_is_fixed(pi[1]))]
     
     return products_infos
 
@@ -118,7 +121,14 @@ def make_product(p_name_info, make_option, config, logger):
     logger.write(header, 3)
     logger.write("\n", 4, False)
     logger.flush()
-    
+
+    # Do nothing if he product is not compilable
+    if ("properties" in p_info and "compilation" in p_info.properties and 
+                                        p_info.properties.compilation == "no"):
+        log_step(logger, header, "ignored")
+        logger.write("\n", 3, False)
+        return 0
+
     # Instantiate the class that manages all the construction commands
     # like cmake, make, make install, make test, environment management, etc...
     builder = src.compilation.Builder(config, logger, p_info)
@@ -130,6 +140,7 @@ def make_product(p_name_info, make_option, config, logger):
     
     # Execute buildconfigure, configure if the product is autotools
     # Execute cmake if the product is cmake
+    len_end_line = 20
     res = 0
     if not src.product.product_has_script(p_info):
         nb_proc, make_opt_without_j = get_nb_proc(p_info, config, make_option)
@@ -137,16 +148,23 @@ def make_product(p_name_info, make_option, config, logger):
         res_m = builder.make(nb_proc, make_opt_without_j)
         log_res_step(logger, res_m)
         res += res_m
+    else:
+        scrit_path_display = src.printcolors.printcLabel(p_info.compil_script)
+        log_step(logger, header, "SCRIPT " + scrit_path_display)
+        len_end_line += len(scrit_path_display)
+        res_s = builder.do_script_build(p_info.compil_script)
+        log_res_step(logger, res_s)
+        res += res_s
     
     # Log the result
     if res > 0:
-        logger.write("\r%s%s" % (header, " " * 20), 3)
+        logger.write("\r%s%s" % (header, " " * len_end_line), 3)
         logger.write("\r" + header + src.printcolors.printcError("KO"))
         logger.write("==== %(KO)s in make of %(name)s \n" %
             { "name" : p_name , "KO" : src.printcolors.printcInfo("ERROR")}, 4)
         logger.flush()
     else:
-        logger.write("\r%s%s" % (header, " " * 20), 3)
+        logger.write("\r%s%s" % (header, " " * len_end_line), 3)
         logger.write("\r" + header + src.printcolors.printcSuccess("OK"))
         logger.write("==== %s \n" % src.printcolors.printcInfo("OK"), 4)
         logger.write("==== Make of %(name)s %(OK)s \n" %
@@ -202,11 +220,12 @@ def run(args, runner, logger):
     # check that the command has been called with an application
     src.check_config_has_application( runner.cfg )
 
-    # Get the list of products to threat
+    # Get the list of products to treat
     products_infos = get_products_list(options, runner.cfg, logger)
     
     # Print some informations
-    logger.write(_('Executing the make command in the build directories of the application %s\n') % 
+    logger.write(_('Executing the make command in the build '
+                                'directories of the application %s\n') % 
                 src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
     
     info = [(_("BUILD directory"),
@@ -215,6 +234,8 @@ def run(args, runner, logger):
     
     # Call the function that will loop over all the products and execute
     # the right command(s)
+    if options.option is None:
+        options.option = ""
     res = make_all_products(runner.cfg, products_infos, options.option, logger)
     
     # Print the final state