Created
January 31, 2011 16:48
-
-
Save gtzilla/804341 to your computer and use it in GitHub Desktop.
Delay sourcing virtualenvwrapper.sh until first call to workon
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
## delay sourcing venv to workon call | |
## replace "source /Library/Frameworks/Python.framework/Versions/2.6/bin/virtualenvwrapper.sh" | |
## with below block | |
function load_env { | |
if [ type -p workon &> /dev/null ]; then | |
# nothing, source is loaded | |
workon "$@" | |
else | |
unalias workon | |
source /Library/Frameworks/Python.framework/Versions/2.6/bin/virtualenvwrapper.sh | |
workon "$@" | |
fi | |
} | |
alias workon="load_env" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://virtualenvwrapper.readthedocs.org/en/latest/install.html#lazy-loading
I did: