@@ -90,7 +90,6 @@ export PATH=$PATH:$ROOT_DIR/vendor/:$ROOT_DIR/vendor/pip-pop
90
90
unset GIT_DIR PYTHONHOME PYTHONPATH
91
91
unset RECEIVE_DATA RUN_KEY BUILD_INFO DEPLOY LOG_TOKEN
92
92
unset CYTOKINE_LOG_FILE GEM_PATH
93
- export PYTHONPATH=" $BUILD_DIR "
94
93
95
94
# Import the utils script, which contains helper functions used throughout the buildpack.
96
95
# shellcheck source=bin/utils
@@ -105,7 +104,7 @@ source "$BIN_DIR/warnings"
105
104
# to `/app`.
106
105
# Symlinks are required, since Python is not a portable installation.
107
106
# More on this topic later.
108
- mkdir -p " BUILD_DIR/ .heroku"
107
+ mkdir -p /app/ .heroku
109
108
110
109
# This buildpack programatically generates (or simply copies) a number of files for
111
110
# buildpack machinery: an export script, and a number of `.profile.d` scripts. This
@@ -123,19 +122,19 @@ export BUILD_DIR CACHE_DIR BIN_DIR PROFILE_PATH EXPORT_PATH
123
122
# Notes on each variable included.
124
123
125
124
# PATH is relatively obvious, we need to be able to execute 'python'.
126
- export PATH=" $BUILD_DIR / .heroku/python/bin:$BUILD_DIR / .heroku/vendor/bin:$PATH "
125
+ export PATH=/app/ .heroku/python/bin:/app/ .heroku/vendor/bin:$PATH
127
126
# Tell Python to not buffer it's stdin/stdout.
128
127
export PYTHONUNBUFFERED=1
129
128
# Set the locale to a well-known and expected standard.
130
129
export LANG=en_US.UTF-8
131
130
# `~/.heroku/vendor` is an place where the buildpack may stick pre-build binaries for known
132
131
# C dependencies (e.g. libmemcached on cedar-14). This section configures Python (GCC, more specifically)
133
132
# and pip to automatically include these paths when building binaries.
134
- export C_INCLUDE_PATH=" $BUILD_DIR / .heroku/vendor/include:$BUILD_DIR / .heroku/python/include:$C_INCLUDE_PATH "
135
- export CPLUS_INCLUDE_PATH=" $BUILD_DIR / .heroku/vendor/include:$BUILD_DIR / .heroku/python/include:$CPLUS_INCLUDE_PATH "
136
- export LIBRARY_PATH=" $BUILD_DIR / .heroku/vendor/lib:$BUILD_DIR / .heroku/python/lib:$LIBRARY_PATH "
137
- export LD_LIBRARY_PATH=" $BUILD_DIR / .heroku/vendor/lib:$BUILD_DIR / .heroku/python/lib:$LD_LIBRARY_PATH "
138
- export PKG_CONFIG_PATH=" $BUILD_DIR / .heroku/vendor/lib/pkg-config:$BUILD_DIR / .heroku/python/lib/pkg-config:$PKG_CONFIG_PATH "
133
+ export C_INCLUDE_PATH=/app/ .heroku/vendor/include:/app/ .heroku/python/include:$C_INCLUDE_PATH
134
+ export CPLUS_INCLUDE_PATH=/app/ .heroku/vendor/include:/app/ .heroku/python/include:$CPLUS_INCLUDE_PATH
135
+ export LIBRARY_PATH=/app/ .heroku/vendor/lib:/app/ .heroku/python/lib:$LIBRARY_PATH
136
+ export LD_LIBRARY_PATH=/app/ .heroku/vendor/lib:/app/ .heroku/python/lib:$LD_LIBRARY_PATH
137
+ export PKG_CONFIG_PATH=/app/ .heroku/vendor/lib/pkg-config:/app/ .heroku/python/lib/pkg-config:$PKG_CONFIG_PATH
139
138
140
139
# The Application Code
141
140
# --------------------
212
211
# Create the directory for .profile.d, if it doesn't exist.
213
212
mkdir -p " $( dirname " $PROFILE_PATH " ) "
214
213
# Create the directory for editable source code installation, if it doesn't exist.
215
- mkdir -p " $BUILD_DIR / .heroku/src"
214
+ mkdir -p /app/ .heroku/src
216
215
217
216
# On Heroku CI, builds happen in `/app`. Otherwise, on the Heroku platform,
218
217
# they occur in a temp directory. Beacuse Python is not portable, we must create
219
218
# symlinks to emulate that we are operating in `/app` during the build process.
220
219
# This is (hopefully obviously) because apps end up running from `/app` in production.
221
- if [[ " $BUILD_DIR " != ' /app' ]]; then
220
+ if [[ $BUILD_DIR != ' /app' ]]; then
222
221
# python expects to reside in /app, so set up symlinks
223
222
# we will not remove these later so subsequent buildpacks can still invoke it
224
- mkdir -p /app/.heroku
225
223
ln -nsf " $BUILD_DIR /.heroku/python" /app/.heroku/python
226
224
ln -nsf " $BUILD_DIR /.heroku/vendor" /app/.heroku/vendor
227
225
# Note: .heroku/src is copied in later.
@@ -312,7 +310,8 @@ mtime "nltk.download.time" "${start}"
312
310
# and copying it into the proper place (the logical place to do this was early, but it must be done here).
313
311
# In CI, $BUILD_DIR is /app.
314
312
if [[ ! " $BUILD_DIR " == " /app" ]]; then
315
- ln -nsf " $BUILD_DIR /.heroku/src" /app/.heroku/src
313
+ rm -fr " $BUILD_DIR /.heroku/src"
314
+ deep-cp /app/.heroku/src " $BUILD_DIR /.heroku/src"
316
315
fi
317
316
318
317
@@ -344,12 +343,13 @@ set_default_env PYTHONHASHSEED random
344
343
# Tell Python to look for Python modules in the /app dir. Don't change this.
345
344
set_default_env PYTHONPATH " \$ HOME"
346
345
347
- # Python expects to be in "$BUILD_DIR," if at runtime, it is not, set
346
+ # Python expects to be in /app, if at runtime, it is not, set
348
347
# up symlinks… this can occur when the subdir buildpack is used.
349
348
cat << EOT >> "$PROFILE_PATH "
350
- if [[ \$ HOME != "$BUILD_DIR " ]]; then
351
- ln -nsf "\$ HOME/.heroku/python" "$BUILD_DIR /.heroku/python"
352
- ln -nsf "\$ HOME/.heroku/vendor" "$BUILD_DIR /.heroku/vendor"
349
+ if [[ \$ HOME != "/app" ]]; then
350
+ mkdir -p /app/.heroku
351
+ ln -nsf "\$ HOME/.heroku/python" /app/.heroku/python
352
+ ln -nsf "\$ HOME/.heroku/vendor" /app/.heroku/vendor
353
353
fi
354
354
EOT
355
355
0 commit comments