diff --git a/.gitignore b/.gitignore index f9b3db0..6b4391a 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ npm-debug.log # ============================================================================== # Python +local_virtualenv/ *.egg-info build/ dist/ diff --git a/anvil-local.sh b/anvil-local.sh new file mode 100755 index 0000000..32cc4ea --- /dev/null +++ b/anvil-local.sh @@ -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 "$@" diff --git a/setup-local.sh b/setup-local.sh new file mode 100755 index 0000000..5a68d3f --- /dev/null +++ b/setup-local.sh @@ -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