]> SALOME platform Git repositories - tools/sat.git/blobdiff - commands/environ.py
Salome HOME
Merge branch 'master' of https://codev-tuleap.cea.fr/plugins/git/salome/sat
[tools/sat.git] / commands / environ.py
index 57965377d9c390be60bb032c0db2e7c9f940e3b3..7b2676354df69d4307767c47b49a5bfd55cbdbd9 100644 (file)
@@ -22,19 +22,20 @@ import src
 
 parser = src.options.Options()
 parser.add_option('', 'shell', 'list2', 'shell',
-    _("Generates the environment files for the given format: "
-      "bash (default), bat (for windows) or all."), [])
+    _("Optional: Generates the environment files for the given format: "
+      "bash (default), bat (for windows), cfg (salome context file) or all."), [])
 parser.add_option('p', 'products', 'list2', 'products',
-    _("Includes only the specified products."))
+    _("Optional: Includes only the specified products."))
 parser.add_option('', 'prefix', 'string', 'prefix',
-    _("Specifies the prefix for the environment files."), "env")
+    _("Optional: Specifies the prefix for the environment files."), "env")
 parser.add_option('t', 'target', 'string', 'out_dir',
-    _("Specifies the directory path where to put the environment files."),
+    _("Optional: Specifies the directory path where to put the environment "
+      "files."),
     None)
 
 # list of available shells with extensions
-C_SHELLS = { "bash": "sh", "bat": "bat" }
-C_ALL_SHELL = [ "bash", "bat" ]
+C_SHELLS = { "bash": "sh", "bat": "bat", "cfg" : "cfg", "tcl" : ""}
+C_ALL_SHELL = [ "bash", "bat", "cfg", "tcl" ]
 
 
 ##
@@ -47,7 +48,21 @@ def write_all_source_files(config,
                            shells=["bash"],
                            prefix="env",
                            env_info=None):
+    '''Generates the environment files.
     
+    :param config Config: The global configuration
+    :param logger Logger: The logger instance to use for the display 
+                          and logging
+    :param out_dir str: The path to the directory where the files will be put
+    :param src_root str: The path to the directory where the sources are
+    :param silent boolean: If True, do not print anything in the terminal
+    :param shells list: The list of shells to generate
+    :param prefix str: The prefix to add to the file names.
+    :param env_info str: The list of products to add in the files.
+    :return: The list of the generated files.
+    :rtype: List
+    '''
+        
     if not out_dir:
         out_dir = config.APPLICATION.workdir
 
@@ -85,15 +100,22 @@ def write_all_source_files(config,
     for_build = True
     for_launch = False
     for shell in shells_list:
-        files.append(writer.write_env_file("%s_launch.%s" %
-                                           (prefix, shell.extension),
-                                           for_launch,
-                                           shell.name))
-        files.append(writer.write_env_file("%s_build.%s" %
-                                           (prefix, shell.extension),
-                                           for_build,
-                                           shell.name))
+        if shell.name=="tcl":
+            files.append(writer.write_tcl_files(for_launch,
+                                                shell.name))
+        else:
+            files.append(writer.write_env_file("%s_launch.%s" %
+                                               (prefix, shell.extension),
+                                               for_launch,
+                                               shell.name))
+            files.append(writer.write_env_file("%s_build.%s" %
+                                               (prefix, shell.extension),
+                                               for_build,
+                                               shell.name))
 
+    for f in files:
+        if f:
+            logger.write("    "+f+"\n", 3)
     return files
 
 ##################################################
@@ -101,8 +123,8 @@ def write_all_source_files(config,
 ##
 # Describes the command
 def description():
-    return _("The environ command generates the "
-                "environment files of your application.")
+    return _("The environ command generates the environment files of your "
+             "application.\n\nexample:\nsat environ SALOME-master")
 
 ##
 # Runs the command.