mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
39 lines
1.3 KiB
Bash
Executable File
39 lines
1.3 KiB
Bash
Executable File
#!/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="${VENDOR_URL}/libraries/vendor/gdal.tar.gz"
|
|
|
|
PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"
|
|
|
|
# Syntax sugar.
|
|
# shellcheck source=bin/utils
|
|
source "$BIN_DIR/utils"
|
|
|
|
# If GDAL exists within requirements, use vendored gdal.
|
|
if (pip-grep -s requirements.txt GDAL gdal pygdal &> /dev/null) then
|
|
|
|
if [ ! -f ".heroku/vendor/bin/gdalserver" ]; then
|
|
|
|
puts-warn "The vendored GDAL package in the Heroku Python Buildpack now deprecated."
|
|
puts-warn "To enable GDAL use an alternative buildpack is available here - https://github.com/heroku/heroku-geo-buildpack"
|
|
|
|
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
|
|
mcount "steps.vendor.gdal"
|
|
fi
|
|
|
|
GDAL=$(pwd)/vendor
|
|
export GDAL
|
|
fi
|