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 | |
|---|---|---|---|
| a3ed9c7155 | |||
| 8db1f07fba | |||
| 17081d0328 | |||
| 9a6fa0478a | |||
| 573ded6d41 |
@@ -21,12 +21,12 @@ Deploying a Python application couldn't be easier:
|
|||||||
$ git push heroku master
|
$ git push heroku master
|
||||||
...
|
...
|
||||||
-----> Python app detected
|
-----> Python app detected
|
||||||
-----> Installing python-2.7.12
|
-----> Installing python-2.7.13
|
||||||
$ pip install -r requirements.txt
|
$ pip install -r requirements.txt
|
||||||
Collecting requests (from -r requirements.txt (line 1))
|
Collecting requests (from -r requirements.txt (line 1))
|
||||||
Downloading requests-2.10.0-py2.py3-none-any.whl (501kB)
|
Downloading requests-2.12.4-py2.py3-none-any.whl (576KB)
|
||||||
Installing collected packages: requests
|
Installing collected packages: requests
|
||||||
Successfully installed requests-2.10.0
|
Successfully installed requests-2.12.4
|
||||||
|
|
||||||
-----> Discovering process types
|
-----> Discovering process types
|
||||||
Procfile declares types -> (none)
|
Procfile declares types -> (none)
|
||||||
@@ -44,11 +44,11 @@ Specify a Python Runtime
|
|||||||
Specific versions of the Python runtime can be specified with a `runtime.txt` file:
|
Specific versions of the Python runtime can be specified with a `runtime.txt` file:
|
||||||
|
|
||||||
$ cat runtime.txt
|
$ cat runtime.txt
|
||||||
python-3.5.2
|
python-3.6.0
|
||||||
|
|
||||||
Runtime options include:
|
Runtime options include:
|
||||||
|
|
||||||
- `python-2.7.12`
|
- `python-2.7.13`
|
||||||
- `python-3.5.2`
|
- `python-3.6.0`
|
||||||
- `pypy-5.3.1` (unsupported, experimental)
|
- `pypy-5.6.0` (unsupported, experimental)
|
||||||
- `pypy3-2.4.0` (unsupported, experimental)
|
- `pypy3-5.5.0` (unsupported, experimental)
|
||||||
|
|||||||
+5
-8
@@ -160,9 +160,9 @@ mkdir -p /app/.heroku/src
|
|||||||
if [[ $BUILD_DIR != '/app' ]]; then
|
if [[ $BUILD_DIR != '/app' ]]; then
|
||||||
# python expects to reside in /app, so set up symlinks
|
# python expects to reside in /app, so set up symlinks
|
||||||
# we will not remove these later so subsequent buildpacks can still invoke it
|
# we will not remove these later so subsequent buildpacks can still invoke it
|
||||||
ln -s $BUILD_DIR/.heroku/python /app/.heroku/python
|
ln -nsf $BUILD_DIR/.heroku/python /app/.heroku/python
|
||||||
ln -s $BUILD_DIR/.heroku/vendor /app/.heroku/vendor
|
ln -nsf $BUILD_DIR/.heroku/vendor /app/.heroku/vendor
|
||||||
ln -s $BUILD_DIR/.heroku/venv /app/.heroku/venv
|
ln -nsf $BUILD_DIR/.heroku/venv /app/.heroku/venv
|
||||||
# Note: .heroku/src is copied in later.
|
# Note: .heroku/src is copied in later.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -218,17 +218,14 @@ bpwatch start post_compile
|
|||||||
source $BIN_DIR/steps/hooks/post_compile
|
source $BIN_DIR/steps/hooks/post_compile
|
||||||
bpwatch stop post_compile
|
bpwatch stop post_compile
|
||||||
|
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
# rewrite build dir in egg links to /app so things are found at runtime
|
# rewrite build dir in egg links to /app so things are found at runtime
|
||||||
find .heroku/python/lib/python*/site-packages/ -name "*.egg-link" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#$(pwd)/#/app/#" &> /dev/null
|
find .heroku/python/lib/python*/site-packages/ -name "*.pth" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#$(pwd)#/app#" &> /dev/null
|
||||||
find .heroku/python/lib/python*/site-packages/ -name "*.pth" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#$(pwd)/#/app/#" &> /dev/null
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
# Support for PyPy
|
# Support for PyPy
|
||||||
find .heroku/python/lib-python/*/site-packages/ -name "*.egg-link" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#$(pwd)/#/app/#" &> /dev/null
|
find .heroku/python/lib-python/*/site-packages/ -name "*.pth" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#$(pwd)#/app#" &> /dev/null
|
||||||
find .heroku/python/lib-python/*/site-packages/ -name "*.pth" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#$(pwd)/#/app/#" &> /dev/null
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Store new artifacts in cache.
|
# Store new artifacts in cache.
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
puts-cmd "pip install -r requirements.txt"
|
puts-cmd "pip install -r requirements.txt"
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
# rewrite any existing egg links to point to the build dir so pip does not fail with a mismatch error
|
# delete any existing egg links, to uninstall exisisting installations.
|
||||||
find .heroku/python/lib/python*/site-packages/ -name "*.egg-link" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#/app/#$(pwd)/#" &> /dev/null
|
find .heroku/python/lib/python*/site-packages/ -name "*.egg-link" -delete 2> /dev/null
|
||||||
find .heroku/python/lib/python*/site-packages/ -name "*.pth" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#/app/#/$(pwd)/#" &> /dev/null
|
find .heroku/python/lib/python*/site-packages/ -name "*.pth" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#/app/#/$(pwd)/#" &> /dev/null
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
# Support for PyPy
|
# Support for the above, for PyPy.
|
||||||
find .heroku/python/lib-python/*/site-packages/ -name "*.egg-link" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#/app/#$(pwd)/#" &> /dev/null
|
find .heroku/python/lib-python/*/site-packages/ -name "*.egg-link" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#/app/#$(pwd)/#" &> /dev/null
|
||||||
find .heroku/python/lib-python/*/site-packages/ -name "*.pth" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#/app/#/$(pwd)/#" &> /dev/null
|
find .heroku/python/lib-python/*/site-packages/ -name "*.pth" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#/app/#/$(pwd)/#" &> /dev/null
|
||||||
set -e
|
set -e
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ indent() {
|
|||||||
|
|
||||||
# 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 '/No files were found to uninstall/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Buildpack Indented line.
|
# Buildpack Indented line.
|
||||||
|
|||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build Path: /app/.heroku/python/
|
||||||
|
# Build Deps: libraries/sqlite
|
||||||
|
|
||||||
|
OUT_PREFIX=$1
|
||||||
|
|
||||||
|
echo "Building Python..."
|
||||||
|
SOURCE_TARBALL='https://python.org/ftp/python/3.6.0/Python-3.6.0.tgz'
|
||||||
|
curl -L $SOURCE_TARBALL | tar xz
|
||||||
|
mv Python-3.6.0 src
|
||||||
|
cd src
|
||||||
|
|
||||||
|
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||||
|
|
||||||
Reference in New Issue
Block a user