Skip to content
Snippets Groups Projects
Commit ee8d8578 authored by Ashwin Kumar Karnad's avatar Ashwin Kumar Karnad
Browse files

add comments and docs to remove_spack_environment

parent f10e95db
No related branches found
No related tags found
1 merge request!82Remove cmd
...@@ -1153,11 +1153,23 @@ def remove_environment(mpsd_release, root_dir, package_sets="NONE", force_remove ...@@ -1153,11 +1153,23 @@ def remove_environment(mpsd_release, root_dir, package_sets="NONE", force_remove
def remove_spack_environment(spack_dir, environment_name): def remove_spack_environment(spack_dir, environment_name):
"""Remove spack environment.""" """Remove spack environment including packages exclusive to it.
First activate the environment,
then uninstall all packages exclusive to the environment,
then deactivate the environment,
and finally remove the environment.
Parameters
----------
spack_dir : pathlib.Path
A Path object representing the path to the spack directory.
environment_name : str
A string representing the name of the spack environment to remove.
"""
logging.warning(f"Removing spack environment {environment_name}") logging.warning(f"Removing spack environment {environment_name}")
spack_env = spack_dir / "share" / "spack" / "setup-env.sh" spack_env = spack_dir / "share" / "spack" / "setup-env.sh"
commands_to_execute = [ commands_to_execute = [
f"export SPACK_DIR={spack_dir}", f"export SPACK_DIR={spack_dir}", # need to set SPACK_DIR in dash and sh
f". {spack_env}", f". {spack_env}",
f"spack env activate {environment_name}", f"spack env activate {environment_name}",
f"for spec in $(spack -e {environment_name} find" # this line continues f"for spec in $(spack -e {environment_name} find" # this line continues
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment