Salome HOME
sat #17186 : correction of a small bug with application base flag, new option show_in...
authorcrouzet <nicolas.crouzet@cea.fr>
Thu, 11 Jul 2019 07:11:58 +0000 (09:11 +0200)
committercrouzet <nicolas.crouzet@cea.fr>
Thu, 11 Jul 2019 07:11:58 +0000 (09:11 +0200)
commands/config.py
complete_sat.sh
src/product.py

index 3df71fec024b518f2ea0ac060baca3d86fd475df..50ad5f7bbc0e6768edbcdbb3b01a7a061e7c5ac9 100644 (file)
@@ -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)
index ff227da3039b328972dc38bdab56fcdf38dc17ba..e557b1e34d92594df3d13f13a3eec468ad1349c1 100755 (executable)
@@ -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        
             ;;
index 4f3716825c6455431d2b6230de6c1cd884022fd6..44d20e9faf8bf4b2670f4c1d95d4dfb101ff27dc 100644 (file)
@@ -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