Salome HOME
sat job: be able to pass global options to a specific command (sat -o ... command)
[tools/sat.git] / commands / compile.py
index ab4e674b42687950a375fcbc8d9d652cc7d62ead..9a2d0956c73ebc5dc34f9ca2d9ab79c18c4a7936 100644 (file)
@@ -30,24 +30,27 @@ except NameError:
 # Define all possible option for the compile command :  sat compile <options>
 parser = src.options.Options()
 parser.add_option('p', 'products', 'list2', 'products',
-    _('products to configure. This option can be'
+    _('Optional: products to configure. This option can be'
     ' passed several time to configure several products.'))
 parser.add_option('', 'with_fathers', 'boolean', 'fathers',
-    _("build all necessary products to the given product (KERNEL is build before"
-      " building GUI)."), False)
+    _("Optional: build all necessary products to the given product (KERNEL is "
+      "build before building GUI)."), False)
 parser.add_option('', 'with_children', 'boolean', 'children',
-    _("build all products using the given product (all SMESH plugins are build "
-      "after SMESH)."), False)
+    _("Optional: build all products using the given product (all SMESH plugins"
+      " are build after SMESH)."), False)
 parser.add_option('', 'clean_all', 'boolean', 'clean_all',
-    _("clean BUILD dir and INSTALL dir before building product."), False)
+    _("Optional: clean BUILD dir and INSTALL dir before building product."),
+    False)
 parser.add_option('', 'clean_install', 'boolean', 'clean_install',
-    _("clean INSTALL dir before building product."), False)
+    _("Optional: clean INSTALL dir before building product."), False)
 parser.add_option('', 'make_flags', 'string', 'makeflags',
-    _("add extra options to the 'make' command."))
+    _("Optional: add extra options to the 'make' command."))
 parser.add_option('', 'show', 'boolean', 'no_compile',
-    _("DO NOT COMPILE just show if products are installed or not."), False)
-parser.add_option('', 'stop_first_fail', 'boolean', 'stop_first_fail', _("Stop"
-                    "s the command at first product compilation fail."), False)
+    _("Optional: DO NOT COMPILE just show if products are installed or not."),
+    False)
+parser.add_option('', 'stop_first_fail', 'boolean', 'stop_first_fail', _(
+                  "Optional: Stops the command at first product compilation"
+                  " fail."), False)
 
 def get_products_list(options, cfg, logger):
     '''method that gives the product list with their informations from 
@@ -80,7 +83,6 @@ def get_products_list(options, cfg, logger):
     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]))]
     
     return products_infos
@@ -290,20 +292,29 @@ def compile_all_products(sat, config, options, products_infos, logger):
         logger.write("\n", 4, False)
         logger.flush()
 
-        # Do nothing if he product is not compilable
+        # Do nothing if the 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)
             continue
 
+        # Do nothing if the product is native
+        if src.product.product_is_native(p_info):
+            log_step(logger, header, "native")
+            logger.write("\n", 3, False)
+            continue
+
         # Clean the build and the install directories 
         # if the corresponding options was called
         if options.clean_all:
             log_step(logger, header, "CLEAN BUILD AND INSTALL")
             sat.clean(config.VARS.application + 
                       " --products " + p_name + 
-                      " --build --install", batch=True, verbose=0)
+                      " --build --install",
+                      batch=True,
+                      verbose=0,
+                      logger_add_link = logger)
         
         # Clean the the install directory 
         # if the corresponding option was called
@@ -311,7 +322,10 @@ def compile_all_products(sat, config, options, products_infos, logger):
             log_step(logger, header, "CLEAN INSTALL")
             sat.clean(config.VARS.application + 
                       " --products " + p_name + 
-                      " --install", batch=True, verbose=0)
+                      " --install",
+                      batch=True,
+                      verbose=0,
+                      logger_add_link = logger)
         
         # Check if it was already successfully installed
         if src.product.check_installation(p_info):
@@ -349,7 +363,10 @@ def compile_all_products(sat, config, options, products_infos, logger):
                          5)
             sat.clean(config.VARS.application + 
                       " --products " + p_name + 
-                      " --install", batch=True, verbose=0)
+                      " --install",
+                      batch=True,
+                      verbose=0,
+                      logger_add_link = logger)
             res += 1
             
         # Log the result
@@ -490,7 +507,9 @@ def description():
     :return: The text to display for the compile command description.
     :rtype: str
     '''
-    return _("The compile command constructs the products of the application")
+    return _("The compile command constructs the products of the application"
+             "\n\nexample:\nsat compile SALOME-master --products KERNEL,GUI,"
+             "MEDCOUPLING --clean_all")
   
 def run(args, runner, logger):
     '''method that is called when salomeTools is called with compile parameter.