Created
September 2, 2011 13:07
-
-
Save acdha/1188557 to your computer and use it in GitHub Desktop.
My virtualenvwrapper postmkvirtualenv hook
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
#!/bin/bash | |
# This hook is run after a new virtualenv is activated. | |
set -e | |
(cat <<'PYDOC' | |
#!/usr/bin/env python | |
import pydoc | |
if __name__ == '__main__': | |
pydoc.cli() | |
PYDOC | |
) > $VIRTUAL_ENV/bin/pydoc | |
chmod +x $VIRTUAL_ENV/bin/pydoc | |
(cat <<'POSTACTIVATE' | |
#!/bin/sh | |
export PROJECT_ROOT=$HOME/Projects/__PROJECT_ROOT__ | |
export PATH=$PROJECT_ROOT/bin:$PATH | |
pushd $PROJECT_ROOT | |
POSTACTIVATE | |
) > $VIRTUAL_ENV/bin/postactivate | |
sed -i -e "s/__PROJECT_ROOT__/`basename $VIRTUAL_ENV`/g" $VIRTUAL_ENV/bin/postactivate | |
chmod +x $VIRTUAL_ENV/bin/postactivate | |
pip install -q https://github.com/acdha/pep8/tarball/master pyflakes ipython ipdb flake8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Check out the virtualenvwrapper.project plugin for managing the cwd when you activate an environment.