X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=commands%2Fscript.py;h=7345977be0c0c23ec96f683c2e20a4fd1466a4af;hb=75c094e1cbcad9685d572ef30a34631a63ac1aba;hp=3f65fed4ccf64cf28fe84bd06ac9674d5036164d;hpb=2dba4e0dca1e43eda451cf93f0d9459b7dca2f49;p=tools%2Fsat.git diff --git a/commands/script.py b/commands/script.py index 3f65fed..7345977 100644 --- a/commands/script.py +++ b/commands/script.py @@ -17,56 +17,18 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import os -import re import src # Define all possible option for the script command : sat script parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _('Optional: products to configure. This option can be' - ' passed several time to configure several products.')) + _('Optional: products to configure. This option accepts a comma separated list.')) parser.add_option('', 'nb_proc', 'int', 'nb_proc', - _('Optional: The number of processors to use in the script if the make ' - 'command is used in it.\n\tWarning: the script has to be correctly written ' - 'if you want this option to work.\n\tThe $MAKE_OPTIONS has to be ' - 'used.'), 0) - -def get_products_list(options, cfg, logger): - '''method that gives the product list with their informations from - configuration regarding the passed options. - - :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 - :return: The list of (product name, product_informations). - :rtype: List - ''' - # Get the products to be prepared, regarding the options - if options.products is None: - # No options, get all products sources - products = cfg.APPLICATION.products - else: - # if option --products, check that all products of the command line - # are present in the application. - products = options.products - for p in products: - if p not in cfg.APPLICATION.products: - raise src.SatException(_("Product %(product)s " - "not defined in application %(application)s") % - { 'product': p, 'application': cfg.VARS.application} ) - - # Construct the list of tuple containing - # 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]))] - - return products_infos + _("""Optional: The number of processors to use in the script if the make command is used in it. + Warning: the script has to be correctly written if you want this option to work. + The $MAKE_OPTIONS has to be used."""), 0) + def log_step(logger, header, step): logger.write("\r%s%s" % (header, " " * 20), 3) @@ -135,6 +97,13 @@ def run_script_of_product(p_name_info, nb_proc, config, logger): logger.write("\n", 3, False) return 0 + if not os.path.isfile(p_info.compil_script): + msg_err="\n\nError : The compilation script file do not exists!"+\ + "\n It was not found by sat!"+\ + "\n Please check your salomeTool configuration\n" + logger.error(msg_err) + return 1 + # 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) @@ -193,7 +162,11 @@ def run(args, runner, logger): src.check_config_has_application( runner.cfg ) # Get the list of products to treat - products_infos = get_products_list(options, runner.cfg, logger) + products_infos = src.product.get_products_list(options, runner.cfg, logger) + 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]))] + # Print some informations logger.write(_('Executing the script in the build ' @@ -226,4 +199,4 @@ def run(args, runner, logger): 'valid_result': nb_products - res, 'nb_products': nb_products }, 1) - return res \ No newline at end of file + return res