X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=commands%2Fcompile.py;h=9a2d0956c73ebc5dc34f9ca2d9ab79c18c4a7936;hb=8907858912a4ceb6358a1f6659e8b9dbd6ef4ef4;hp=3543d38734ba19544fdd24863334b6211c22ffb2;hpb=941eef63102ae0968d7133997c76b34d53457612;p=tools%2Fsat.git diff --git a/commands/compile.py b/commands/compile.py index 3543d38..9a2d095 100644 --- a/commands/compile.py +++ b/commands/compile.py @@ -30,24 +30,27 @@ except NameError: # Define all possible option for the compile command : sat compile 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): @@ -326,6 +340,7 @@ def compile_all_products(sat, config, options, products_infos, logger): # Check if the dependencies are installed l_depends_not_installed = check_dependencies(config, p_name_info) if len(l_depends_not_installed) > 0: + log_step(logger, header, "") logger.write(src.printcolors.printcError( _("ERROR : the following product(s) is(are) mandatory: "))) for prod_name in l_depends_not_installed: @@ -344,9 +359,14 @@ def compile_all_products(sat, config, options, products_infos, logger): if res_prod != 0: # Clean the install directory if there is any + logger.write(_("Cleaning the install directory if there is any\n"), + 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 @@ -441,10 +461,19 @@ def compile_product(sat, p_name_info, config, options, logger, header, len_end): if res_mi > 0: error_step = "MAKE INSTALL" + + # Check that the install directory exists + if res==0 and not(os.path.exists(p_info.install_dir)): + res = 1 + error_step = "NO INSTALL DIR" + msg = _("Error: despite the fact that all the steps ended successfully," + " no install directory was found !") + logger.write(src.printcolors.printcError(msg), 4) + logger.write("\n", 4) # Add the config file corresponding to the dependencies/versions of the # product that have been successfully compiled - if res==0: + if res==0: logger.write(_("Add the config file in installation directory\n"), 5) add_compile_config_file(p_info, config) @@ -478,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. @@ -500,6 +531,20 @@ def run(args, runner, logger): # check that the command has been called with an application src.check_config_has_application( runner.cfg ) + # Print some informations + logger.write(_('Executing the compile commands in the build ' + 'directories of the products of ' + 'the application %s\n') % + src.printcolors.printcLabel(runner.cfg.VARS.application), 1) + + info = [ + (_("SOURCE directory"), + os.path.join(runner.cfg.APPLICATION.workdir, 'SOURCES')), + (_("BUILD directory"), + os.path.join(runner.cfg.APPLICATION.workdir, 'BUILD')) + ] + src.print_info(logger, info) + # Get the list of products to treat products_infos = get_products_list(options, runner.cfg, logger) @@ -514,19 +559,6 @@ def run(args, runner, logger): # Sort the list regarding the dependencies of the products products_infos = sort_products(runner.cfg, products_infos) - # Print some informations - logger.write(_('Executing the compile commands in the build ' - 'directories of the products of ' - 'the application %s\n') % - src.printcolors.printcLabel(runner.cfg.VARS.application), 1) - - info = [ - (_("SOURCE directory"), - os.path.join(runner.cfg.APPLICATION.workdir, 'SOURCES')), - (_("BUILD directory"), - os.path.join(runner.cfg.APPLICATION.workdir, 'BUILD')) - ] - src.print_info(logger, info) # Call the function that will loop over all the products and execute # the right command(s)