diff --git a/bin/steps/pip-install b/bin/steps/pip-install index 6159a07..643344d 100755 --- a/bin/steps/pip-install +++ b/bin/steps/pip-install @@ -63,8 +63,8 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then # Cache pip packages ourselves ## TODO: Update to cache pip's built-in cache - # Update cached version of requirements.txt - cp -R $BUILD_DIR/requirements.txt "$CACHE_DIR/.heroku/requirements.txt" + # # Update cached version of requirements.txt + # cp -R $BUILD_DIR/requirements.txt "$CACHE_DIR/.heroku/requirements.txt" cp requirements.txt .heroku/python/requirements-declared.txt /app/.heroku/python/bin/pip freeze --disable-pip-version-check > .heroku/python/requirements-installed.txt diff --git a/bin/steps/python b/bin/steps/python index eef658f..92cf400 100755 --- a/bin/steps/python +++ b/bin/steps/python @@ -95,14 +95,26 @@ if [ -f .heroku/python-version ]; then fi fi - - -echo "$(diff "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt")" - -# Remove python dependencies -if [[ ! -f "$CACHE_DIR/.heroku/requirements.txt" ]] || ! diff "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt" ; then +# Check if we should reinstall python dependencies +if [[ ! -f "$CACHE_DIR/.heroku/requirements.txt" ]]; then + # IF there's no cached dependencies, update cached version of requirements.txt + # This should only run for new apps and first deploys after this update + cp -R $BUILD_DIR/requirements.txt "$CACHE_DIR/.heroku/requirements.txt" + # If we don't already have a python version, this is a new app + if [ -f .heroku/python-version ]; then puts-step "Clearing cached dependencies" + # if there are any differences, clear the Python cache + # Installing Python over again does not take noticably more time rm -rf .heroku/python + fi +else + # IF there IS a cached directory, check for differences with the new one + if ! diff "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt"; then + puts-step "Clearing cached dependencies" + # if there are any differences, clear the Python cache + # Installing Python over again does not take noticably more time + rm -rf .heroku/python + fi fi if [ ! "$SKIP_INSTALL" ]; then