Skip to content

Instantly share code, notes, and snippets.

@d0ugal
Created February 29, 2012 14:06
Show Gist options
  • Save d0ugal/1941104 to your computer and use it in GitHub Desktop.
Save d0ugal/1941104 to your computer and use it in GitHub Desktop.
Auto-activating virtualenvs with autoenv and virtualenvwrapper.
PROJECT_DIR="$(dirname "${BASH_SOURCE:-$0}" )";
ABSOLUTE_DIR=`$SHELL -c "cd \"$PROJECT_DIR\" && pwd"`;
PROJECT_NAME="$( basename $ABSOLUTE_DIR)";
if [[ -n $PROJECT_NAME && $VIRTUAL_ENV != *"$PROJECT_NAME" ]];
then workon $PROJECT_NAME;
fi;
unset PROJECT_DIR;
unset ABSOLUTE_DIR;
unset PROJECT_NAME;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment