Last active
March 30, 2016 01:58
-
-
Save dcwangmit01/b0ecea10fd7c7d531b545960bbb3b7fa to your computer and use it in GitHub Desktop.
Direnv .envrc for Python 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
# direnv file: https://github.com/direnv/direnv | |
# Automatically sets the gopath to the directory wherever this .envrc | |
# file lives, even from subdirectories | |
OLD_PYTHON=`which python` | |
VENV_PATH=`pwd`/.venv/`hostname` | |
if [ ! -d "$VENV_PATH" ]; then | |
virtualenv $VENV_PATH | |
fi | |
source $VENV_PATH/bin/activate | |
NEW_PYTHON=`which python` | |
if [ "$OLD_PYTHON" != "$NEW_PYTHON" ]; then # don't quote the variables, to strip the newline | |
echo "Virtualenv changed" | |
echo " from $OLD_PYTHON" | |
echo " to $NEW_PYTHON" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment