use virtualenv to prepare python and install windmill

(this should be much more portable and much more user friendly since it doesn't change the local python installation and doesn't require any administration credentials)


git-svn-id: http://google-refine.googlecode.com/svn/trunk@417 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-04-07 21:45:39 +00:00
parent bd24e5c7ff
commit 73454cfa05

View File

@ -172,18 +172,18 @@ tool_download() {
DIR=$3 DIR=$3
cd $GRIDWORKS_TOOLS_DIR cd $GRIDWORKS_TOOLS_DIR
if [ ! -f "$FILE" ] ; then if [ ! -f "$FILE" ] ; then
download $URL $FILE download $URL $FILE
fi
if [ ! -d "$DIR" ] ; then
if [ "`echo $FILE | sed 's@.*.tar.gz$@@' | sed 's@.*.tgz$@@'`" == "" ] ; then
tar xzf $FILE || error "Error while expanding $FILE"
fi fi
if [ "`echo $FILE | sed 's@.*.zip$@@'`" == "" ] ; then if [ ! -d "$DIR" ] ; then
check_unzip if [ "`echo $FILE | sed 's@.*.tar.gz$@@' | sed 's@.*.tgz$@@'`" == "" ] ; then
$UNZIP -q $FILE || error "Error while expanding $FILE" tar xzf $FILE || error "Error while expanding $FILE"
fi
if [ "`echo $FILE | sed 's@.*.zip$@@'`" == "" ] ; then
check_unzip
$UNZIP -q $FILE || error "Error while expanding $FILE"
fi
fi fi
fi
cd .. cd ..
} }
@ -230,13 +230,13 @@ ant_prepare() {
if [ $ANT == "" ] ; then if [ $ANT == "" ] ; then
if [ $ANT_HOME == "" ] ; then if [ $ANT_HOME == "" ] ; then
cd $GRIDWORKS_TOOLS_DIR cd $GRIDWORKS_TOOLS_DIR
if [ ! -f $ANT_FILE ] ; then if [ ! -f $ANT_FILE ] ; then
download $ANT_URL $ANT_FILE download $ANT_URL $ANT_FILE
fi fi
if [ ! -d $ANT_DIR ] ; then if [ ! -d $ANT_DIR ] ; then
tar xzf $ANT_FILE -C . || error "Error while expanding $ANT_FILE" tar xzf $ANT_FILE -C . || error "Error while expanding $ANT_FILE"
fi fi
export ANT_HOME="`pwd`/$ANT_DIR" export ANT_HOME="`pwd`/$ANT_DIR"
cd .. cd ..
fi fi
ANT="$ANT_HOME/bin/ant" ANT="$ANT_HOME/bin/ant"
@ -263,28 +263,35 @@ jarbundler_prepare() {
tool_download $JARBUNDLER_URL $JARBUNDLER_FILE $JARBUNDLER_DIR tool_download $JARBUNDLER_URL $JARBUNDLER_FILE $JARBUNDLER_DIR
} }
virtualenv_prepare() {
check_python
VIRTUALENV_URL="http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.4.6.tar.gz"
VIRTUALENV_FILE="virtualenv-1.4.6.tar.gz"
VIRTUALENV_DIR="virtualenv-1.4.6"
tool_download $VIRTUALENV_URL $VIRTUALENV_FILE $VIRTUALENV_DIR
if [ ! -d "$GRIDWORKS_TOOLS_DIR/python" ] ; then
$PYTHON $GRIDWORKS_TOOLS_DIR/$VIRTUALENV_DIR/virtualenv.py $GRIDWORKS_TOOLS_DIR/python
fi
PYTHON_HOME="`pwd`/$GRIDWORKS_TOOLS_DIR/python"
PYTHON="$PYTHON_HOME/bin/python"
PYTHON_INSTALL="$PYTHON_HOME/bin/easy_install"
}
windmill_prepare() { windmill_prepare() {
WINDMILL="`which windmill`" WINDMILL="`which windmill`"
if [ "$WINDMILL" == "" ] ; then if [ "$WINDMILL" == "" ] ; then
check_python check_python
tools_prepare tools_prepare
WINDMILL_URL="http://github.com/windmill/windmill/tarball/1.3beta2"
WINDMILL_FILE="windmill-1.3beta2.tar.gz"
WINDMILL_DIR="windmill-1.3beta2"
tool_download $WINDMILL_URL $WINDMILL_FILE $WINDMILL_DIR
WINDMILL="$GRIDWORKS_TOOLS_DIR/windmill" WINDMILL="$GRIDWORKS_TOOLS_DIR/windmill"
if [ ! -f $WINDMILL ] ; then if [ ! -f $WINDMILL ] ; then
cd $GRIDWORKS_TOOLS_DIR virtualenv_prepare
WINDMILL_SRC=`find . -type d -depth 1 | grep windmill` $PYTHON_INSTALL windmill
cd $WINDMILL_SRC ln -s $PYTHON_HOME/bin/windmill $GRIDWORKS_TOOLS_DIR/windmill
echo "About to install Windmill with 'sudo', you might be asked to input your admin password"
WINDMILL=`sudo python setup.py develop | grep 'Installing windmill script to' | sed 's|.* /|/|'`/windmill
cd ..
ln -s $WINDMILL windmill
cd ..
fi fi
fi fi
} }
@ -702,8 +709,11 @@ case "$ACTION" in
clean) ant clean;; clean) ant clean;;
distclean) ant distclean;; distclean) ant distclean;;
test) test $1;; test) test $1;;
tests) test $1;;
ui_test) ui_test $1;; ui_test) ui_test $1;;
ui_tests) ui_test $1;;
server_test) server_test $1;; server_test) server_test $1;;
server_tests) server_test $1;;
findbugs) findbugs;; findbugs) findbugs;;
pmd) pmd;; pmd) pmd;;
cpd) cpd;; cpd) cpd;;