]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
Implementation de sat #8911 : commande salome test avec launcher cea
authorcrouzet <nicolas.crouzet@cea.fr>
Fri, 6 Apr 2018 15:39:58 +0000 (17:39 +0200)
committercrouzet <nicolas.crouzet@cea.fr>
Fri, 6 Apr 2018 15:39:58 +0000 (17:39 +0200)
Et aussi prise en charge de la commande salome doc

commands/launcher.py
commands/package.py
src/fileEnviron.py

index f0e0ece8ea43e1440cf3f2a45caae7a5ccf21234..b7d9feda58f842594575ce4611c873f35d374c99 100644 (file)
@@ -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")
index 9e1d423aaed6dde4cb17636126eaa6dde9e15417..5d3e6dec51215bcec1bac4e9bf3edf4532b58c6e 100644 (file)
@@ -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 + "'")
index 8ff7a2f913e4e35e29ba3c36f11d2818c0a0d93d..4c0e12923da292a080db33a5722af5f462fcd47c 100644 (file)
@@ -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!'