From afa8a0f75fa4ec7d62898aa6db8bfa6ddea83274 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz <me@kennethreitz.org> Date: Thu, 14 May 2015 08:27:16 +0200 Subject: [PATCH] pre-compiled gdal step --- bin/steps/gdal | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 bin/steps/gdal diff --git a/bin/steps/gdal b/bin/steps/gdal new file mode 100755 index 00000000..2172ede8 --- /dev/null +++ b/bin/steps/gdal @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# This script serves as the GDAL build step of the +# [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python) +# compiler. +# +# A [buildpack](http://devcenter.heroku.com/articles/buildpacks) is an +# adapter between a Python application and Heroku's runtime. +# +# This script is invoked by [`bin/compile`](/). + +# The location of the pre-compiled cryptography binary. +VENDORED_GDAL="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/gdal.tar.gz" + +PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH" + +# Syntax sugar. +source $BIN_DIR/utils + +bpwatch start gdal_install + +# If GDAL exists within requirements, use vendored gdal. +if (pip-grep -s requirements.txt GDAL &> /dev/null) then + + if [ -d ".heroku/vendor/lib/libffi-3.1.1" ]; then + export LIBFFI=$(pwd)/vendor + else + echo "-----> Noticed GDAL. Bootstrapping gdal." + mkdir -p .heroku/vendor + # Download and extract cryptography into target vendor directory. + curl $VENDORED_GDAL -s | tar zxv -C .heroku/vendor &> /dev/null + + export LIBFFI=$(pwd)/vendor + fi +fi + +bpwatch stop gdal_install -- GitLab