geo-libs 1.35 KB
Newer Older
Kenneth Reitz's avatar
Kenneth Reitz committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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](https://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"
VENDORED_GEOS="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/geos.tar.gz"
VENDORED_PROJ="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/proj.tar.gz"

PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"

# Syntax sugar.
source $BIN_DIR/utils

bpwatch start geo_libs_install

# If GDAL exists within requirements, use vendored gdal.
if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then

27
  if [ ! -f ".heroku/vendor/bin/proj" ]; then
Kenneth Reitz's avatar
Kenneth Reitz committed
28
29
30
31
32
33
34
    echo "-----> Bootstrapping gdal, geos, proj."
    mkdir -p .heroku/vendor
    # Download and extract cryptography into target vendor directory.
    curl $VENDORED_GDAL -s | tar zxv -C .heroku/vendor &> /dev/null
    curl $VENDORED_GEOS -s | tar zxv -C .heroku/vendor &> /dev/null
    curl $VENDORED_PROJ -s | tar zxv -C .heroku/vendor &> /dev/null
  fi
35
36

  export GDAL=$(pwd)/vendor
Kenneth Reitz's avatar
Kenneth Reitz committed
37
38
39
fi

bpwatch stop geo_libs_install