From 0e319b691165be3add3dd318882006acbb17034e Mon Sep 17 00:00:00 2001 From: crouzet Date: Thu, 11 Jul 2019 09:11:58 +0200 Subject: [PATCH] sat #17186 : correction of a small bug with application base flag, new option show_install for sat compile --- commands/config.py | 32 ++++++++++++++++++++++++++++++++ complete_sat.sh | 2 +- src/product.py | 6 ++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/commands/config.py b/commands/config.py index 3df71fe..50ad5f7 100644 --- a/commands/config.py +++ b/commands/config.py @@ -53,6 +53,8 @@ parser.add_option('l', 'list', 'boolean', 'list', _("Optional: list all available applications.")) parser.add_option('', 'show_patchs', 'boolean', 'show_patchs', _("Optional: synthetic list of all patches used in the application")) +parser.add_option('', 'show_install', 'boolean', 'show_install', + _("Optional: synthetic list of all install directories in the application")) parser.add_option('', 'show_properties', 'boolean', 'show_properties', _("Optional: synthetic list of all properties used in the application")) parser.add_option('c', 'copy', 'boolean', 'copy', @@ -779,6 +781,27 @@ def show_patchs(config, logger): logger.write("No patchs found\n", 1) +def show_install_dir(config, logger): + '''Prints all the used installed directories in the application. + + :param config Config: the global configuration. + :param logger Logger: The logger instance to use for the display + ''' + for product in sorted(config.APPLICATION.products): + try: + product_info = src.product.get_product_config(config, product) + install_path=src.Path(product_info.install_dir) + if (src.product.product_is_native(product_info)): + install_path="Native" + elif (src.product.product_is_fixed(product_info)): + install_path+=" (Fixed)" + logger.write("%s : %s\n" % (product, install_path) , 1) + except Exception as e: + msg = "problem on product %s\n%s\n" % (product, str(e)) + logger.error(msg) + logger.write("\n", 1) + + def show_properties(config, logger): '''Prints all the used properties in the application. @@ -1094,6 +1117,15 @@ def run(args, runner, logger): logger.write("\n", 2, False) show_patchs(runner.cfg, logger) + # case : give a synthetic view of all install directories used in the application + if options.show_install: + src.check_config_has_application(runner.cfg) + # Print some informations + logger.write(_('Installation directories of application %s\n') % + src.printcolors.printcLabel(runner.cfg.VARS.application), 3) + logger.write("\n", 2, False) + show_install_dir(runner.cfg, logger) + # case : give a synthetic view of all patches used in the application if options.show_properties: src.check_config_has_application(runner.cfg) diff --git a/complete_sat.sh b/complete_sat.sh index ff227da..e557b1e 100755 --- a/complete_sat.sh +++ b/complete_sat.sh @@ -157,7 +157,7 @@ _salomeTools_complete() # show argument for each command case "${command}" in config) - opts="--value --list --copy --edit --no_label --info --show_patchs" + opts="--value --list --copy --edit --no_label --info --show_patchs --show_install" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; diff --git a/src/product.py b/src/product.py index 4f37168..44d20e9 100644 --- a/src/product.py +++ b/src/product.py @@ -71,6 +71,8 @@ def get_product_config(config, product_name, with_install_dir=True): dev = config.APPLICATION.dev if 'hpc' in config.APPLICATION: hpc = config.APPLICATION.hpc + if 'base' in config.APPLICATION: + base = config.APPLICATION.base # special case for which only the product name is mentionned if isinstance(version, bool): @@ -466,9 +468,13 @@ def get_install_dir(config, base, version, prod_info): """ install_dir = "" in_base = False + # base : corresponds to what is specified in application pyconf (either from the global key, or from a product dict) + # prod_info.install_dir : corresponds to what is specified in product pyconf (usually "base" for prerequisites) if (("install_dir" in prod_info and prod_info.install_dir == "base") or base == "yes"): in_base = True + # what was declared in application has precedence over what was said in product pyconf + # no_base="yes" has precedence over base == "yes" if (base == "no" or ("no_base" in config.APPLICATION and config.APPLICATION.no_base == "yes")): in_base = False -- 2.30.2