Created
March 12, 2014 21:45
-
-
Save acdha/9517060 to your computer and use it in GitHub Desktop.
Global virtualenvwrapper hooks which add a project's bin directory to the PATH any time you activate a virtualenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This hook is run after every virtualenv is activated. | |
VIRTUALENV_PROJECT_FILE="$VIRTUAL_ENV/$VIRTUALENVWRAPPER_PROJECT_FILENAME"; | |
if [ -f $VIRTUALENV_PROJECT_FILE ]; then | |
export VIRTUALENV_PROJECT=$(cat $VIRTUALENV_PROJECT_FILE); | |
if [ -d "$VIRTUALENV_PROJECT/bin" ]; then | |
export PATH="$VIRTUALENV_PROJECT/bin":$PATH | |
fi | |
fi | |
if [ ! -z "$VIRTUALENV_PROJECT" ]; then | |
pushd $VIRTUALENV_PROJECT | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This hook is run after every virtualenv is deactivated. | |
# Clean up after postactive | |
unset VIRTUALENV_PROJECT_FILE VIRTUALENV_PROJECT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment