Support for using virtualenv for better side-by-side deps

This commit is contained in:
Ben Vanik 2012-10-10 12:15:54 -07:00
parent 58783a53aa
commit c59307c6d1
3 changed files with 49 additions and 0 deletions

1
.gitignore vendored
View File

@ -50,6 +50,7 @@ npm-debug.log
# ==============================================================================
# Python
local_virtualenv/
*.egg-info
build/
dist/

18
anvil-local.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# Copyright 2012 Google Inc. All Rights Reserved.
# Runs the local virtualenv copy of anvil instead of the global one.
# Requires that things be setup with ./setup-local.sh (which this will attempt
# to invoke if it notices things not quite right).
# Check to see if setup.
if [ ! -d "local_virtualenv" ]; then
echo "Missing local virtualenv - setting up..."
./setup-local.sh
fi
source local_virtualenv/bin/activate
python anvil/manage.py "$@"

30
setup-local.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
# Copyright 2012 Google Inc. All Rights Reserved.
# Sets up a local virtualenv for anvil.
# This places all dependencies within the anvil-build/ path such that nothing
# from site-packages is used. In order to make use of this consumers should
# invoke anvil-local.sh instead of the global 'anvil'.
# Ensure virtualenv is present.
if [ ! -e "$(which virtualenv)" ]; then
echo "virtualenv not found - installing..."
if [ -e "$(which pip)" ]; then
sudo pip install virtualenv
elif [-e "$(which easyinstall)" ]; then
sudo easy_install virtualenv
else
echo "No python package installer found - aborting"
echo "(get pip or easy_install)"
exit 1
fi
fi
# Setup the virtual environment.
/usr/local/lib/python2.6/dist-packages/virtualenv-1.8.2-py2.6.egg/virtualenv.py local_virtualenv
# Install there.
source local_virtualenv/bin/activate
python setup.py develop