mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
42076f1bf4
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@.
88 lines
2.2 KiB
Bash
Executable File
88 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Default Python Versions
|
|
# shellcheck source=bin/default_pythons
|
|
source "bin/default_pythons"
|
|
|
|
testAirflow() {
|
|
local env_dir="$(mktmpdir)"
|
|
echo 'yes' > "${env_dir}/SLUGIFY_USES_TEXT_UNIDECODE"
|
|
compile 'airflow' '' "${env_dir}"
|
|
assertCaptured "apache-airflow==1.10.2"
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
testCollectstatic() {
|
|
compile "collectstatic"
|
|
assertCaptured "collectstatic"
|
|
}
|
|
|
|
testBuildWithGeoLibrariesWarning() {
|
|
local env_dir="$(mktmpdir)"
|
|
echo '1' > "${env_dir}/BUILD_WITH_GEO_LIBRARIES"
|
|
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() {
|
|
local env_dir="$(mktmpdir)"
|
|
# NOTE: This is a RuntimeWarning emitted by Python 3's runpy.py script
|
|
# which is what is used when you call `python -m <module>`. This is due to
|
|
# how nltk imports things. It's not actually an error, but it would probably
|
|
# be bad to silence in Production.
|
|
echo 'ignore::RuntimeWarning' > "${env_dir}/PYTHONWARNINGS"
|
|
compile 'nltk' '' "${env_dir}"
|
|
assertCaptured "[nltk_data] Downloading package city_database" "STD_ERR"
|
|
# Can't use `assertCapturedSuccess` since the NLTK downloader outputs all
|
|
# progress/status messages to stderr (W-8146040).
|
|
assertCapturedSuccessWithStdErr
|
|
}
|
|
|
|
testPsycopg2() {
|
|
compile "psycopg2"
|
|
assertCaptured "psycopg2"
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
testPysqlite() {
|
|
# pysqlite does not support Python 3 (since the sqlite3 stdlib can be used there),
|
|
# so we have to test with Python 2, which we've not made available for Heroku-20.
|
|
if [[ $STACK == "heroku-20" ]]; then
|
|
return
|
|
fi
|
|
compile "pysqlite"
|
|
assertCaptured "pysqlite"
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
testCffi() {
|
|
compile "cffi"
|
|
assertCaptured "cffi"
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
testPylibmc() {
|
|
compile "pylibmc"
|
|
assertCaptured "pylibmc"
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
testMercurial() {
|
|
compile "requirements-mercurial"
|
|
assertCaptured "Cloning hg"
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
pushd $(dirname 0) >/dev/null
|
|
popd >/dev/null
|
|
|
|
source $(pwd)/test/utils
|
|
source $(pwd)/test/shunit2
|