mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d93d283be2 | |||
| 42141c2bf9 | |||
| d82c898509 | |||
| 6545d71b46 | |||
| 93b707eae5 | |||
| 8d358218f8 | |||
| b84b168be8 | |||
| 35c810e46d | |||
| e1ea2f9354 | |||
| 7db6ea33ac | |||
| a53826a673 | |||
| b7ecb49a96 | |||
| 911140b3ac | |||
| f1c4efb464 | |||
| 5a979874ad | |||
| a32ca25520 | |||
| e304089c3e | |||
| 5d8932e5ee | |||
| 7770ab8ff2 | |||
| 277294817a | |||
| 25b17d51c3 | |||
| ac103519f8 | |||
| e8b8af045f | |||
| 0bb6d6e2bd | |||
| 0184dcac24 | |||
| 558e748e9e | |||
| dec86fbc2e | |||
| ddc310084b | |||
| bc754f402b | |||
| ea5bc23a76 | |||
| 46ecf15337 | |||
| d020d20bde | |||
| 01ff4269f2 | |||
| f507bb0c05 |
@@ -1,5 +1,10 @@
|
|||||||
# Python Buildpack Changelog
|
# Python Buildpack Changelog
|
||||||
|
|
||||||
|
|
||||||
|
## v72 (2015-12-03)
|
||||||
|
|
||||||
|
Added friendly warnings for common build failures.
|
||||||
|
|
||||||
## v70 (2015-10-29)
|
## v70 (2015-10-29)
|
||||||
|
|
||||||
Improved compatibility with multi and node.js buildpacks.
|
Improved compatibility with multi and node.js buildpacks.
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks) for Python apps, powered by [pip](http://www.pip-installer.org/).
|
This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks) for Python apps, powered by [pip](http://www.pip-installer.org/).
|
||||||
|
|
||||||
|
This buildpack supports running Django and Flask apps.
|
||||||
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|||||||
+7
-1
@@ -29,6 +29,9 @@ PYTHON_EXE="/app/.heroku/python/bin/python"
|
|||||||
PIP_VERSION="7.1.2"
|
PIP_VERSION="7.1.2"
|
||||||
SETUPTOOLS_VERSION="18.3.2"
|
SETUPTOOLS_VERSION="18.3.2"
|
||||||
|
|
||||||
|
# Common Problem Warnings
|
||||||
|
export WARNINGS_LOG=$(mktemp)
|
||||||
|
|
||||||
# Setup bpwatch
|
# Setup bpwatch
|
||||||
export PATH=$PATH:$ROOT_DIR/vendor/bpwatch
|
export PATH=$PATH:$ROOT_DIR/vendor/bpwatch
|
||||||
LOGPLEX_KEY="t.b90d9d29-5388-4908-9737-b4576af1d4ce"
|
LOGPLEX_KEY="t.b90d9d29-5388-4908-9737-b4576af1d4ce"
|
||||||
@@ -55,6 +58,9 @@ bpwatch start compile
|
|||||||
# Syntax sugar.
|
# Syntax sugar.
|
||||||
source $BIN_DIR/utils
|
source $BIN_DIR/utils
|
||||||
|
|
||||||
|
# Import collection of warnings.
|
||||||
|
source $BIN_DIR/warnings
|
||||||
|
|
||||||
# Directory Hacks for path consistiency.
|
# Directory Hacks for path consistiency.
|
||||||
APP_DIR='/app'
|
APP_DIR='/app'
|
||||||
TMP_APP_DIR=$CACHE_DIR/tmp_app_dir
|
TMP_APP_DIR=$CACHE_DIR/tmp_app_dir
|
||||||
@@ -221,7 +227,7 @@ bpwatch start dump_cache
|
|||||||
mkdir -p $CACHE_DIR/.heroku
|
mkdir -p $CACHE_DIR/.heroku
|
||||||
cp -R .heroku/python $CACHE_DIR/.heroku/
|
cp -R .heroku/python $CACHE_DIR/.heroku/
|
||||||
cp -R .heroku/python-version $CACHE_DIR/.heroku/
|
cp -R .heroku/python-version $CACHE_DIR/.heroku/
|
||||||
cp -R .heroku/python-stack $CACHE_DIR/.heroku/
|
cp -R .heroku/python-stack $CACHE_DIR/.heroku/ &> /dev/null || true
|
||||||
cp -R .heroku/vendor $CACHE_DIR/.heroku/ &> /dev/null || true
|
cp -R .heroku/vendor $CACHE_DIR/.heroku/ &> /dev/null || true
|
||||||
cp -R .heroku/venv $CACHE_DIR/.heroku/ &> /dev/null || true
|
cp -R .heroku/venv $CACHE_DIR/.heroku/ &> /dev/null || true
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,6 +18,6 @@ if [[ $MANAGE_FILE ]]; then
|
|||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
heroku-postgresql:hobby-dev
|
heroku-postgresql
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|||||||
+11
-1
@@ -4,7 +4,17 @@ puts-step "Installing dependencies with pip"
|
|||||||
[ ! "$FRESH_PYTHON" ] && bpwatch start pip_install
|
[ ! "$FRESH_PYTHON" ] && bpwatch start pip_install
|
||||||
[ "$FRESH_PYTHON" ] && bpwatch start pip_install_first
|
[ "$FRESH_PYTHON" ] && bpwatch start pip_install_first
|
||||||
|
|
||||||
/app/.heroku/python/bin/pip install -r requirements.txt --exists-action=w --src=./.heroku/src --allow-all-external --disable-pip-version-check --no-cache-dir | cleanup | indent
|
set +e
|
||||||
|
/app/.heroku/python/bin/pip install -r requirements.txt --exists-action=w --src=./.heroku/src --allow-all-external --disable-pip-version-check --no-cache-dir | cleanup | log-output | indent
|
||||||
|
PIP_STATUS="${PIPESTATUS[0]}"
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ ! $PIP_STATUS -eq 0 ]]; then
|
||||||
|
echo
|
||||||
|
show-warnings
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Smart Requirements handling
|
# Smart Requirements handling
|
||||||
cp requirements.txt .heroku/python/requirements-declared.txt
|
cp requirements.txt .heroku/python/requirements-declared.txt
|
||||||
|
|||||||
@@ -11,6 +11,16 @@ indent() {
|
|||||||
sed "s/^/ /"
|
sed "s/^/ /"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Log output for warning detection
|
||||||
|
log-output() (
|
||||||
|
while read LINE;
|
||||||
|
do
|
||||||
|
echo "$LINE"
|
||||||
|
echo "$LINE" >> "$WARNINGS_LOG"
|
||||||
|
done
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
# Clean up pip output
|
# Clean up pip output
|
||||||
cleanup() {
|
cleanup() {
|
||||||
sed -e 's/\.\.\.\+/.../g' | sed -e '/already satisfied/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id'
|
sed -e 's/\.\.\.\+/.../g' | sed -e '/already satisfied/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id'
|
||||||
@@ -91,3 +101,4 @@ sub-env() {
|
|||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
shopt -s extglob
|
||||||
|
|
||||||
|
pylibmc-missing() {
|
||||||
|
if grep -qi 'fatal error: libmemcached/memcached.h: No such file or directory' "$WARNINGS_LOG"; then
|
||||||
|
puts-warn "Hello! There was a problem with your build related to libmemcache."
|
||||||
|
puts-warn "The Python library 'pylibmc' must be explicitly specified in 'requirements.txt' in order to build correctly."
|
||||||
|
puts-warn "Once you do that, everything should work as expected. -- Much Love, Heroku."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
scipy-included() {
|
||||||
|
if grep -qi 'running setup.py install for scipy' "$WARNINGS_LOG"; then
|
||||||
|
puts-warn "Hello! It looks like you're trying to use scipy on Heroku."
|
||||||
|
puts-warn "Unfortunately, at this time, we do not directly support this library."
|
||||||
|
puts-warn "There is, however, a buildpack available that makes it possible to use it on Heroku."
|
||||||
|
puts-warn "You can learn more here: https://devcenter.heroku.com/articles/python-c-deps"
|
||||||
|
puts-warn "Sorry for the inconvenience. -- Much Love, Heroku."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
distribute-included() {
|
||||||
|
if grep -qi 'Running setup.py install for distribute' "$WARNINGS_LOG"; then
|
||||||
|
puts-warn "Hello! Your requirements.txt file contains the distribute package."
|
||||||
|
puts-warn "This library is automatically installed by Heroku and shouldn't be in"
|
||||||
|
puts-warn "Your requirements.txt file. This can cause unexpected behavior."
|
||||||
|
puts-warn "-- Much Love, Heroku."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
show-warnings() {
|
||||||
|
pylibmc-missing
|
||||||
|
scipy-included
|
||||||
|
distribute-included
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user