mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
a259143c0b
Since we need to set it regardless of whether the vendored library existed previously or not.
36 lines
1.2 KiB
Bash
Executable File
36 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This script serves as the Cryptography 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 libffi binary.
|
|
VENDORED_LIBFFI="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/libffi.tar.gz"
|
|
|
|
PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"
|
|
|
|
# Syntax sugar.
|
|
source $BIN_DIR/utils
|
|
|
|
bpwatch start libffi_install
|
|
|
|
# If a package using cffi exists within requirements, use vendored libffi.
|
|
if (pip-grep -s requirements.txt bcrypt cffi cryptography django[bcrypt] Django[bcrypt] PyNaCl pyOpenSSL PyOpenSSL requests[security] misaka &> /dev/null) then
|
|
|
|
if [ ! -d ".heroku/vendor/lib/libffi-3.1.1" ]; then
|
|
echo "-----> Noticed cffi. Bootstrapping libffi."
|
|
mkdir -p .heroku/vendor
|
|
# Download and extract libffi into target vendor directory.
|
|
curl $VENDORED_LIBFFI -s | tar zxv -C .heroku/vendor &> /dev/null
|
|
fi
|
|
|
|
export LIBFFI=$(pwd)/vendor
|
|
fi
|
|
|
|
bpwatch stop libffi_install
|