Closed edmorley closed 3 years ago
Using this branch:
$ mkdir testapp-geo-buildpack-fix && cd $_ && git init && h create --stack heroku-18
$ h buildpacks:add https://github.com/heroku/heroku-geo-buildpack#edmorley-set-library-path
$ h buildpacks:add heroku/python
$ echo 'python-2.7.16' > runtime.txt
$ touch requirements.txt
$ git add -A; git commit -m '.' && git push heroku main
...
$ h run -- python -c 'from ctypes.util import find_library; print(find_library("gdal"))'
libgdal.so.20
Nicely spotted @edmorley! Many thanks.
Django's library location auto-detection relies upon the stdlib's
ctypes.util.find_library()
, which in Python versions earlier than Python 3.6, didn't checkLD_LIBRARY_PATH
, onlyLIBRARY_PATH
: https://docs.python.org/3/library/ctypes.html#finding-shared-librariesSetting
LIBRARY_PATH
at runtime increases parity with the Python buildpack's legacy feature: https://github.com/heroku/heroku-buildpack-python/blob/41f657fbff4dd90efa7705737bc6fee4fba05dba/bin/steps/geo-libs#L53-L57And makes auto-detection work on Python <3.6.
Fixes #16. Closes W-8391584.