Created
February 26, 2013 01:53
-
-
Save pmclanahan/5035134 to your computer and use it in GitHub Desktop.
postactivate hook for virtualenvwrapper to add a project's `bin` directory to the path while the venv is active.
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
get_project_dir () { | |
virtualenvwrapper_verify_workon_home || return 1 | |
virtualenvwrapper_verify_active_environment || return 1 | |
if [ -f "$VIRTUAL_ENV/.project" ] | |
then | |
project_dir=$(cat "$VIRTUAL_ENV/.project") | |
if [ ! -z "$project_dir" ] | |
then | |
# will be cleaned up by virtualenvwrapper | |
export PATH="${project_dir}/bin/:$PATH" | |
# find new programs (possibly ZSH specific) | |
hash -r | |
fi | |
fi | |
return 0 | |
} | |
get_project_dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment