]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
simplification laucher (suite) et maj commandes package et run dev_launcher
authorcrouzet <nicolas.crouzet@cea.fr>
Fri, 28 Jul 2017 14:30:41 +0000 (16:30 +0200)
committercrouzet <nicolas.crouzet@cea.fr>
Fri, 28 Jul 2017 14:30:41 +0000 (16:30 +0200)
commands/launcher.py
commands/package.py
commands/run.py
src/__init__.py
src/test_module.py

index 61d78d962b5ccb0d226a5742b3fdb2e1c1c6b273..213845adf783988b3703e0582a525e5554fbd234 100644 (file)
@@ -72,9 +72,9 @@ def generate_launch_file(config,
     # get KERNEL bin installation path 
     # (in order for the launcher to get python salomeContext API)
     kernel_cfg = src.product.get_product_config(config, "KERNEL")
-    kernel_root_dir = kernel_cfg.install_dir
     if not src.product.check_installation(kernel_cfg):
         raise src.SatException(_("KERNEL is not installed"))
+    kernel_root_dir = kernel_cfg.install_dir
 
     # set kernel bin dir (considering fhs property)
     if src.get_property_in_product_cfg(kernel_cfg, "fhs"):
@@ -238,10 +238,8 @@ def run(args, runner, logger):
     # Determine the launcher name (from option, profile section or by default "salome")
     if options.name:
         launcher_name = options.name
-    elif 'profile' in runner.cfg.APPLICATION and 'launcher_name=' in runner.cfg.APPLICATION.profile:
-        launcher_name = runner.cfg.APPLICATION.profile.launcher_name
     else:
-        launcher_name = 'salome'
+        launcher_name = src.get_launcher_name(runner.cfg)
 
     # set the launcher path
     launcher_path = runner.cfg.APPLICATION.workdir
index ab4051ee73b3a9a938ade611eb9e23e83d915820..ed58691f4677313722c7107df6dc85fdd32051e5 100644 (file)
@@ -180,16 +180,25 @@ def produce_relative_launcher(config,
     :rtype: str
     '''
     
-    # Get the launcher template
-    profile_install_dir = os.path.join(binaries_dir_name,
-                                       config.APPLICATION.profile.product)
+    # get KERNEL installation path 
+    kernel_root_dir = os.path.join(binaries_dir_name, "KERNEL")
+
+    # set kernel bin dir (considering fhs property)
+    kernel_cfg = src.product.get_product_config(config, "KERNEL")
+    if src.get_property_in_product_cfg(kernel_cfg, "fhs"):
+        bin_kernel_install_dir = os.path.join(kernel_root_dir,"bin") 
+    else:
+        bin_kernel_install_dir = os.path.join(kernel_root_dir,"bin","salome") 
+
+    # Get the launcher template and do substitutions
     withProfile = src.fileEnviron.withProfile
+
     withProfile = withProfile.replace(
-        "ABSOLUTE_APPLI_PATH'] = 'PROFILE_INSTALL_DIR'",
-        "ABSOLUTE_APPLI_PATH'] = out_dir_Path + '" + config.VARS.sep + profile_install_dir + "'")
+        "ABSOLUTE_APPLI_PATH'] = 'KERNEL_INSTALL_DIR'",
+        "ABSOLUTE_APPLI_PATH'] = out_dir_Path + '" + config.VARS.sep + kernel_root_dir + "'")
     withProfile = withProfile.replace(
-        "os.path.join( 'PROFILE_INSTALL_DIR'",
-        "os.path.join( out_dir_Path, '" + profile_install_dir + "'")
+        " 'BIN_KERNEL_INSTALL_DIR'",
+        " out_dir_Path + '" + config.VARS.sep + bin_kernel_install_dir + "'")
 
     before, after = withProfile.split(
                                 "# here your local standalone environment\n")
@@ -535,9 +544,10 @@ def binary_package(config, logger, options, tmp_working_dir):
         d_products[prod_name + " (sources)"] = (source_dir, path_in_archive)
 
     # create the relative launcher and add it to the files to add
-    if ("profile" in config.APPLICATION and 
-                                       "product" in config.APPLICATION.profile):
-        launcher_name = config.APPLICATION.profile.launcher_name
+    VersionSalome = src.get_salome_version(config)
+    # Case where SALOME has the launcher that uses the SalomeContext API
+    if VersionSalome >= 730:
+        launcher_name = src.get_launcher_name(config)
         launcher_package = produce_relative_launcher(config,
                                              logger,
                                              tmp_working_dir,
@@ -619,7 +629,7 @@ def source_package(sat, config, logger, options, tmp_working_dir):
             t = os.getcwd()
         except:
             # In the jobs, os.getcwd() can fail
-            t = config.USER.workdir
+            t = config.LOCAL.workdir
         os.chdir(tmp_working_dir)
         if os.path.lexists(tmp_satlink_path):
             os.remove(tmp_satlink_path)
@@ -1054,7 +1064,6 @@ The procedure to do it is:
             f.write("# Application: " + d['application'])
             if 'profile' in config.APPLICATION:
                 d['launcher'] = config.APPLICATION.profile.launcher_name
-                d['launcher'] = config.APPLICATION.profile.launcher_name
             else:
                 d['env_file'] = 'env_launch.sh'
 
index fe3fd9b68a30caea18a18c0adbf33cceb75f2f56..fa08cb930f3ede395d0f35a108c2c801ae5b312d 100644 (file)
@@ -38,22 +38,17 @@ def run(args, runner, logger):
     # check for product
     src.check_config_has_application(runner.cfg)
 
-    # check for profile
-    src.check_config_has_profile(runner.cfg)
-
     # Determine launcher path 
-    launcher_name = runner.cfg.APPLICATION.profile.launcher_name
+    launcher_name = src.get_launcher_name(runner.cfg)
     launcher_dir = runner.cfg.APPLICATION.workdir
     
     # Check the launcher existence
     if launcher_name not in  os.listdir(launcher_dir):
-        profile_name = runner.cfg.APPLICATION.profile.module
-        profile_install_dir = src.product.get_product_config(runner.cfg,
-                                                    profile_name).install_dir
-        launcher_dir = os.path.join(profile_install_dir, 'bin', 'salome')
+        message = _("The launcher %s was not found in directory %s!\nDid you run the"
+                    " command 'sat launcher' ?\n") % (launcher_name, launcher_dir)
+        raise src.SatException(message)
           
     launcher_path = os.path.join(launcher_dir, launcher_name)
-    launcher_path = os.path.abspath(launcher_path)
 
     if not os.path.exists(launcher_path):
         message = _("The launcher at path %s is missing.\nDid you run the"
index fd750797985b57209eb9dc4513b042c3560c0c3d..e8a892834d0a95363276ffcb47b5554d0a3f162f 100644 (file)
@@ -136,6 +136,21 @@ def get_base_path(config):
     
     return base_path
 
+def get_launcher_name(config):
+    '''Returns the name of salome launcher.
+    
+    :param config Config: The global Config instance.
+    :return: The name of salome launcher.
+    :rtype: str
+    '''
+    check_config_has_application(config)
+    if 'profile' in config.APPLICATION and 'launcher_name=' in config.APPLICATION.profile:
+        launcher_name = config.APPLICATION.profile.launcher_name
+    else:
+        launcher_name = 'salome'
+
+    return launcher_name
+
 def get_log_path(config):
     '''Returns the path of the logs.
     
index 9ad20dd0dce6b7a1722bef40f1c7a065f69a83f4..7dd8378e1a529831888fb96fe84c38be24fce4aa 100644 (file)
@@ -531,22 +531,11 @@ class Test:
             return binSalome, binPython, killSalome
         
         # Case where SALOME has the launcher that uses the SalomeContext API
-        if VersionSalome >= 730:            
-            if 'profile' not in self.config.APPLICATION:
-                # Before revision of application concept
-                launcher_name = self.config.APPLI.launch_alias_name
-                binSalome = os.path.join(self.config.APPLICATION.workdir,
-                                         appdir,
-                                         launcher_name)
-            else:
-                # After revision of application concept
-                launcher_name = self.config.APPLICATION.profile.launcher_name
-                binSalome = os.path.join(self.config.APPLICATION.workdir,
-                                         launcher_name)
+        else:            
+            launcher_name = src.get_launcher_name(config)
+            binSalome = os.path.join(self.config.APPLICATION.workdir,
+                                     launcher_name)
             
-            if src.architecture.is_windows():
-                binSalome += '.bat'
-
             binPython = binSalome + ' shell'
             killSalome = binSalome + ' killall'
             return binSalome, binPython, killSalome