Compare commits

...

21 Commits

Author SHA1 Message Date
Kenneth Reitz 566f7f4555 new buildpack env standard 2014-01-21 17:47:05 -05:00
Kenneth Reitz 4ff62b2b41 sticky python versions bugfix 2014-01-17 17:06:54 -08:00
Kenneth Reitz d47970fd81 sticky runtimes 2014-01-17 16:47:55 -08:00
Kenneth Reitz 69bdca063f fix sub-env for when env file is not present 2013-12-20 17:15:24 -05:00
Kenneth Reitz 63cea99415 chmod +x 2013-12-20 16:48:34 -05:00
Kenneth Reitz 5ecd27e3b8 chmod +x 2013-12-13 16:03:39 -08:00
Kenneth Reitz 206a2dbc04 third argument support for envs in compile 2013-12-13 15:48:39 -08:00
kennethreitz 2a083791b6 Merge pull request #113 from zyegfryed/patch-3
Fixed Python runtime according to the official Heroku doc
2013-11-14 19:59:56 -08:00
kennethreitz d5b2b0b464 Merge pull request #114 from catsby/update_default_postgresql
Update Heroku Postgresql default add-on to hobby-dev
2013-11-14 19:59:40 -08:00
Clint Shryock 2eab1ad845 Update Heroku Postgresql default add-on to hobby-dev 2013-11-12 14:10:52 -06:00
Sébastien Fievet 2b16420d41 Fixed Python runtime according to the official Heroku doc
See https://devcenter.heroku.com/articles/python-runtimes#supported-runtimes
2013-11-04 09:24:36 +01:00
kennethreitz 9fa0889499 Update bpwatch 2013-10-17 15:43:51 -04:00
kennethreitz 99b17fabeb Merge pull request #105 from bacongobbler/patch-1
update shebang to use python2 for bpwatch
2013-10-17 11:37:00 -07:00
kennethreitz 933d3014d7 Merge pull request #103 from grosskur/library-path-fix
Make vendored libraries available at compile time (fixes #57)
2013-10-17 11:36:34 -07:00
Kenneth Reitz 018e0f31de Merge remote-tracking branch 'origin/master' 2013-09-01 06:27:46 +05:30
Kenneth Reitz cf1647e937 no --use-mirrors 2013-09-01 06:27:18 +05:30
Matthew Fisher b9f154bf38 update shebang to use python2 for bpwatch 2013-08-27 16:49:55 -07:00
Kenneth Reitz 4cc18ce0af Merge pull request #104 from zyegfryed/patch-1
Typo
2013-08-27 09:12:23 -07:00
Sébastien Fievet f5ea1c24a3 Typo 2013-08-25 18:41:46 +02:00
Kenneth Reitz 952b0bb735 v28 2013-08-14 22:02:11 -04:00
Alan Grosskurth bcc3ba09ca Make vendored libraries available at compile time (fixes #57)
When building, BUILD_DIR is set to a temporary directory. Vendored
libraries (e.g., pylibmc) are downloaded and unpacked in
$BUILD_DIR/.heroku/vendor/lib, but this is not currently in
LIBRARY_PATH or LD_LIBRARY_PATH.

Fix this by doing the following:

* Add $BUILD_DIR/.heroku/vendor/lib to LIBRARY_PATH/LD_LIBRARY_PATH

* Add $BUILD_DIR/.heroku/vendor/include to
  C_INCLUDE_PATH/CPLUS_INCLUDE_PATH

* Add $BUILD_DIR/.heroku/vendor/bin to PATH, so vendored commands can
  be used at compile time (e.g., curl-config)

* Add $BUILD_DIR/.heroku/vendor/lib/pkg-config to PKG_CONFIG_PATH, so
  vendored packages can be found with pkg-config
2013-08-14 16:59:31 -07:00
8 changed files with 47 additions and 21 deletions
+2 -2
View File
@@ -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)
+20 -12
View File
@@ -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_DIR=$3
CACHED_DIRS=".heroku" CACHED_DIRS=".heroku"
@@ -24,8 +25,7 @@ VIRTUALENV_LOC=".heroku/venv"
LEGACY_TRIGGER="lib/python2.7" LEGACY_TRIGGER="lib/python2.7"
PROFILE_PATH="$BUILD_DIR/.profile.d/python.sh" PROFILE_PATH="$BUILD_DIR/.profile.d/python.sh"
# Python version. This will be used in the future to specify custom Pythons. DEFAULT_PYTHON_VERSION="python-2.7.6"
DEFAULT_PYTHON_VERSION="python-2.7.4"
PYTHON_EXE="/app/.heroku/python/bin/python" PYTHON_EXE="/app/.heroku/python/bin/python"
PIP_VERSION="1.3.1" PIP_VERSION="1.3.1"
DISTRIBUTE_VERSION="0.6.36" DISTRIBUTE_VERSION="0.6.36"
@@ -34,7 +34,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=v25 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 +79,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
@@ -99,6 +102,11 @@ if [ ! -f requirements.txt ]; then
echo "-e ." > requirements.txt echo "-e ." > requirements.txt
fi fi
# Sticky runtimes.
if [ -f $CACHE_DIR/.heroku/python-version ]; then
DEFAULT_PYTHON_VERSION=$(cat $CACHE_DIR/.heroku/python-version)
fi
# If no runtime given, assume default version. # If no runtime given, assume default version.
if [ ! -f runtime.txt ]; then if [ ! -f runtime.txt ]; then
puts-step "No runtime.txt provided; assuming $DEFAULT_PYTHON_VERSION." puts-step "No runtime.txt provided; assuming $DEFAULT_PYTHON_VERSION."
@@ -201,7 +209,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 +220,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 +266,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
View File
@@ -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
View File
Regular → Executable
+1 -1
View File
@@ -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
View File
@@ -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
+18
View File
@@ -60,3 +60,21 @@ function deep-rm (){
} }
sub-env() {
WHITELIST=${2:-''}
BLACKLIST=${3:-'^(GIT_DIR|PYTHONHOME|PYTHONPATH|LD_LIBRARY_PATH|LIBRARY_PATH|PATH)$'}
(
if [ -d "$ENV_DIR" ]; then
for e in $(ls $ENV_DIR); do
echo "$e" | grep -E "$WHITELIST" | grep -qvE "$BLACKLIST" &&
export "$e=$(cat $ENV_DIR/$e)"
:
done
fi
$1
)
}
+4 -4
View File
@@ -1,14 +1,14 @@
#!/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)
import bp_cli import bp_cli
bp_cli.main() bp_cli.main()