Skip to content

Commit

Permalink
Remove deprecated GDAL/GEOS/PROJ support (#1113)
Browse files Browse the repository at this point in the history
The standalone Geo buildpack offers more modern GDAL/GEOS/PROJ library
versions, and can be used by apps in all languages, not just Python:
https://github.com/heroku/heroku-geo-buildpack

As such the Python buildpack's undocumented built-in support was
deprecated back in April 2020, with a scheduled removal date of
6th October 2020:
https://devcenter.heroku.com/changelog-items/1759
https://help.heroku.com/D5INLB1A/python-s-build_with_geo_libraries-legacy-feature-is-now-deprecated

Metrics show very few builds continuing to use the built-in support.

Apps with the `BUILD_WITH_GEO_LIBRARIES` env var set will now be shown a
warning directing them to the standalone buildpack, as well as apps that
hit GDAL related pip install errors but aren't using the env var.

This also moves us one step closer to being able to remove
the vendored copy of pip-pop (which is partially broken on
newer pip).

Closes @W-7654424@.
  • Loading branch information
edmorley authored Nov 11, 2020
1 parent 41f657f commit 42076f1
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 200 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Remove deprecated GDAL/GEOS/PROJ support (#1113).
- Remove vendored `jq` binary (#1112).
- Remove redundant Mercurial install step (#1111).
- Remove support for the Cedar-14 stack (#1110).
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ STACK_IMAGE_TAG := heroku/$(subst -,:,$(STACK))-build

check:
@shellcheck -x bin/compile bin/detect bin/release bin/test-compile bin/utils bin/warnings bin/default_pythons
@shellcheck -x bin/steps/collectstatic bin/steps/eggpath-fix bin/steps/eggpath-fix2 bin/steps/gdal bin/steps/geo-libs bin/steps/nltk bin/steps/pip-install bin/steps/pip-uninstall bin/steps/pipenv bin/steps/pipenv-python-version bin/steps/python
@shellcheck -x bin/steps/collectstatic bin/steps/eggpath-fix bin/steps/eggpath-fix2 bin/steps/nltk bin/steps/pip-install bin/steps/pip-uninstall bin/steps/pipenv bin/steps/pipenv-python-version bin/steps/python
@shellcheck -x bin/steps/hooks/*

test:
Expand Down
16 changes: 1 addition & 15 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ fi
# environment variable mechanism (the ENV_DIR).
S3_BASE_URL="${BUILDPACK_S3_BASE_URL:-"https://heroku-buildpack-python.s3.amazonaws.com"}"
# This has to be exported since it's used by the geo-libs step which is run in a subshell.
# TODO: Stop exporting once the geo-libs step is removed or no longer uses `sub_env`.
export S3_BASE_URL

# Default Python Versions
# shellcheck source=bin/default_pythons
Expand Down Expand Up @@ -137,6 +135,7 @@ export LANG=en_US.UTF-8
# `~/.heroku/vendor` is an place where the buildpack may stick pre-build binaries for known
# C dependencies. This section configures Python (GCC, more specifically)
# and pip to automatically include these paths when building binaries.
# TODO: Stop adding .heroku/vendor here now that the buildpack no longer vendors anything.
export C_INCLUDE_PATH=/app/.heroku/vendor/include:/app/.heroku/python/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/app/.heroku/vendor/include:/app/.heroku/python/include:$CPLUS_INCLUDE_PATH
export LIBRARY_PATH=/app/.heroku/vendor/lib:/app/.heroku/python/lib:$LIBRARY_PATH
Expand Down Expand Up @@ -176,8 +175,6 @@ cp -R "$CACHE_DIR/.heroku/python-stack" .heroku/ &> /dev/null || true
cp -R "$CACHE_DIR/.heroku/python-version" .heroku/ &> /dev/null || true
# A plain text file which contains the current sqlite3 version being used (used for cache busting).
cp -R "$CACHE_DIR/.heroku/python-sqlite3-version" .heroku/ &> /dev/null || true
# Any pre-compiled binaries, provided by the buildpack.
cp -R "$CACHE_DIR/.heroku/vendor" .heroku/ &> /dev/null || true
# "editable" installations of code repositories, via pip or pipenv.
if [[ -d "$CACHE_DIR/.heroku/src" ]]; then
cp -R "$CACHE_DIR/.heroku/src" .heroku/ &> /dev/null || true
Expand Down Expand Up @@ -263,16 +260,6 @@ fi
# shellcheck source=bin/steps/eggpath-fix
source "$BIN_DIR/steps/eggpath-fix"

# Support for Geo libraries. This is deprecated functionality.
# It is undocumented.
# shellcheck source=bin/steps/geo-libs
sub_env "$BIN_DIR/steps/geo-libs"

# GDAL support.
# This is part of the Geo support.
# shellcheck source=bin/steps/gdal
source "$BIN_DIR/steps/gdal"

# SQLite3 support.
# This sets up and installs sqlite3 dev headers and the sqlite3 binary but not the
# libsqlite3-0 library since that exists on the stack image.
Expand Down Expand Up @@ -370,7 +357,6 @@ mkdir -p "$CACHE_DIR/.heroku"
cp -R .heroku/python "$CACHE_DIR/.heroku/"
cp -R .heroku/python-version "$CACHE_DIR/.heroku/"
cp -R .heroku/python-stack "$CACHE_DIR/.heroku/" &> /dev/null || true
cp -R .heroku/vendor "$CACHE_DIR/.heroku/" &> /dev/null || true
if [[ -d .heroku/src ]]; then
cp -R .heroku/src "$CACHE_DIR/.heroku/" &> /dev/null || true
fi
Expand Down
41 changes: 0 additions & 41 deletions bin/steps/gdal

This file was deleted.

58 changes: 0 additions & 58 deletions bin/steps/geo-libs

This file was deleted.

26 changes: 26 additions & 0 deletions bin/warnings
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,36 @@ six-included() {
fi
}

geo-gdal-support() {
if [[ -f "${ENV_DIR}/BUILD_WITH_GEO_LIBRARIES" ]]; then
mcount "warnings.BUILD_WITH_GEO_LIBRARIES"
echo
puts-warn "The Python buildpack's BUILD_WITH_GEO_LIBRARIES functonality is no longer supported:"
puts-warn "https://help.heroku.com/D5INLB1A/python-s-build_with_geo_libraries-legacy-feature-is-now-deprecated"
puts-warn
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
puts-warn "To hide this message, unset the BUILD_WITH_GEO_LIBRARIES variable using:"
puts-warn "heroku config:unset BUILD_WITH_GEO_LIBRARIES"
echo
return
fi
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
geo-gdal-support
}

24 changes: 0 additions & 24 deletions builds/libraries/vendor/gdal

This file was deleted.

25 changes: 0 additions & 25 deletions builds/libraries/vendor/geos

This file was deleted.

24 changes: 0 additions & 24 deletions builds/libraries/vendor/proj

This file was deleted.

1 change: 1 addition & 0 deletions test/fixtures/gdal/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gdal
1 change: 0 additions & 1 deletion test/fixtures/geos/requirements.txt

This file was deleted.

20 changes: 10 additions & 10 deletions test/run-deps
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ testCollectstatic() {
assertCaptured "collectstatic"
}

testGEOS() {
testBuildWithGeoLibrariesWarning() {
local env_dir="$(mktmpdir)"
echo '1' > "${env_dir}/BUILD_WITH_GEO_LIBRARIES"
compile 'geos' '' "${env_dir}"
if [[ $STACK == "heroku-20" ]]; then
assertCaptured " ! The GDAL, GEOS and PROJ binaries and BUILD_WITH_GEO_LIBRARIES functonality is not supported on Heroku-20."
else
assertCaptured " ! The GDAL, GEOS and PROJ binaries and BUILD_WITH_GEO_LIBRARIES functonality are now deprecated."
fi
# This should assertCapturedError on Heroku-20, but the test doesn't actually
# install anything that uses GEOS so succeeds (see W-8145375)
assertCapturedSuccess
compile 'gdal' '' "${env_dir}"
assertCaptured " ! The Python buildpack's BUILD_WITH_GEO_LIBRARIES functonality is no longer supported"
assertCapturedError
}

testGDALWarning() {
compile 'gdal'
assertCaptured " ! Hello! Package installation failed since the GDAL library was not found."
assertCapturedError
}

testNLTK() {
Expand Down
1 change: 0 additions & 1 deletion test/run-features
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ testHooks() {
PROFILE_PATH
PWD
PYTHONUNBUFFERED
S3_BASE_URL
SHLVL
SOME_APP_CONFIG_VAR
STACK
Expand Down

0 comments on commit 42076f1

Please sign in to comment.