mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ddde30a12e | |||
| 2db5578998 | |||
| 290250836f | |||
| 0ff4df4dc3 | |||
| 9177aa2c08 |
+6
-31
@@ -1,34 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# This script serves as the
|
# Usage:
|
||||||
# [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python)
|
|
||||||
# compiler.
|
|
||||||
#
|
|
||||||
# A [buildpack](http://devcenter.heroku.com/articles/buildpacks) is an
|
|
||||||
# adapter between a Python application and Heroku's runtime.
|
|
||||||
#
|
|
||||||
# You can intreract with the Heroku API directly with [heroku.py](https://github.com/heroku/heroku.py/).
|
|
||||||
#
|
|
||||||
# See also: [Release history](/changelog.html), [Detection](/detect.html).
|
|
||||||
#
|
|
||||||
# ## Usage
|
|
||||||
# Compiling an app into a slug is simple:
|
|
||||||
#
|
#
|
||||||
# $ bin/compile <build-dir> <cache-dir>
|
# $ bin/compile <build-dir> <cache-dir>
|
||||||
|
|
||||||
|
|
||||||
# ## Assumptions
|
|
||||||
#
|
|
||||||
# This buildpack makes the following assumptions:
|
|
||||||
#
|
|
||||||
# - The desired Python VM is available on the base system.
|
|
||||||
# - Library dependencies are available on the base system.
|
|
||||||
# - Django applications should not require any platform-specific configuration.
|
|
||||||
|
|
||||||
# <hr />
|
|
||||||
|
|
||||||
# ## Context
|
|
||||||
|
|
||||||
# Fail fast and fail hard.
|
# Fail fast and fail hard.
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
@@ -79,9 +55,9 @@ 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:$PATH
|
||||||
export PYTHONUNBUFFERED=1
|
export PYTHONUNBUFFERED=1
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
# ## Build Time
|
export LIBRARY_PATH=/app/.heroku/vendor/lib
|
||||||
#
|
export LD_LIBRARY_PATH=/app/.heroku/vendor/lib
|
||||||
|
|
||||||
# Switch to the repo's context.
|
# Switch to the repo's context.
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
@@ -171,7 +147,7 @@ set -e
|
|||||||
source $BIN_DIR/steps/pylibmc
|
source $BIN_DIR/steps/pylibmc
|
||||||
|
|
||||||
# Install Mercurial if it appears to be required.
|
# Install Mercurial if it appears to be required.
|
||||||
if (in-req "hg+" requirements.txt) then
|
if (grep -Fiq "hg+" requirements.txt) then
|
||||||
pip install --use-mirrors mercurial | cleanup | indent
|
pip install --use-mirrors mercurial | cleanup | indent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -193,14 +169,13 @@ done
|
|||||||
|
|
||||||
# Set context environment variables.
|
# Set context environment variables.
|
||||||
set-env PATH '$HOME/.heroku/python/bin:$PATH'
|
set-env PATH '$HOME/.heroku/python/bin:$PATH'
|
||||||
# set-env PYTHONHOME /app/.heroku/python/
|
|
||||||
set-env PYTHONUNBUFFERED true
|
set-env PYTHONUNBUFFERED true
|
||||||
|
set-env PYTHONHOME /app/.heroku/python
|
||||||
set-default-env LIBRARY_PATH /app/.heroku/vendor/lib
|
set-default-env LIBRARY_PATH /app/.heroku/vendor/lib
|
||||||
set-default-env LD_LIBRARY_PATH /app/.heroku/vendor/lib
|
set-default-env LD_LIBRARY_PATH /app/.heroku/vendor/lib
|
||||||
set-default-env LANG en_US.UTF-8
|
set-default-env LANG en_US.UTF-8
|
||||||
set-default-env PYTHONHASHSEED random
|
set-default-env PYTHONHASHSEED random
|
||||||
set-default-env PYTHONPATH /app/
|
set-default-env PYTHONPATH /app/
|
||||||
un-set-env PYTHONHOME
|
|
||||||
|
|
||||||
|
|
||||||
# Experimental post_compile hook.
|
# Experimental post_compile hook.
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ VENDORED_MEMCACHED="http://cl.ly/0a191R3K160t1w1P0N25/vendor-libmemcached.tar.gz
|
|||||||
source $BIN_DIR/utils
|
source $BIN_DIR/utils
|
||||||
|
|
||||||
# If pylibmc exists within requirements, use vendored libmemcached.
|
# If pylibmc exists within requirements, use vendored libmemcached.
|
||||||
if (in-req "pylibmc" requirements.txt) then
|
if (grep -Fiq "pylibmc" requirements.txt) then
|
||||||
echo "-----> Noticed pylibmc. Bootstrapping libmemcached."
|
echo "-----> Noticed pylibmc. Bootstrapping libmemcached."
|
||||||
cd .heroku
|
cd .heroku
|
||||||
|
|
||||||
|
|||||||
@@ -52,25 +52,3 @@ function deep-mv (){
|
|||||||
rm -fr $1/!(tmp)
|
rm -fr $1/!(tmp)
|
||||||
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 '{}' \;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Recursively finds requirements.txt files
|
|
||||||
function list-req (){
|
|
||||||
echo $@
|
|
||||||
for req in $(grep -Fie "-r " $@ | sed 's/-r //g')
|
|
||||||
do
|
|
||||||
path="$(dirname $@)/$req"
|
|
||||||
list-req $path
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Find pattern in requirements files recursively
|
|
||||||
# Usage: $ in-req pattern file
|
|
||||||
function in-req (){
|
|
||||||
for file in $(list-req $2)
|
|
||||||
do
|
|
||||||
if (grep -Fiqe "$1" "$file") then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
pylibmc
|
||||||
|
psycopg2
|
||||||
Reference in New Issue
Block a user