Skip to content
Snippets Groups Projects

Remove cmd

Merged Ashwin Kumar Karnad requested to merge continue-with-remove-cmd into main
3 unresolved threads
1 file
+ 14
2
Compare changes
  • Side-by-side
  • Inline
@@ -1153,11 +1153,23 @@ def remove_environment(mpsd_release, root_dir, package_sets="NONE", force_remove
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}")
spack_env = spack_dir / "share" / "spack" / "setup-env.sh"
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 activate {environment_name}",
f"for spec in $(spack -e {environment_name} find" # this line continues
Loading