Fix env remove indentation (#40811)
This commit is contained in:
parent
cb018fd7eb
commit
f5d717cd5a
@ -388,27 +388,25 @@ def env_remove(args):
|
|||||||
except spack.config.ConfigFormatError:
|
except spack.config.ConfigFormatError:
|
||||||
bad_envs.append(env_name)
|
bad_envs.append(env_name)
|
||||||
|
|
||||||
if not args.yes_to_all:
|
if not args.yes_to_all:
|
||||||
environments = string.plural(len(args.rm_env), "environment", show_n=False)
|
environments = string.plural(len(args.rm_env), "environment", show_n=False)
|
||||||
envs = string.comma_and(args.rm_env)
|
envs = string.comma_and(args.rm_env)
|
||||||
answer = tty.get_yes_or_no(f"Really remove {environments} {envs}?", default=False)
|
answer = tty.get_yes_or_no(f"Really remove {environments} {envs}?", default=False)
|
||||||
if not answer:
|
if not answer:
|
||||||
tty.die("Will not remove any environments")
|
tty.die("Will not remove any environments")
|
||||||
|
|
||||||
for env in read_envs:
|
for env in read_envs:
|
||||||
name = env.name
|
name = env.name
|
||||||
if env.active:
|
if env.active:
|
||||||
tty.die(f"Environment {name} can't be removed while activated.")
|
tty.die(f"Environment {name} can't be removed while activated.")
|
||||||
env.destroy()
|
env.destroy()
|
||||||
tty.msg(f"Successfully removed environment {name}")
|
tty.msg(f"Successfully removed environment '{name}'")
|
||||||
|
|
||||||
for bad_env_name in bad_envs:
|
for bad_env_name in bad_envs:
|
||||||
shutil.rmtree(
|
shutil.rmtree(
|
||||||
spack.environment.environment.environment_dir_from_name(
|
spack.environment.environment.environment_dir_from_name(bad_env_name, exists_ok=True)
|
||||||
bad_env_name, exists_ok=True
|
)
|
||||||
)
|
tty.msg(f"Successfully removed environment '{bad_env_name}'")
|
||||||
)
|
|
||||||
tty.msg(f"Successfully removed environment '{bad_env_name}'")
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user