Commit 4e2dd4b6 authored by Kenneth Reitz's avatar Kenneth Reitz

Move pylibmc venderization to separate script

parent f9f9ae54
...@@ -31,23 +31,22 @@ EOF ...@@ -31,23 +31,22 @@ EOF
cd $BUILD_DIR cd $BUILD_DIR
# reject a non-packaged Django app # Reject a non-packaged Django app.
if [ "$NAME" = "Python" ]; then if [ "$NAME" = "Python" ]; then
[ -f manage.py ] && [ -f settings.py ] && { echo " ! Django app must be in a package subdirectory"; exit 1; } [ -f manage.py ] && [ -f settings.py ] && { echo " ! Django app must be in a package subdirectory"; exit 1; }
fi fi
# warn a checked-in virtualenv # Warn a checked-in virtualenv.
if [ -d "lib" ] || [ -d "bin" ]; then if [ -d "lib" ] || [ -d "bin" ]; then
echo " ! You have a virtualenv checked in. You should ignore the appropriate paths in your repo. See http://devcenter.heroku.com/articles/gitignore for more info."; echo " ! You have a virtualenv checked in. You should ignore the appropriate paths in your repo. See http://devcenter.heroku.com/articles/gitignore for more info.";
fi fi
# reject a conflicting checked-in virtualenv # Reject a conflicting checked-in virtualenv.
if [ -f "lib/python2.7" ]; then if [ -f "lib/python2.7" ]; then
echo " ! Checked-in virtualenv conflict." echo " ! Checked-in virtualenv conflict."
exit 1; exit 1;
fi fi
# copy artifacts out of cache if exists # copy artifacts out of cache if exists
mkdir -p $CACHE_DIR mkdir -p $CACHE_DIR
for dir in $VIRTUALENV_DIRS; do for dir in $VIRTUALENV_DIRS; do
...@@ -60,31 +59,13 @@ virtualenv --no-site-packages . | indent ...@@ -60,31 +59,13 @@ virtualenv --no-site-packages . | indent
# create set-aside .heroku folder. # create set-aside .heroku folder.
mkdir -p .heroku mkdir -p .heroku
# Pylibmc support.
source $BIN_DIR/steps/pylibmc
# if pylibmc within requirements, use vendored libmemcached # Activate the virtualenv.
if (grep -Fxiq "pylibmc" requirements.txt) || (grep -Fiq "pylibmc=" requirements.txt)
then
echo "-----> Noticed pylibmc. Bootstrapping libmemcached."
cd .heroku
if [ -d "vendor/lib/sasl2" ]; then
export LIBMEMCACHED=$(pwd)/vendor
else
curl -s -L -o tmp-libmemcached.tar.gz $VENDORED_MEMCACHED
tar -zxvf tmp-libmemcached.tar.gz > /dev/null
rm tmp-libmemcached.tar.gz
export LIBMEMCACHED=$(pwd)/vendor
fi
export LIBMEMCACHED=$(pwd)/vendor
cd ..
fi
echo "-----> Activating virtualenv" echo "-----> Activating virtualenv"
source bin/activate source bin/activate
# Install mercurial, if needed. # Install mercurial, if needed.
if (grep -Fiq "hg+" requirements.txt) then if (grep -Fiq "hg+" requirements.txt) then
pip install --use-mirrors mercurial | indent pip install --use-mirrors mercurial | indent
...@@ -94,13 +75,11 @@ fi ...@@ -94,13 +75,11 @@ fi
echo "-----> Installing dependencies using pip version $(bin/pip --version | awk '{print $2}')" echo "-----> Installing dependencies using pip version $(bin/pip --version | awk '{print $2}')"
pip install --use-mirrors -r requirements.txt | indent pip install --use-mirrors -r requirements.txt | indent
# Django support.
# if Django, append settings
if [ "$NAME" = "Python/Django" ]; then if [ "$NAME" = "Python/Django" ]; then
source $BIN_DIR/steps/django source $BIN_DIR/steps/django
fi fi
# Make virtualenv relocatable. # Make virtualenv relocatable.
set +e set +e
OUT=$(virtualenv --relocatable .) OUT=$(virtualenv --relocatable .)
......
#!/usr/bin/env bash
# if pylibmc within requirements, use vendored libmemcached
if (grep -Fxiq "pylibmc" requirements.txt) || (grep -Fiq "pylibmc=" requirements.txt)
then
echo "-----> Noticed pylibmc. Bootstrapping libmemcached."
cd .heroku
if [ -d "vendor/lib/sasl2" ]; then
export LIBMEMCACHED=$(pwd)/vendor
else
curl -s -L -o tmp-libmemcached.tar.gz $VENDORED_MEMCACHED
tar -zxvf tmp-libmemcached.tar.gz > /dev/null
rm tmp-libmemcached.tar.gz
export LIBMEMCACHED=$(pwd)/vendor
fi
export LIBMEMCACHED=$(pwd)/vendor
cd ..
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment