Created
November 3, 2015 17:41
-
-
Save jamesandariese/28f29c9d6e5661e973af to your computer and use it in GitHub Desktop.
autoactivating venv
This file contains hidden or 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/sh | |
# add the following to your .bash_profile | |
# PROMPT_COMMAND=". ~/bin/autoactivate;$PROMPT_COMMAND" | |
# when you want to work on a project with a venv, | |
# run virtualenv venv in the base directory. | |
# awesomeness will ensue. | |
pushd . > /dev/null | |
# this might need to be /usr/bin/true for a mac | |
while /bin/true;do | |
if [ -d 'venv' ];then | |
. venv/bin/activate | |
break | |
fi | |
[ .. -ef . ] && break | |
[ . -ef ~ ] && break | |
cd .. | |
done | |
popd > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment