From da7760a5298ee6e6ba620368cb62c3b6f32bd556 Mon Sep 17 00:00:00 2001 From: Serge Rehbinder Date: Tue, 17 May 2016 10:53:10 +0200 Subject: [PATCH] 'sat environ' : rename option batch into bat --- commands/environ.py | 16 +++++++++------- src/fileEnviron.py | 10 +++++----- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/commands/environ.py b/commands/environ.py index f34396d..c092916 100644 --- a/commands/environ.py +++ b/commands/environ.py @@ -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 diff --git a/src/fileEnviron.py b/src/fileEnviron.py index 8463fc8..d149ca3 100644 --- a/src/fileEnviron.py +++ b/src/fileEnviron.py @@ -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 -- 2.30.2