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" ]
##
##
# 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.
if options.shell == []:
shell = ["bash"]
if src.architecture.is_windows():
- shell = ["batch"]
+ shell = ["bat"]
else:
shell = options.shell
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
"""
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)
return
FileEnviron.finish(self, required)
-class BatchFileEnviron(FileEnviron):
+class BatFileEnviron(FileEnviron):
"""for Windows batch shell.
"""
def __init__(self, output, environ=None):
: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