mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 63cea99415 | |||
| 5ecd27e3b8 | |||
| 206a2dbc04 | |||
| 2a083791b6 | |||
| d5b2b0b464 | |||
| 2eab1ad845 | |||
| 2b16420d41 | |||
| 9fa0889499 | |||
| 99b17fabeb | |||
| 933d3014d7 | |||
| 018e0f31de | |||
| cf1647e937 | |||
| b9f154bf38 | |||
| 4cc18ce0af | |||
| f5ea1c24a3 | |||
| 952b0bb735 | |||
| 8b7edad8a2 | |||
| 02787ac910 | |||
| bcc3ba09ca | |||
| 31e65dc58b |
@@ -45,10 +45,10 @@ Specify a Runtime
|
|||||||
You can also provide arbitrary releases Python with a `runtime.txt` file.
|
You can also provide arbitrary releases Python with a `runtime.txt` file.
|
||||||
|
|
||||||
$ cat runtime.txt
|
$ cat runtime.txt
|
||||||
python-3.3.0
|
python-3.3.2
|
||||||
|
|
||||||
Runtime options include:
|
Runtime options include:
|
||||||
|
|
||||||
- python-2.7.4
|
- python-2.7.4
|
||||||
- python-3.3.1
|
- python-3.3.2
|
||||||
- pypy-1.9 (experimental)
|
- pypy-1.9 (experimental)
|
||||||
|
|||||||
+14
-10
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
#
|
#
|
||||||
# $ bin/compile <build-dir> <cache-dir>
|
# $ bin/compile <build-dir> <cache-dir> <env-path>
|
||||||
|
|
||||||
|
|
||||||
# Fail fast and fail hard.
|
# Fail fast and fail hard.
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
@@ -16,6 +15,8 @@ BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
|
|||||||
ROOT_DIR=$(dirname $BIN_DIR)
|
ROOT_DIR=$(dirname $BIN_DIR)
|
||||||
BUILD_DIR=$1
|
BUILD_DIR=$1
|
||||||
CACHE_DIR=$2
|
CACHE_DIR=$2
|
||||||
|
ENV_FILE=$3
|
||||||
|
|
||||||
|
|
||||||
CACHED_DIRS=".heroku"
|
CACHED_DIRS=".heroku"
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ DISTRIBUTE_VERSION="0.6.36"
|
|||||||
export PATH=$PATH:$ROOT_DIR/vendor/bpwatch
|
export PATH=$PATH:$ROOT_DIR/vendor/bpwatch
|
||||||
LOGPLEX_KEY="t.b396af7f-ad75-4643-8b9e-ebb288acc624"
|
LOGPLEX_KEY="t.b396af7f-ad75-4643-8b9e-ebb288acc624"
|
||||||
export BPWATCH_STORE_PATH=$CACHE_DIR/bpwatch.json
|
export BPWATCH_STORE_PATH=$CACHE_DIR/bpwatch.json
|
||||||
BUILDPACK_VERSION=v24
|
BUILDPACK_VERSION=v28
|
||||||
|
|
||||||
# Support Anvil Build_IDs
|
# Support Anvil Build_IDs
|
||||||
[ ! "$REQUEST_ID" ] && REQUEST_ID=$SLUG_ID
|
[ ! "$REQUEST_ID" ] && REQUEST_ID=$SLUG_ID
|
||||||
@@ -79,11 +80,14 @@ ORIG_BUILD_DIR=$BUILD_DIR
|
|||||||
BUILD_DIR=$APP_DIR
|
BUILD_DIR=$APP_DIR
|
||||||
|
|
||||||
# Prepend proper path buildpack use.
|
# Prepend proper path buildpack use.
|
||||||
export PATH=$BUILD_DIR/.heroku/python/bin:$PATH
|
export PATH=$BUILD_DIR/.heroku/python/bin:$BUILD_DIR/.heroku/vendor/bin:$PATH
|
||||||
export PYTHONUNBUFFERED=1
|
export PYTHONUNBUFFERED=1
|
||||||
export LANG=en_US.UTF-8
|
export LANG=en_US.UTF-8
|
||||||
export LIBRARY_PATH=/app/.heroku/vendor/lib
|
export C_INCLUDE_PATH=/app/.heroku/vendor/include:$BUILD_DIR/.heroku/vendor/include
|
||||||
export LD_LIBRARY_PATH=/app/.heroku/vendor/lib
|
export CPLUS_INCLUDE_PATH=/app/.heroku/vendor/include:$BUILD_DIR/.heroku/vendor/include
|
||||||
|
export LIBRARY_PATH=/app/.heroku/vendor/lib:$BUILD_DIR/.heroku/vendor/lib
|
||||||
|
export LD_LIBRARY_PATH=/app/.heroku/vendor/lib:$BUILD_DIR/.heroku/vendor/lib
|
||||||
|
export PKG_CONFIG_PATH=/app/.heroku/vendor/lib/pkg-config:$BUILD_DIR/.heroku/vendor/lib/pkg-config
|
||||||
|
|
||||||
# Switch to the repo's context.
|
# Switch to the repo's context.
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
@@ -201,7 +205,7 @@ bpwatch stop pylibmc_install
|
|||||||
# Install Mercurial if it appears to be required.
|
# Install Mercurial if it appears to be required.
|
||||||
if (grep -Fiq "hg+" requirements.txt) then
|
if (grep -Fiq "hg+" requirements.txt) then
|
||||||
bpwatch start mercurial_install
|
bpwatch start mercurial_install
|
||||||
/app/.heroku/python/bin/pip install --use-mirrors mercurial | cleanup | indent
|
/app/.heroku/python/bin/pip install mercurial | cleanup | indent
|
||||||
bpwatch stop mercurial_install
|
bpwatch stop mercurial_install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -212,14 +216,14 @@ puts-step "Installing dependencies using Pip ($PIP_VERSION)"
|
|||||||
[ ! "$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 --use-mirrors -r requirements.txt --exists-action=w --src=./.heroku/src | cleanup | indent
|
/app/.heroku/python/bin/pip install -r requirements.txt --exists-action=w --src=./.heroku/src | cleanup | indent
|
||||||
|
|
||||||
[ ! "$FRESH_PYTHON" ] && bpwatch stop pip_install
|
[ ! "$FRESH_PYTHON" ] && bpwatch stop pip_install
|
||||||
[ "$FRESH_PYTHON" ] && bpwatch stop pip_install_first
|
[ "$FRESH_PYTHON" ] && bpwatch stop pip_install_first
|
||||||
|
|
||||||
# Django collectstatic support.
|
# Django collectstatic support.
|
||||||
bpwatch start collectstatic
|
bpwatch start collectstatic
|
||||||
source $BIN_DIR/steps/collectstatic
|
sub-env $BIN_DIR/steps/collectstatic
|
||||||
bpwatch stop collectstatic
|
bpwatch stop collectstatic
|
||||||
|
|
||||||
# ### Finalize
|
# ### Finalize
|
||||||
@@ -258,6 +262,6 @@ bpwatch start anvil_appdir_commit
|
|||||||
if [ "$SLUG_ID" ]; then
|
if [ "$SLUG_ID" ]; then
|
||||||
deep-mv $TMP_APP_DIR $APP_DIR
|
deep-mv $TMP_APP_DIR $APP_DIR
|
||||||
fi
|
fi
|
||||||
bpwatch stop anvil_appdir_commit
|
|
||||||
|
|
||||||
|
bpwatch stop anvil_appdir_commit
|
||||||
bpwatch stop compile
|
bpwatch stop compile
|
||||||
|
|||||||
+1
-1
@@ -18,6 +18,6 @@ if [[ $MANAGE_FILE ]]; then
|
|||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
heroku-postgresql:dev
|
heroku-postgresql:hobby-dev
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
+1
-1
@@ -3,5 +3,5 @@
|
|||||||
if [ -f bin/post_compile ]; then
|
if [ -f bin/post_compile ]; then
|
||||||
echo "-----> Running post-compile hook"
|
echo "-----> Running post-compile hook"
|
||||||
chmod +x bin/post_compile
|
chmod +x bin/post_compile
|
||||||
bin/post_compile
|
sub-env bin/post_compile
|
||||||
fi
|
fi
|
||||||
Regular → Executable
+1
-1
@@ -3,5 +3,5 @@
|
|||||||
if [ -f bin/pre_compile ]; then
|
if [ -f bin/pre_compile ]; then
|
||||||
echo "-----> Running pre-compile hook"
|
echo "-----> Running pre-compile hook"
|
||||||
chmod +x bin/pre_compile
|
chmod +x bin/pre_compile
|
||||||
bin/pre_compile
|
sub-env bin/pre_compile
|
||||||
fi
|
fi
|
||||||
@@ -59,4 +59,6 @@ function deep-rm (){
|
|||||||
find -H $1 -maxdepth 1 -name '.*' -a \( -type d -o -type f -o -type l \) -exec rm -fr '{}' \;
|
find -H $1 -maxdepth 1 -name '.*' -a \( -type d -o -type f -o -type l \) -exec rm -fr '{}' \;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sub-env (){
|
||||||
|
(export $(egrep -v '^(GIT_DIR|PYTHONHOME|PYTHONPATH|LD_LIBRARY_PATH|LIBRARY_PATH|PATH)' $ENV_FILE); $1)
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+3
-3
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/local/bin/python
|
#!/usr/bin/env python2
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
DEFUALT_PATH = '{}.zip'.format(os.path.abspath(__file__))
|
DEFAULT_PATH = '{0}.zip'.format(os.path.abspath(__file__))
|
||||||
BPWATCH_DISTRO_PATH = os.environ.get('BPWATCH_DISTRO_PATH', DEFUALT_PATH)
|
BPWATCH_DISTRO_PATH = os.environ.get('BPWATCH_DISTRO_PATH', DEFAULT_PATH)
|
||||||
|
|
||||||
sys.path.insert(0, BPWATCH_DISTRO_PATH)
|
sys.path.insert(0, BPWATCH_DISTRO_PATH)
|
||||||
|
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
Reference in New Issue
Block a user