vox: Fix virtual environment removal

Virtual environment was impossible to delete after
activation/deactivation cycle.
This commit is contained in:
David Strobach 2020-08-23 20:38:03 +02:00
parent 88645cbce4
commit f4794caef7
2 changed files with 7 additions and 1 deletions

View file

@ -214,6 +214,9 @@ class VoxHandler:
file=sys.stderr,
)
return
except KeyError:
print('"%s" environment doesn\'t exist.\n' % name, file=sys.stderr)
return
else:
print('Environment "%s" removed.' % name)
print()

View file

@ -272,7 +272,10 @@ class Vox(collections.abc.Mapping):
the current one (throws a KeyError if there isn't one).
"""
if name is ...:
env_paths = [builtins.__xonsh__.env["VIRTUAL_ENV"]]
env = builtins.__xonsh__.env
if not env["VIRTUAL_ENV"]:
raise KeyError()
env_paths = [env["VIRTUAL_ENV"]]
elif isinstance(name, PathLike):
env_paths = [fspath(name)]
else: