From 1aad21382ed43b0f70cea6b0ffddb137930bfea1 Mon Sep 17 00:00:00 2001
From: Kenneth Reitz <me@kennethreitz.com>
Date: Thu, 7 Mar 2013 20:50:51 -0500
Subject: [PATCH] update pip if it is out of date

---
 bin/compile | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/bin/compile b/bin/compile
index 9830d095..22340918 100755
--- a/bin/compile
+++ b/bin/compile
@@ -27,6 +27,8 @@ PROFILE_PATH="$BUILD_DIR/.profile.d/python.sh"
 # Python version. This will be used in the future to specify custom Pythons.
 DEFAULT_PYTHON_VERSION="python-2.7.3"
 PYTHON_EXE="/app/.heroku/python/bin/python"
+PIP_VERSION="1.3.1"
+DISTRIBUTE_VERSION="0.6.35"
 
 # Sanitizing environment variables.
 unset GIT_DIR PYTHONHOME PYTHONPATH LD_LIBRARY_PATH LIBRARY_PATH
@@ -124,20 +126,23 @@ if [ ! "$SKIP_INSTALL" ]; then
   echo $PYTHON_VERSION > .heroku/python-version
   WORKING_DIR=$(pwd)
 
+  hash -r
+else
+  puts-step "Using Python runtime ($PYTHON_VERSION)"
+fi
+
+# If Pip isn't up to date:
+if [[ ! $(pip --version) == *$PIP_VERSION* ]]; then
   # Prepare it for the real world
-  puts-step "Installing Distribute (0.6.35)"
-  cd $ROOT_DIR/vendor/distribute-0.6.35/
+  puts-step "Installing Distribute ($DISTRIBUTE_VERSION)"
+  cd $ROOT_DIR/vendor/distribute-$DISTRIBUTE_VERSION/
   python setup.py install  &> /dev/null
   cd $WORKING_DIR
 
-  puts-step "Installing Pip (1.3.1)"
-  cd $ROOT_DIR/vendor/pip-1.3.1/
+  puts-step "Installing Pip ($PIP_VERSION)"
+  cd $ROOT_DIR/vendor/pip-$PIP_VERSION/
   python setup.py install  &> /dev/null
   cd $WORKING_DIR
-
-  hash -r
-else
-  puts-step "Using Python runtime ($PYTHON_VERSION)"
 fi
 
 set -e
-- 
GitLab