mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
fcf696b835
This adds support for the upcoming Heroku-20 stack. The Heroku-20 Dockerfile is identical to that for Heroku-18, other than the base image, and stack-related env var changes. The initial Python versions made available will be those in: https://devcenter.heroku.com/articles/python-support#supported-runtimes https://devcenter.heroku.com/articles/python-support#supported-pypy-runtimes ...minus CPython 2.7, since it's EOL. Which are: * `python-3.6.12` * `python-3.7.9` * `python-3.8.6` * `python-3.9.0` * `pypy2.7-7.3.2` * `pypy3.6-7.3.2` Note: Unlike CPython 2.7, the PyPy 2.7 branch is still supported: https://doc.pypy.org/en/latest/faq.html#how-long-will-pypy-support-python2 In addition, I've generated binaries for each patch release immediately prior to the latest versions (with the exception of 3.9.0, since there isn't one), otherwise it's not possible to run the "out of date Python" warning tests. The binaries were generated using the process here: https://github.com/heroku/heroku-buildpack-python/blob/main/builds/README.md Specifically: ``` make deploy-runtimes STACKS='heroku-20' \ RUNTIMES='python-3.6.11 python-3.6.12 python-3.7.8 python-3.7.9 python-3.8.5 python-3.8.6 python-3.9.0 pypy2.7-7.3.1 pypy2.7-7.3.2 pypy3.6-7.3.1 pypy3.6-7.3.2' \ ENV_FILE=... ``` Binaries for the GDAL/GEOS/PROJ feature have not been generated, since it's deprecated and due for removal shortly: https://help.heroku.com/D5INLB1A/python-s-build_with_geo_libraries-legacy-feature-is-now-deprecated Note: Like the Python 3.9.0 release, this uses the new S3 bucket, so apps will need to be using a recent version of the buildpack in order to build on Heroku-20: https://devcenter.heroku.com/articles/python-support#checking-the-python-buildpack-version Closes @W-7485877@.
59 lines
2.5 KiB
Bash
Executable File
59 lines
2.5 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="${S3_BASE_URL}/${STACK}/libraries/vendor/gdal.tar.gz"
|
|
VENDORED_GEOS="${S3_BASE_URL}/${STACK}/libraries/vendor/geos.tar.gz"
|
|
VENDORED_PROJ="${S3_BASE_URL}/${STACK}/libraries/vendor/proj.tar.gz"
|
|
|
|
PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"
|
|
|
|
# Syntax sugar.
|
|
# shellcheck source=bin/utils
|
|
source "$BIN_DIR/utils"
|
|
|
|
if [[ "$BUILD_WITH_GEO_LIBRARIES" && "${STACK}" == 'heroku-20' ]]; then
|
|
puts-warn "The GDAL, GEOS and PROJ binaries and BUILD_WITH_GEO_LIBRARIES functonality is not supported on Heroku-20."
|
|
puts-warn "Please use this buildpack for GDAL, GEOS and PROJ: https://github.com/heroku/heroku-geo-buildpack"
|
|
puts-warn "To hide this message, unset the BUILD_WITH_GEO_LIBRARIES variable using: heroku config:unset BUILD_WITH_GEO_LIBRARIES"
|
|
elif [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then
|
|
mcount "buildvar.BUILD_WITH_GEO_LIBRARIES"
|
|
|
|
puts-warn "The GDAL, GEOS and PROJ binaries and BUILD_WITH_GEO_LIBRARIES functonality are now deprecated."
|
|
puts-warn "An alternative buildpack to enable GDAL, GEOS and PROJ use is available here - https://github.com/heroku/heroku-geo-buildpack"
|
|
|
|
if [ ! -f ".heroku/vendor/bin/proj" ]; then
|
|
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
|
|
|
|
mcount "steps.vendor.geo_libs"
|
|
# Copy libjasper from build image to slug.
|
|
if [[ "$STACK" == "heroku-16" ]]; then
|
|
cp /usr/lib/x86_64-linux-gnu/libjasper.so* ".heroku/vendor/lib/."
|
|
mcount "steps.vendor.libjasper"
|
|
fi
|
|
|
|
fi
|
|
|
|
GDAL=$(pwd)/vendor
|
|
export GDAL
|
|
# set path for post_compile hooks
|
|
export GDAL_LIBRARY_PATH="$BUILD_DIR/.heroku/vendor/lib/libgdal.so"
|
|
export GEOS_LIBRARY_PATH="$BUILD_DIR/.heroku/vendor/lib/libgeos_c.so"
|
|
# set path for runtime environmeht
|
|
set_env GDAL_LIBRARY_PATH "/app/.heroku/vendor/lib/libgdal.so"
|
|
set_env GEOS_LIBRARY_PATH "/app/.heroku/vendor/lib/libgeos_c.so"
|
|
fi
|