venvmod.modulefile module
Environment module modification/installation.
- venvmod.modulefile.get_module_file_directory(virtual_env: pathlib.Path) pathlib.Path[source]
Gets the modulefiles directory
- Parameters
virtual_env (Path) – Path to virtual env
- Returns
virtual_env path + “/etc/modulefiles”
- Return type
Path
- venvmod.modulefile.add_command(filename: pathlib.Path, line: str)[source]
Appends a command to a modulefile
- Parameters
filename (Path) – File to modify
line (str) – Line to append
- Raises
FileNotFoundError – If filename is not found
- venvmod.modulefile.get_version() str[source]
Gets modulefile version
- Returns
version as ‘x.y.z’, ‘0.0.0’ if not found
- Return type
- class venvmod.modulefile.ModuleInstaller(version_or_path: str, install_prefix: str, cache_directory: str)[source]
Bases:
objectClass to install Environment Module.
Methods
run([verbose, do_raise])run installer
- venvmod.modulefile.upgrade_modulefile(virtual_env: pathlib.Path, module_prefix: pathlib.Path) int[source]
Upgrade modulefile in venv
- Parameters
virtual_env (Path) – Path to virtual env
module_prefix (Path) – Modulefile install prefix
- Returns
return code
- Return type
- venvmod.modulefile.create_modulefile(virtual_env: pathlib.Path, module_name: str = 'venvmod', module_category: Optional[str] = None, log_load: str = '') int[source]
Creates a modulefile.
- venvmod.modulefile.upgrade_venv(virtual_env: pathlib.Path)[source]
Ugrade virtual env with modulefile at activate and deactivate.
- Parameters
env_prefix (Path) – Path to environment.
- Raises
AssertionError – If the activate script is not found.
AssertionError – If the module is already loaded frome the script but from another modulefile directory.