#!/usr/bin/env bash shopt -s extglob old-platform() { if grep -qi 'InsecurePlatformWarning' "$WARNINGS_LOG"; then echo puts-warn "Hello! It looks like your application is using an outdated version of Python." puts-warn "This caused the security warning you saw above during the 'pip install' step." puts-warn "We recommend '$RECOMMENDED_PYTHON_VERSION', which you can specify in a 'runtime.txt' file." puts-warn " -- Much Love, Heroku." mcount 'warnings.python.old' fi } scipy-included() { if grep -qi 'running setup.py install for scipy' "$WARNINGS_LOG"; then echo puts-warn "Hello! It looks like you're trying to use scipy on Heroku." puts-warn "Unfortunately, at this time, we do not directly support this library." puts-warn "There is, however, a buildpack available that makes it possible to use it on Heroku." puts-warn "You can learn more here: https://devcenter.heroku.com/articles/python-c-deps" puts-warn "Sorry for the inconvenience. -- Much Love, Heroku." mcount 'warnings.scipy' fi } distribute-included() { if grep -qi 'Running setup.py install for distribute' "$WARNINGS_LOG"; then echo puts-warn "Hello! Your requirements.txt file contains the distribute package." puts-warn "This library is automatically installed by Heroku and shouldn't be in" puts-warn "Your requirements.txt file. This can cause unexpected behavior." puts-warn " -- Much Love, Heroku." mcount 'warnings.distribute' fi } six-included() { if grep -qi 'Running setup.py install for six' "$WARNINGS_LOG"; then echo puts-warn "Hello! Your requirements.txt file contains the six package." puts-warn "This library is automatically installed by Heroku and shouldn't be in" puts-warn "Your requirements.txt file. This can cause unexpected behavior." puts-warn " -- Much Love, Heroku." mcount 'warnings.six' fi } gdal-missing() { if grep -qi 'Could not find gdal-config' "$WARNINGS_LOG"; then mcount 'warnings.gdal' echo puts-warn "Hello! Package installation failed since the GDAL library was not found." puts-warn "For GDAL, GEOS and PROJ support, use the Geo buildpack alongside the Python buildpack:" puts-warn "https://github.com/heroku/heroku-geo-buildpack" puts-warn " -- Much Love, Heroku." fi } show-warnings() { old-platform scipy-included distribute-included six-included gdal-missing }