Some small improvements to the powershell "Activate" script for venvs:
1. Can be run as a command, rather than needing to be dot sourced. This matches the behaviour of bat files, and of virtualenv's "activate" script, and avoids a source of user error.
2. Makes the "deactivate" command a function, so that a separate script is not needed, and deactivate can still be run after the environment has been deleted (a common error I make is to remove a temporary venv having forgotten to deactivate it first).
3. Corrects the prompt to have a prefix (name) rather than [(name) ]. This is likely a bug in venv itself, as __VENV_NAME__ is documented as being just the name, not the prompt string. But changing that could be a backward compatibility issue, so I'd prefer to put that in a separate patch if it's needed.
These modifications are based on the virtualenv activate.ps1 script, which has been in use for some time, so they should be relatively well tested.
|