Salome HOME
'sat environ' : rename option batch into bat
authorSerge Rehbinder <serge.rehbinder@cea.fr>
Tue, 17 May 2016 08:53:10 +0000 (10:53 +0200)
committerSerge Rehbinder <serge.rehbinder@cea.fr>
Tue, 17 May 2016 08:53:10 +0000 (10:53 +0200)
commands/environ.py
src/fileEnviron.py

index f34396d6b5a03ad0f4ae13570f788baa7fa279f3..c092916324b03192788223d60f9effbab7bc44d6 100644 (file)
@@ -22,17 +22,19 @@ import src
 
 parser = src.options.Options()
 parser.add_option('', 'shell', 'list2', 'shell',
-    _("Generates the environment files for the given format: bash (default), batch or all."), [])
+    _("Generates the environment files for the given format: "
+      "bash (default), bat (for windows) or all."), [])
 parser.add_option('p', 'products', 'list2', 'products',
     _("Includes only the specified products."))
 parser.add_option('', 'prefix', 'string', 'prefix',
     _("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."), None)
+    _("Specifies the directory path where to put the environment files."), 
+    None)
 
 # list of available shells with extensions
-C_SHELLS = { "bash": "sh", "batch": "bat" }
-C_ALL_SHELL = [ "bash", "batch" ]
+C_SHELLS = { "bash": "sh", "bat": "bat" }
+C_ALL_SHELL = [ "bash", "bat" ]
 
 
 ##
@@ -80,8 +82,8 @@ def write_all_source_files(config, logger, out_dir=None, src_root=None,
 ##
 # 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.")
 
 ##
 # Runs the command.
@@ -100,7 +102,7 @@ def run(args, runner, logger):
     if options.shell == []:
         shell = ["bash"]
         if src.architecture.is_windows():
-            shell = ["batch"]
+            shell = ["bat"]
     else:
         shell = options.shell
     
index 8463fc8929663b5126e4a2aece2f2d37b128ab43..d149ca3875509a9205449894cda83f05adf2f874 100644 (file)
@@ -18,7 +18,7 @@
 
 import os
 
-batch_header="""@echo off
+bat_header="""@echo off
 
 rem The following variables are used only in case of a sat package
 set out_dir_Path=%~dp0
@@ -89,8 +89,8 @@ def get_file_environ(output, shell, environ=None):
     """
     if shell == "bash":
         return BashFileEnviron(output, environ)
-    if shell == "batch":
-        return BatchFileEnviron(output, environ)
+    if shell == "bat":
+        return BatFileEnviron(output, environ)
     if shell == "cfgForPy":
         return LauncherFileEnviron(output, environ)
     raise Exception("FileEnviron: Unknown shell = %s" % shell)
@@ -277,7 +277,7 @@ class BashFileEnviron(FileEnviron):
             return
         FileEnviron.finish(self, required)
         
-class BatchFileEnviron(FileEnviron):
+class BatFileEnviron(FileEnviron):
     """for Windows batch shell.
     """
     def __init__(self, output, environ=None):
@@ -287,7 +287,7 @@ class BatchFileEnviron(FileEnviron):
         :param environ dict: a potential additional environment.
         """
         self._do_init(output, environ)
-        self.output.write(batch_header)
+        self.output.write(bat_header)
 
     def add_comment(self, comment):
         """Add a comment in the shell file