venvmod.commands.append_module module
To append instructions in modulefile.
- venvmod.commands.append_module.append_command(arguments: Tuple[str, str, str], description: str, help_arguments: str, command: str)[source]
Append a command to a modulefile.
- Parameters
arguments (Tuple[str, str, str]) – If None, arguments are read from
venvmod.commands.get_parser.get_parser()function, else(virtual_env, appli, arguments)given as strdescription (str) – Description of the command provided to
get_parserfunction ifargumentsis None.help_arguments (str) – Help of the command provided to
get_parserfunction ifargumentsis None.command (str) – Name of the command
- venvmod.commands.append_module.module_use(arguments: Optional[Tuple[str, str, str]] = None)[source]
Add a ‘module use’ command to a modulefile.
Paths to use are given as str in the last value of
arguments.
- venvmod.commands.append_module.module_load(arguments: Optional[Tuple[str, str, str]] = None)[source]
Add a ‘module load’ command to a modulefile.
Modules to load are given as str in the last value of
arguments.
- venvmod.commands.append_module.source_sh(arguments: Optional[Tuple[str, str, str]] = None)[source]
Add a ‘source-sh’ command to a modulefile.
Shell + file to source + args are given as str in the last value of
arguments.
- venvmod.commands.append_module.prepend_path(arguments: Optional[Tuple[str, str, str]] = None)[source]
Add a ‘prepent-path’ command to a modulefile.
Env var + paths to prepend are given as str in the last value of
arguments.
- venvmod.commands.append_module.append_path(arguments: Optional[Tuple[str, str, str]] = None)[source]
Add a ‘append-path’ command to a modulefile.
PEnv var + paths to append are given as str in the last value of
arguments.
- venvmod.commands.append_module.setenv(arguments: Optional[Tuple[str, str, str]] = None)[source]
Add a ‘setenv’ command to a modulefile.
Env var + value to define are given as str in the last value of
arguments.
- venvmod.commands.append_module.remove_path(arguments: Optional[Tuple[str, str, str]] = None)[source]
Add a ‘remove-path’ command to a modulefile.
Env var + value to remove are given as str in the last value of
arguments.
- venvmod.commands.append_module.set_aliases(arguments: Optional[Tuple[str, str, str]] = None)[source]
Add a ‘set-aliases’ command to a modulefile.
Alias to define are given as str in the last value of
arguments.
- venvmod.commands.append_module.read_env(arguments: Optional[Tuple[str, str]] = None)[source]
Add commands to a modulefile from environment variables.
Parse
os.environto look at variable starting with ‘appli’ (case insensitive) name.- For thoses variables, append commands for the following suffixes:
“LD_LIBRARY_PATH”, “PYTHONPATH”, “PATH”:
prepend“MODULE_USE”:
module use“MODULEFILES”:
module load“SOURCEFILES”:
source-shfor each element separated by ‘;’“EXPORTS”:
setenvfor each element separated by ‘ ‘“ALIASES”:
set-aliasesfor each element separated by ‘ ‘“REMOVE_PATHS”:
remove-pathfor each element separated by ‘ ‘
Examples
The following
$ export MY_APPLI_LD_LIBRARY_PATH="/path/to/lib1:/path/to/lib2" $ venvmod-cmd-read-env --appli MY_APPLI
will prepend “LD_LIBRARY_PATH” with “/path/to/lib1:/path/to/lib2” in “my_appli” module.