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 str

  • description (str) – Description of the command provided to get_parser function if arguments is None.

  • help_arguments (str) – Help of the command provided to get_parser function if arguments is 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.

Parameters

arguments (Tuple[str, str, str], optional) – See append_command function, by default None

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.

Parameters

arguments (Tuple[str, str, str], optional) – See append_command function, by default None

venvmod.commands.append_module.source_sh(arguments: Optional[Tuple[str, str, str]] = None)[source]

Add a ‘source-sh’ command to a modulefile.

Shell + files to source are given as str in the last value of arguments.

Parameters

arguments (Tuple[str, str, str], optional) – See append_command function, by default None

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.

Parameters

arguments (Tuple[str, str, str], optional) – See append_command function, by default None

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.

Parameters

arguments (Tuple[str, str, str], optional) – See append_command function, by default None

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.

Parameters

arguments (Tuple[str, str, str], optional) – See append_command function, by default None

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.

Parameters

arguments (Tuple[str, str, str], optional) – See append_command function, by default None

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.

Parameters

arguments (Tuple[str, str, str], optional) – See append_command function, by default None

venvmod.commands.append_module.read_env(arguments: Optional[Tuple[str, str]] = None)[source]

Add commands to a modulefile from environment variables.

Parse os.environ to 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-sh

  • “EXPORTS”: setenv

  • “ALIASES”: set-aliases

  • “REMOVE_PATHS”: remove-path

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.

Parameters

arguments (Tuple[str, str], optional, by default None) – If None, arguments are read from get_parser function, else (virtual_env, appli) given as str