From: crouzet Date: Fri, 6 Apr 2018 15:39:58 +0000 (+0200) Subject: Implementation de sat #8911 : commande salome test avec launcher cea X-Git-Tag: 5.1.0~42 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8e570ea16f8562516407d5c8fc0268a600079b76;p=tools%2Fsat.git Implementation de sat #8911 : commande salome test avec launcher cea Et aussi prise en charge de la commande salome doc --- diff --git a/commands/launcher.py b/commands/launcher.py index f0e0ece..b7d9fed 100644 --- a/commands/launcher.py +++ b/commands/launcher.py @@ -73,6 +73,7 @@ def generate_launch_file(config, additional_env['APPLI'] = filepath + # get KERNEL bin installation path # (in order for the launcher to get python salomeContext API) kernel_cfg = src.product.get_product_config(config, "KERNEL") @@ -86,10 +87,27 @@ def generate_launch_file(config, else: bin_kernel_install_dir = os.path.join(kernel_root_dir,"bin","salome") + # check if the application contains an application module + l_product_info = src.product.get_products_infos(config.APPLICATION.products.keys(), + config) + salome_application_name="Not defined" + for prod_name, prod_info in l_product_info: + # look for a salome application + if src.get_property_in_product_cfg(prod_info, "is_salome_application") == "yes": + salome_application_name=prod_info.install_dir + continue + + # if the application contains an application module, we set ABSOLUTE_APPLI_PATH to it. + # if not we set it to KERNEL_INSTALL_DIR, which is sufficient, except for salome test + if salome_application_name == "Not defined": + app_root_dir=kernel_root_dir + else: + app_root_dir=salome_application_name + # Get the launcher template withProfile = src.fileEnviron.withProfile\ .replace("BIN_KERNEL_INSTALL_DIR", bin_kernel_install_dir)\ - .replace("KERNEL_INSTALL_DIR", kernel_root_dir) + .replace("KERNEL_INSTALL_DIR", app_root_dir) before, after = withProfile.split( "# here your local standalone environment\n") diff --git a/commands/package.py b/commands/package.py index 9e1d423..5d3e6de 100644 --- a/commands/package.py +++ b/commands/package.py @@ -192,12 +192,28 @@ def produce_relative_launcher(config, else: bin_kernel_install_dir = os.path.join(kernel_root_dir,"bin","salome") + # check if the application contains an application module + l_product_info = src.product.get_products_infos(config.APPLICATION.products.keys(), + config) + salome_application_name="Not defined" + for prod_name, prod_info in l_product_info: + # look for a salome application + if src.get_property_in_product_cfg(prod_info, "is_salome_application") == "yes": + salome_application_name=prod_info.name + continue + # if the application contains an application module, we set ABSOLUTE_APPLI_PATH to it + # if not we set it to KERNEL_INSTALL_DIR, which is sufficient, except for salome test + if salome_application_name == "Not defined": + app_root_dir=kernel_root_dir + else: + app_root_dir=os.path.join(binaries_dir_name, salome_application_name) + # Get the launcher template and do substitutions withProfile = src.fileEnviron.withProfile withProfile = withProfile.replace( "ABSOLUTE_APPLI_PATH'] = 'KERNEL_INSTALL_DIR'", - "ABSOLUTE_APPLI_PATH'] = out_dir_Path + '" + config.VARS.sep + kernel_root_dir + "'") + "ABSOLUTE_APPLI_PATH'] = out_dir_Path + '" + config.VARS.sep + app_root_dir + "'") withProfile = withProfile.replace( " 'BIN_KERNEL_INSTALL_DIR'", " out_dir_Path + '" + config.VARS.sep + bin_kernel_install_dir + "'") diff --git a/src/fileEnviron.py b/src/fileEnviron.py index 8ff7a2f..4c0e129 100644 --- a/src/fileEnviron.py +++ b/src/fileEnviron.py @@ -718,6 +718,7 @@ withProfile = """#! /usr/bin/env python import os import sys +import subprocess # Add the pwdPath to able to run the launcher after unpacking a package @@ -739,6 +740,24 @@ def __initialize(): sys.exit(1) # End of preliminary work +# salome doc only works for virtual applications. Therefore we overwrite it with this function +def _showDoc(modules): + for module in modules: + modulePath = os.getenv(module+"_ROOT_DIR") + if modulePath != None: + baseDir = os.path.join(modulePath, "share", "doc", "salome") + docfile = os.path.join(baseDir, "gui", module.upper(), "index.html") + if not os.path.isfile(docfile): + docfile = os.path.join(baseDir, "tui", module.upper(), "index.html") + if not os.path.isfile(docfile): + docfile = os.path.join(baseDir, "dev", module.upper(), "index.html") + if os.path.isfile(docfile): + out, err = subprocess.Popen(["xdg-open", docfile]).communicate() + else: + print "Online documentation is not accessible for module:", module + else: + print module+"_ROOT_DIR not found!" + def main(args): # Identify application path then locate configuration files __initialize() @@ -772,6 +791,10 @@ def main(args): context.setVariable(r"PRODUCT_ROOT_DIR", out_dir_Path, overwrite=True) # here your local standalone environment + if len(args) >1 and args[0]=='doc': + _showDoc(args[1:]) + return + # Start SALOME, parsing command line arguments context.runSalome(args) #print 'Thank you for using SALOME!'