mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Compare commits
119 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 14c7e26f7a | |||
| 58e664a9e3 | |||
| e965516197 | |||
| 8775cb821c | |||
| 9dcabe24a5 | |||
| 38f9a41a54 | |||
| 53e33bdf91 | |||
| 5337dd592b | |||
| de8ae808d9 | |||
| 2a7e85be85 | |||
| 7654d13f8b | |||
| 9d3639685a | |||
| 76bb572a4d | |||
| 8db4a79392 | |||
| 21430070ad | |||
| 20bbb3f54d | |||
| bebc0cf439 | |||
| c361c2ffc4 | |||
| 13d2a58add | |||
| 49e9147439 | |||
| 3c0146c0b9 | |||
| 53c7d61291 | |||
| 797652a75d | |||
| d7351513c7 | |||
| fe029af603 | |||
| dd8fe58de1 | |||
| a979d57a20 | |||
| 3cb8db7e2e | |||
| 16cce92342 | |||
| b85fe3614c | |||
| b024e644d1 | |||
| 41e0f64252 | |||
| 3a0d4c18bf | |||
| b3988a565a | |||
| 0437a6e84f | |||
| 88a5ba5d39 | |||
| 3434972e32 | |||
| 1dfef44085 | |||
| 2ffb10da34 | |||
| 23999846ad | |||
| 8d1ebf7288 | |||
| f2165aaac6 | |||
| 05492e132a | |||
| 62eaae35a4 | |||
| 2f32c5418d | |||
| 12e3a7f3e7 | |||
| e7da63f722 | |||
| a6452a1ce4 | |||
| 0b554f660f | |||
| 7b9e82175e | |||
| 73d37cbac6 | |||
| 9e1df4bbb5 | |||
| 0be9d48013 | |||
| 4750639a0d | |||
| 3de5b43447 | |||
| c3845fff9a | |||
| f3ef152624 | |||
| ef1f7f6924 | |||
| 25818765ee | |||
| 0a169e76a4 | |||
| 2f430abf07 | |||
| 07241cd751 | |||
| ae4713efd8 | |||
| 402cd8253e | |||
| aa593f127b | |||
| 67badb1829 | |||
| defa85c355 | |||
| ec364be161 | |||
| 7b4d6b5587 | |||
| e094c5469d | |||
| a7a5971372 | |||
| 45b78ab587 | |||
| 63e84aceb1 | |||
| eee8dd9a9e | |||
| 00e12b8ec2 | |||
| b56b063dd5 | |||
| d3180d3245 | |||
| 4778b1cb9d | |||
| 50a3d2d13e | |||
| 8c36a3a263 | |||
| 882f54128b | |||
| 576def4cde | |||
| 1be32ff09a | |||
| 9c2bbd109f | |||
| e5d9ed259b | |||
| 285ca2b73d | |||
| 5e4667686a | |||
| f9621add42 | |||
| 567cf2c388 | |||
| c61e61c153 | |||
| 3835aca004 | |||
| 3733383ad6 | |||
| b53d211d01 | |||
| e5830fd50d | |||
| 2efe514b14 | |||
| d442562352 | |||
| ce14e1edf8 | |||
| 39d2cd6de8 | |||
| e42b725211 | |||
| d9456b6d90 | |||
| 61591594a2 | |||
| 13bca29e13 | |||
| 95779d6711 | |||
| 166b8be2c5 | |||
| 583c1ab160 | |||
| c7f5532854 | |||
| 0fe4f91395 | |||
| 221722fb27 | |||
| e82f1e4d1e | |||
| f7e5930047 | |||
| f51dfb5eb4 | |||
| 06b7f97eff | |||
| 74873b5b71 | |||
| 731876d6e8 | |||
| a775b06d2f | |||
| 2d290e94e9 | |||
| 179e6287b1 | |||
| 18945ff1a9 | |||
| 2e630ab55c |
@@ -0,0 +1,8 @@
|
|||||||
|
<!-- Hi and welcome to the Heroku Python buildpack repository!
|
||||||
|
|
||||||
|
If you meant to open a PR against a fork instead of upstream, please adjust the base branch:
|
||||||
|
https://help.github.com/articles/changing-the-base-branch-of-a-pull-request/
|
||||||
|
|
||||||
|
Otherwise thank you in advance for your Pull Request - just remember to
|
||||||
|
include as much information as possible to help the reviewers :-)
|
||||||
|
-->
|
||||||
@@ -3,3 +3,7 @@ site
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
/.envrc
|
/.envrc
|
||||||
|
repos/*
|
||||||
|
|
||||||
|
#Venv
|
||||||
|
buildpack/*
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
repos:
|
||||||
|
- repo: git://github.com/detailyang/pre-commit-shell
|
||||||
|
rev: 1.0.4
|
||||||
|
hooks:
|
||||||
|
- id: shell-lint
|
||||||
+32
-17
@@ -1,20 +1,35 @@
|
|||||||
language: bash
|
language: ruby
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
sudo: required
|
||||||
|
rvm:
|
||||||
|
- 2.4.4
|
||||||
|
before_script:
|
||||||
|
- gem install bundler -v 1.16.2
|
||||||
|
- bundle exec hatchet ci:setup
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- stage: "Bash linting (shellcheck)"
|
- stage: Bash linting (shellcheck)
|
||||||
sudo: false
|
sudo: false
|
||||||
before_install:
|
script: make check
|
||||||
- wget -c https://goo.gl/ZzKHFv -O - | tar -xvJ -C /tmp/
|
- stage: Stack Unit Tests
|
||||||
- PATH="/tmp/shellcheck-latest:$PATH"
|
services: docker
|
||||||
script: make check
|
env: STACK=heroku-18
|
||||||
|
script: "./tests.sh"
|
||||||
- stage: "Stack Tests"
|
- stage: Stack Unit Tests
|
||||||
services: docker
|
services: docker
|
||||||
env: STACK=heroku-16
|
env: STACK=heroku-16
|
||||||
script: ./tests.sh
|
script: "./tests.sh"
|
||||||
|
- stage: Stack Unit Tests
|
||||||
- stage: "Stack Tests"
|
services: docker
|
||||||
services: docker
|
env: STACK=cedar-14
|
||||||
env: STACK=cedar-14
|
script: "./tests.sh"
|
||||||
script: ./tests.sh
|
- stage: Hatchet Integration
|
||||||
|
script: "bundle exec rspec"
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- HATCHET_RETRIES=3
|
||||||
|
- IS_RUNNING_ON_CI=true
|
||||||
|
- HATCHET_APP_LIMIT=5
|
||||||
|
- HATCHET_DEPLOY_STRATEGY=git
|
||||||
|
- secure: yjtlPE5FbVxTKnjUy/tZUBgSEf4qADD3QOxtgziuid73S0U/1IEXlMGFULsQzIjtlHKmHeywZqpVVEpthIH4RuT7uoX1Pb7SSM/g0T8fT3VoEFbFK1uYl0oZQbUS4Klxv9tPiumj8if3m6ULEGIz1X0wZcMOC0tMLwVCnwmap0E=
|
||||||
|
- secure: ZeFTHWwnpIKE9nAqs88ocmiQh7bKce84lilGm5J23nf3N6V4wNyLwqlkvsM008WGBCaOg9AUx7ZunasT0ANsR5gLP3eV2UUg7ILdRgV2Gy13eNRFheC4PHdN92RqQ3aKoqlIv2K999xlhVjod0NzhkQQXB6PddfQINbuU7ks6As=
|
||||||
|
|||||||
+69
-3
@@ -1,14 +1,80 @@
|
|||||||
# Python Buildpack Changelog
|
# Python Buildpack Changelog
|
||||||
|
|
||||||
# 136
|
# 154 (2019-07-17)
|
||||||
|
|
||||||
|
Fix python 3.5.7 formula actually building 3.7.2
|
||||||
|
|
||||||
|
# 153 (2019-06-21)
|
||||||
|
|
||||||
|
Hotfix for broken heroku-16 deploys
|
||||||
|
|
||||||
|
# 152 (2019-04-04)
|
||||||
|
|
||||||
|
Python 3.7.3 now available.
|
||||||
|
|
||||||
|
# 151 (2019-03-21)
|
||||||
|
|
||||||
|
Python 3.5.7 and 3.4.10 now available on all Heroku stacks.
|
||||||
|
|
||||||
|
# 150 (2019-03-13)
|
||||||
|
|
||||||
|
Python 2.7.16 now available on all Heroku stacks.
|
||||||
|
|
||||||
|
# 149 (2019-03-04)
|
||||||
|
|
||||||
|
Hotfix for broken Cedar 14 deploys
|
||||||
|
|
||||||
|
# 148 (2019-02-21)
|
||||||
|
|
||||||
|
No user facing changes, improving internal metrics
|
||||||
|
|
||||||
|
# 147 (2019-02-07)
|
||||||
|
|
||||||
|
Python 3.7.2 and 3.6.8 now available on all Heroku stacks.
|
||||||
|
|
||||||
|
# 146 (2018-11-11)
|
||||||
|
|
||||||
|
Python 3.7.1, 3.6.7, 3.5.6 and 3.4.9 now available on all Heroku stacks.
|
||||||
|
|
||||||
|
# 145 (2018-11-08)
|
||||||
|
|
||||||
|
Testing and tooling expanded to better support new runtimes
|
||||||
|
|
||||||
|
# 144 (2018-10-10)
|
||||||
|
|
||||||
|
Switch to cautious upgrade for Pipenv install to ensure the pinned pip version
|
||||||
|
is used with Pipenv
|
||||||
|
|
||||||
|
# 143 (2018-10-09)
|
||||||
|
|
||||||
|
Add support for detecting SLUGIFY_USES_TEXT_UNIDECODE, which is required to
|
||||||
|
install Apache Airflow version 1.10 or higher.
|
||||||
|
|
||||||
|
# 142 (2018-10-08)
|
||||||
|
|
||||||
|
Improvements to Python install messaging
|
||||||
|
|
||||||
|
# 139, 140, 141
|
||||||
|
|
||||||
|
No user-facing changes, documenting for version clarity
|
||||||
|
|
||||||
|
# 138 (2018-08-01)
|
||||||
|
|
||||||
|
Use stack image SQLite3 instead of vendoring
|
||||||
|
|
||||||
|
# 137 (2018-07-17)
|
||||||
|
|
||||||
|
Prevent 3.7.0 from appearing as unsupported in buildpack messaging.
|
||||||
|
|
||||||
|
# 136 (2018-06-28)
|
||||||
|
|
||||||
Upgrade to 3.6.6 and support 3.7.0 on all runtimes.
|
Upgrade to 3.6.6 and support 3.7.0 on all runtimes.
|
||||||
|
|
||||||
# 135
|
# 135 (2018-05-29)
|
||||||
|
|
||||||
Upgrade Pipenv to v2018.5.18.
|
Upgrade Pipenv to v2018.5.18.
|
||||||
|
|
||||||
# 134
|
# 134 (2018-05-02)
|
||||||
|
|
||||||
Default to 3.6.5, bugfixes.
|
Default to 3.6.5, bugfixes.
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -3,7 +3,8 @@ FROM heroku/heroku:16-build
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV WORKSPACE_DIR="/app/builds" \
|
ENV WORKSPACE_DIR="/app/builds" \
|
||||||
S3_BUCKET="lang-python" \
|
S3_BUCKET="lang-python" \
|
||||||
S3_PREFIX="heroku-16/"
|
S3_PREFIX="heroku-16/" \
|
||||||
|
DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y python-pip && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y python-pip && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
FROM heroku/heroku:18-build
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
ENV WORKSPACE_DIR="/app/builds" \
|
||||||
|
S3_BUCKET="lang-python" \
|
||||||
|
S3_PREFIX="heroku-18/" \
|
||||||
|
DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y python-pip && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
COPY requirements.txt /app/
|
||||||
|
RUN pip install --disable-pip-version-check --no-cache-dir -r /app/requirements.txt
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
gem "rspec"
|
||||||
|
gem "heroku_hatchet"
|
||||||
|
gem "rspec-retry"
|
||||||
|
gem "rake"
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
activesupport (5.2.1)
|
||||||
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
|
i18n (>= 0.7, < 2)
|
||||||
|
minitest (~> 5.1)
|
||||||
|
tzinfo (~> 1.1)
|
||||||
|
concurrent-ruby (1.1.3)
|
||||||
|
diff-lcs (1.3)
|
||||||
|
erubis (2.7.0)
|
||||||
|
excon (0.62.0)
|
||||||
|
heroics (0.0.25)
|
||||||
|
erubis (~> 2.0)
|
||||||
|
excon
|
||||||
|
moneta
|
||||||
|
multi_json (>= 1.9.2)
|
||||||
|
heroku_hatchet (4.0.6)
|
||||||
|
excon (~> 0)
|
||||||
|
minitest-retry (~> 0.1.9)
|
||||||
|
platform-api (~> 2)
|
||||||
|
repl_runner (~> 0.0.3)
|
||||||
|
rrrretry (~> 1)
|
||||||
|
thor (~> 0)
|
||||||
|
threaded (~> 0)
|
||||||
|
i18n (1.1.1)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
minitest (5.11.3)
|
||||||
|
minitest-retry (0.1.9)
|
||||||
|
minitest (>= 5.0)
|
||||||
|
moneta (1.0.0)
|
||||||
|
multi_json (1.13.1)
|
||||||
|
platform-api (2.2.0)
|
||||||
|
heroics (~> 0.0.25)
|
||||||
|
moneta (~> 1.0.0)
|
||||||
|
rake (12.3.1)
|
||||||
|
repl_runner (0.0.3)
|
||||||
|
activesupport
|
||||||
|
rrrretry (1.0.0)
|
||||||
|
rspec (3.8.0)
|
||||||
|
rspec-core (~> 3.8.0)
|
||||||
|
rspec-expectations (~> 3.8.0)
|
||||||
|
rspec-mocks (~> 3.8.0)
|
||||||
|
rspec-core (3.8.0)
|
||||||
|
rspec-support (~> 3.8.0)
|
||||||
|
rspec-expectations (3.8.1)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.8.0)
|
||||||
|
rspec-mocks (3.8.0)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.8.0)
|
||||||
|
rspec-retry (0.6.1)
|
||||||
|
rspec-core (> 3.3)
|
||||||
|
rspec-support (3.8.0)
|
||||||
|
thor (0.20.3)
|
||||||
|
thread_safe (0.3.6)
|
||||||
|
threaded (0.0.4)
|
||||||
|
tzinfo (1.2.5)
|
||||||
|
thread_safe (~> 0.1)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
heroku_hatchet
|
||||||
|
rake
|
||||||
|
rspec
|
||||||
|
rspec-retry
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.16.3
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
# These targets are not files
|
# These targets are not files
|
||||||
.PHONY: tests
|
.PHONY: tests
|
||||||
|
|
||||||
test: test-heroku-16
|
test: test-heroku-18 test-heroku-16
|
||||||
|
|
||||||
check:
|
check:
|
||||||
@shellcheck -x bin/compile bin/detect bin/release bin/test-compile bin/utils bin/warnings
|
@shellcheck -x bin/compile bin/detect bin/release bin/test-compile bin/utils bin/warnings bin/default_pythons
|
||||||
@shellcheck -x bin/steps/collectstatic bin/steps/eggpath-fix bin/steps/eggpath-fix2 bin/steps/gdal bin/steps/geo-libs bin/steps/mercurial bin/steps/nltk bin/steps/pip-install bin/steps/pip-uninstall bin/steps/pipenv bin/steps/pipenv-python-version bin/steps/pylibmc bin/steps/python
|
@shellcheck -x bin/steps/collectstatic bin/steps/eggpath-fix bin/steps/eggpath-fix2 bin/steps/gdal bin/steps/geo-libs bin/steps/mercurial bin/steps/nltk bin/steps/pip-install bin/steps/pip-uninstall bin/steps/pipenv bin/steps/pipenv-python-version bin/steps/pylibmc bin/steps/python
|
||||||
@shellcheck -x bin/steps/hooks/*
|
@shellcheck -x bin/steps/hooks/*
|
||||||
|
|
||||||
@@ -18,6 +18,11 @@ test-heroku-16:
|
|||||||
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-16" heroku/heroku:16-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
|
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-16" heroku/heroku:16-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
|
||||||
@echo ""
|
@echo ""
|
||||||
|
|
||||||
|
test-heroku-18:
|
||||||
|
@echo "Running tests in docker (heroku-18)..."
|
||||||
|
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-18" heroku/heroku:18-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
|
||||||
|
@echo ""
|
||||||
|
|
||||||
buildenv-heroku-16:
|
buildenv-heroku-16:
|
||||||
@echo "Creating build environment (heroku-16)..."
|
@echo "Creating build environment (heroku-16)..."
|
||||||
@echo
|
@echo
|
||||||
|
|||||||
@@ -4,36 +4,54 @@
|
|||||||
|
|
||||||
[](https://travis-ci.org/heroku/heroku-buildpack-python)
|
[](https://travis-ci.org/heroku/heroku-buildpack-python)
|
||||||
|
|
||||||
This is the official [Heroku buildpack](https://devcenter.heroku.com/articles/buildpacks) for Python apps, powered by [Pipenv](http://docs.pipenv.org/), [pip](https://pip.pypa.io/) and other excellent software.
|
This is the official [Heroku buildpack](https://devcenter.heroku.com/articles/buildpacks) for Python apps.
|
||||||
|
|
||||||
Recommended web frameworks include **Django** and **Flask**. The recommended webserver is **Gunicorn**. There are no restrictions around what software can be used (as long as it's pip-installable). Web processes must bind to `$PORT`, and only the HTTP protocol is permitted for incoming connections.
|
Recommended web frameworks include **Django** and **Flask**, among others. The recommended webserver is **Gunicorn**. There are no restrictions around what software can be used (as long as it's pip-installable). Web processes must bind to `$PORT`, and only the HTTP protocol is permitted for incoming connections.
|
||||||
|
|
||||||
Python packages with C dependencies that are not [available on the stack image](https://devcenter.heroku.com/articles/stack-packages) are generally not supported, unless `manylinux` wheels are provided by the package maintainers (common). For recommended solutions, check out [this article](https://devcenter.heroku.com/articles/python-c-deps) for more information.
|
Python packages with C dependencies that are not [available on the stack image](https://devcenter.heroku.com/articles/stack-packages) are generally not supported, unless `manylinux` wheels are provided by the package maintainers (common). For recommended solutions, check out [this article](https://devcenter.heroku.com/articles/python-c-deps) for more information.
|
||||||
|
|
||||||
See it in Action
|
See it in Action
|
||||||
----------------
|
----------------
|
||||||
|
```
|
||||||
|
$ ls
|
||||||
|
my-application requirements.txt runtime.txt
|
||||||
|
|
||||||
Deploying a Python application couldn't be easier:
|
$ git push heroku master
|
||||||
|
Counting objects: 4, done.
|
||||||
|
Delta compression using up to 8 threads.
|
||||||
|
Compressing objects: 100% (2/2), done.
|
||||||
|
Writing objects: 100% (4/4), 276 bytes | 276.00 KiB/s, done.
|
||||||
|
Total 4 (delta 0), reused 0 (delta 0)
|
||||||
|
remote: Compressing source files... done.
|
||||||
|
remote: Building source:
|
||||||
|
remote:
|
||||||
|
remote: -----> Python app detected
|
||||||
|
remote: -----> Installing python-3.7.1
|
||||||
|
remote: -----> Installing pip
|
||||||
|
remote: -----> Installing SQLite3
|
||||||
|
remote: -----> Installing requirements with pip
|
||||||
|
remote: Collecting flask (from -r /tmp/build_c2c067ef79ff14c9bf1aed6796f9ed1f/requirements.txt (line 1))
|
||||||
|
remote: Downloading ...
|
||||||
|
remote: Installing collected packages: Werkzeug, click, MarkupSafe, Jinja2, itsdangerous, flask
|
||||||
|
remote: Successfully installed Jinja2-2.10 MarkupSafe-1.1.0 Werkzeug-0.14.1 click-7.0 flask-1.0.2 itsdangerous-1.1.0
|
||||||
|
remote:
|
||||||
|
remote: -----> Discovering process types
|
||||||
|
remote: Procfile declares types -> (none)
|
||||||
|
remote:
|
||||||
|
```
|
||||||
|
|
||||||
$ ls
|
A `requirements.txt` must be present at the root of your application's repository to deploy.
|
||||||
Pipfile Pipfile.lock Procfile web.py
|
|
||||||
|
|
||||||
$ heroku create --buildpack heroku/python
|
To specify your python version, you also need a `runtime.txt` file - unless you are using the default Python runtime version.
|
||||||
|
|
||||||
$ git push heroku master
|
Current default Python Runtime: Python 3.6.7
|
||||||
…
|
|
||||||
-----> Python app detected
|
|
||||||
-----> Installing python-3.6.6
|
|
||||||
-----> Installing pip
|
|
||||||
-----> Installing requirements with Pipenv 2018.5.18…
|
|
||||||
...
|
|
||||||
Installing dependencies from Pipfile…
|
|
||||||
-----> Discovering process types
|
|
||||||
Procfile declares types -> (none)
|
|
||||||
|
|
||||||
A `Pipfile` or `requirements.txt` must be present at the root of your application's repository.
|
Alternatively, you can provide a `setup.py` file, or a `Pipfile`. Using `Pipenv` will generate `runtime.txt` based on `python-version` at build time.
|
||||||
|
|
||||||
You can also specify the latest production release of this buildpack for upcoming builds of an existing application:
|
Specify a Buildpack Version
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
You can specify the latest production release of this buildpack for upcoming builds of an existing application:
|
||||||
|
|
||||||
$ heroku buildpacks:set heroku/python
|
$ heroku buildpacks:set heroku/python
|
||||||
|
|
||||||
@@ -41,23 +59,30 @@ You can also specify the latest production release of this buildpack for upcomin
|
|||||||
Specify a Python Runtime
|
Specify a Python Runtime
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
Specific versions of the Python runtime can be specified in your `Pipfile`:
|
Supported runtime options include:
|
||||||
|
|
||||||
[requires]
|
- `python-3.7.1`
|
||||||
python_version = "2.7"
|
- `python-3.6.7`
|
||||||
|
|
||||||
Or, more specifically:
|
|
||||||
|
|
||||||
[requires]
|
|
||||||
python_full_version = "2.7.15"
|
|
||||||
|
|
||||||
Or, with a `runtime.txt` file:
|
|
||||||
|
|
||||||
$ cat runtime.txt
|
|
||||||
python-2.7.15
|
|
||||||
|
|
||||||
Runtime options include:
|
|
||||||
|
|
||||||
- `python-3.7.0`
|
|
||||||
- `python-3.6.6`
|
|
||||||
- `python-2.7.15`
|
- `python-2.7.15`
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
The buildpack tests use [Docker](https://www.docker.com/) to simulate
|
||||||
|
Heroku's [stack images.](https://devcenter.heroku.com/articles/stack)
|
||||||
|
|
||||||
|
To run the test suite:
|
||||||
|
|
||||||
|
```
|
||||||
|
make test
|
||||||
|
```
|
||||||
|
|
||||||
|
Or to test in a particular stack:
|
||||||
|
|
||||||
|
```
|
||||||
|
make test-heroku-18
|
||||||
|
make test-heroku-16
|
||||||
|
```
|
||||||
|
|
||||||
|
The tests are run via the vendored
|
||||||
|
[shunit2](https://github.com/kward/shunit2)
|
||||||
|
test framework.
|
||||||
|
|||||||
+24
-8
@@ -45,20 +45,24 @@ if [[ -n ${BUILDPACK_VENDOR_URL:-} ]]; then
|
|||||||
fi
|
fi
|
||||||
export VENDOR_URL
|
export VENDOR_URL
|
||||||
|
|
||||||
# Which versions of Python are we using?
|
# Default Python Versions
|
||||||
# These variables are used to specify which versions of Python to install by default,
|
# shellcheck source=bin/default_pythons
|
||||||
# as well as prompt the user to upgrade if they are using an un–supported version.
|
source "$BIN_DIR/default_pythons"
|
||||||
# Note: When 3.7 lands, I recommend switching to LATEST_36 and LATEST_37.
|
|
||||||
DEFAULT_PYTHON_VERSION="python-3.6.6"
|
# Supported Python Branches
|
||||||
LATEST_3="python-3.6.6"
|
PY37="python-3.7"
|
||||||
LATEST_2="python-2.7.15"
|
PY36="python-3.6"
|
||||||
|
PY35="python-3.5"
|
||||||
|
PY34="python-3.4"
|
||||||
|
PY27="python-2.7"
|
||||||
|
|
||||||
# Which stack is used (for binary downloading), if none is provided (e.g. outside of Heroku)?
|
# Which stack is used (for binary downloading), if none is provided (e.g. outside of Heroku)?
|
||||||
DEFAULT_PYTHON_STACK="cedar-14"
|
DEFAULT_PYTHON_STACK="cedar-14"
|
||||||
# If pip doesn't match this version (the version we install), run the installer.
|
# If pip doesn't match this version (the version we install), run the installer.
|
||||||
PIP_UPDATE="9.0.2"
|
PIP_UPDATE="9.0.2"
|
||||||
|
|
||||||
export DEFAULT_PYTHON_VERSION DEFAULT_PYTHON_STACK PIP_UPDATE LATEST_2 LATEST_3
|
export DEFAULT_PYTHON_STACK PIP_UPDATE
|
||||||
|
export PY37 PY36 PY35 PY27 PY34
|
||||||
|
|
||||||
# Common Problem Warnings:
|
# Common Problem Warnings:
|
||||||
# This section creates a temporary file in which to stick the output of `pip install`.
|
# This section creates a temporary file in which to stick the output of `pip install`.
|
||||||
@@ -159,6 +163,8 @@ cp -R "$CACHE_DIR/.heroku/python" .heroku/ &> /dev/null || true
|
|||||||
cp -R "$CACHE_DIR/.heroku/python-stack" .heroku/ &> /dev/null || true
|
cp -R "$CACHE_DIR/.heroku/python-stack" .heroku/ &> /dev/null || true
|
||||||
# A plain text file which contains the current python version being used (used for cache busting).
|
# A plain text file which contains the current python version being used (used for cache busting).
|
||||||
cp -R "$CACHE_DIR/.heroku/python-version" .heroku/ &> /dev/null || true
|
cp -R "$CACHE_DIR/.heroku/python-version" .heroku/ &> /dev/null || true
|
||||||
|
# A plain text file which contains the current sqlite3 version being used (used for cache busting).
|
||||||
|
cp -R "$CACHE_DIR/.heroku/python-sqlite3-version" .heroku/ &> /dev/null || true
|
||||||
# Any pre-compiled binaries, provided by the buildpack.
|
# Any pre-compiled binaries, provided by the buildpack.
|
||||||
cp -R "$CACHE_DIR/.heroku/vendor" .heroku/ &> /dev/null || true
|
cp -R "$CACHE_DIR/.heroku/vendor" .heroku/ &> /dev/null || true
|
||||||
# "editable" installations of code repositories, via pip or pipenv.
|
# "editable" installations of code repositories, via pip or pipenv.
|
||||||
@@ -273,6 +279,16 @@ sub_env "$BIN_DIR/steps/geo-libs"
|
|||||||
# shellcheck source=bin/steps/gdal
|
# shellcheck source=bin/steps/gdal
|
||||||
source "$BIN_DIR/steps/gdal"
|
source "$BIN_DIR/steps/gdal"
|
||||||
|
|
||||||
|
# SQLite3 support.
|
||||||
|
# This sets up and installs sqlite3 dev headers and the sqlite3 binary but not the
|
||||||
|
# libsqlite3-0 library since that exists on the stack image.
|
||||||
|
# Note: This only applies to Python 2.7.15+ and Python 3.6.6+
|
||||||
|
(( start=$(nowms) ))
|
||||||
|
# shellcheck source=bin/steps/sqlite3
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
buildpack_sqlite3_install
|
||||||
|
mtime "sqlite3.install.time" "${start}"
|
||||||
|
|
||||||
# pip install
|
# pip install
|
||||||
# -----------
|
# -----------
|
||||||
|
|
||||||
|
|||||||
Executable
+10
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DEFAULT_PYTHON_VERSION="python-3.6.8"
|
||||||
|
LATEST_36="python-3.6.8"
|
||||||
|
LATEST_37="python-3.7.3"
|
||||||
|
LATEST_35="python-3.5.7"
|
||||||
|
LATEST_34="python-3.4.10"
|
||||||
|
LATEST_27="python-2.7.16"
|
||||||
|
|
||||||
|
export DEFAULT_PYTHON_VERSION LATEST_37 LATEST_36 LATEST_35 LATEST_34 LATEST_27
|
||||||
+1
-1
@@ -26,9 +26,9 @@ if (pip-grep -s requirements.txt GDAL gdal pygdal &> /dev/null) then
|
|||||||
mkdir -p .heroku/vendor
|
mkdir -p .heroku/vendor
|
||||||
# Download and extract cryptography into target vendor directory.
|
# Download and extract cryptography into target vendor directory.
|
||||||
curl "$VENDORED_GDAL" -s | tar zxv -C .heroku/vendor &> /dev/null
|
curl "$VENDORED_GDAL" -s | tar zxv -C .heroku/vendor &> /dev/null
|
||||||
|
mcount "steps.vendor.gdal"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GDAL=$(pwd)/vendor
|
GDAL=$(pwd)/vendor
|
||||||
export GDAL
|
export GDAL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ source "$BIN_DIR/utils"
|
|||||||
|
|
||||||
# If GDAL exists within requirements, use vendored gdal.
|
# If GDAL exists within requirements, use vendored gdal.
|
||||||
if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then
|
if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then
|
||||||
|
mcount "buildvar.BUILD_WITH_GEO_LIBRARIES"
|
||||||
|
|
||||||
if [ ! -f ".heroku/vendor/bin/proj" ]; then
|
if [ ! -f ".heroku/vendor/bin/proj" ]; then
|
||||||
echo "-----> Bootstrapping gdal, geos, proj."
|
echo "-----> Bootstrapping gdal, geos, proj."
|
||||||
@@ -31,9 +32,11 @@ if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then
|
|||||||
curl "$VENDORED_GEOS" -s | tar zxv -C .heroku/vendor &> /dev/null
|
curl "$VENDORED_GEOS" -s | tar zxv -C .heroku/vendor &> /dev/null
|
||||||
curl "$VENDORED_PROJ" -s | tar zxv -C .heroku/vendor &> /dev/null
|
curl "$VENDORED_PROJ" -s | tar zxv -C .heroku/vendor &> /dev/null
|
||||||
|
|
||||||
|
mcount "steps.vendor.geo_libs"
|
||||||
# Copy libjasper from build image to slug.
|
# Copy libjasper from build image to slug.
|
||||||
if [[ "$STACK" == "heroku-16" ]]; then
|
if [[ "$STACK" == "heroku-16" ]]; then
|
||||||
cp /usr/lib/x86_64-linux-gnu/libjasper.so* ".heroku/vendor/lib/."
|
cp /usr/lib/x86_64-linux-gnu/libjasper.so* ".heroku/vendor/lib/."
|
||||||
|
mcount "steps.vendor.libjasper"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-1
@@ -4,6 +4,6 @@
|
|||||||
if [[ -f "requirements.txt" ]]; then
|
if [[ -f "requirements.txt" ]]; then
|
||||||
if (grep -Fiq "hg+" requirements.txt) then
|
if (grep -Fiq "hg+" requirements.txt) then
|
||||||
/app/.heroku/python/bin/pip install mercurial | cleanup | indent
|
/app/.heroku/python/bin/pip install mercurial | cleanup | indent
|
||||||
|
mcount "steps.mercurial"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ if sp-grep -s nltk; then
|
|||||||
python -m nltk.downloader -d "$BUILD_DIR/.heroku/python/nltk_data" "${nltk_packages[@]}" | indent
|
python -m nltk.downloader -d "$BUILD_DIR/.heroku/python/nltk_data" "${nltk_packages[@]}" | indent
|
||||||
set_env NLTK_DATA "/app/.heroku/python/nltk_data"
|
set_env NLTK_DATA "/app/.heroku/python/nltk_data"
|
||||||
|
|
||||||
|
mcount "buildvar.NLTK_PACKAGES_DEFINITION"
|
||||||
|
mcount "steps.nltk"
|
||||||
else
|
else
|
||||||
puts-warn "'nltk.txt' not found, not downloading any corpora"
|
puts-warn "'nltk.txt' not found, not downloading any corpora"
|
||||||
puts-warn "Learn more: https://devcenter.heroku.com/articles/python-nltk"
|
puts-warn "Learn more: https://devcenter.heroku.com/articles/python-nltk"
|
||||||
|
|||||||
+19
-3
@@ -8,10 +8,24 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then
|
|||||||
# Install dependencies with Pip.
|
# Install dependencies with Pip.
|
||||||
puts-step "Installing requirements with pip"
|
puts-step "Installing requirements with pip"
|
||||||
|
|
||||||
# Set PIP_EXTRA_INDEX_URL
|
# Set Pip env vars
|
||||||
if [[ -r $ENV_DIR/PIP_EXTRA_INDEX_URL ]]; then
|
# This reads certain environment variables set on the Heroku app config
|
||||||
|
# and makes them accessible to the pip install process.
|
||||||
|
#
|
||||||
|
# PIP_EXTRA_INDEX_URL allows for an alternate pypi URL to be used.
|
||||||
|
if [[ -r "$ENV_DIR/PIP_EXTRA_INDEX_URL" ]]; then
|
||||||
PIP_EXTRA_INDEX_URL="$(cat "$ENV_DIR/PIP_EXTRA_INDEX_URL")"
|
PIP_EXTRA_INDEX_URL="$(cat "$ENV_DIR/PIP_EXTRA_INDEX_URL")"
|
||||||
export PIP_EXTRA_INDEX_URL
|
export PIP_EXTRA_INDEX_URL
|
||||||
|
mcount "buildvar.PIP_EXTRA_INDEX_URL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
set +e
|
||||||
|
|
||||||
|
# Set SLUGIFY_USES_TEXT_UNIDECODE, required for Airflow versions >=1.10
|
||||||
|
if [[ -r "$ENV_DIR/SLUGIFY_USES_TEXT_UNIDECODE" ]]; then
|
||||||
|
SLUGIFY_USES_TEXT_UNIDECODE="$(cat "$ENV_DIR/SLUGIFY_USES_TEXT_UNIDECODE")"
|
||||||
|
export SLUGIFY_USES_TEXT_UNIDECODE
|
||||||
|
mcount "buildvar.SLUGIFY_USES_TEXT_UNIDECODE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
@@ -24,7 +38,9 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then
|
|||||||
mcount "failure.none-version"
|
mcount "failure.none-version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$BUILD_DIR/.heroku/python/bin/pip" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
/app/.heroku/python/bin/pip install -r "$BUILD_DIR/requirements.txt" --exists-action=w --src=/app/.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | tee "$WARNINGS_LOG" | cleanup | indent
|
/app/.heroku/python/bin/pip install -r "$BUILD_DIR/requirements.txt" --exists-action=w --src=/app/.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | tee "$WARNINGS_LOG" | cleanup | indent
|
||||||
PIP_STATUS="${PIPESTATUS[0]}"
|
PIP_STATUS="${PIPESTATUS[0]}"
|
||||||
set -e
|
set -e
|
||||||
|
|||||||
+18
-4
@@ -20,7 +20,6 @@ if [[ -f Pipfile.lock ]]; then
|
|||||||
export SKIP_PIPENV_INSTALL=1
|
export SKIP_PIPENV_INSTALL=1
|
||||||
export SKIP_PIP_INSTALL=1
|
export SKIP_PIP_INSTALL=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -35,16 +34,31 @@ if [ ! "$SKIP_PIPENV_INSTALL" ]; then
|
|||||||
# Skip pip install, later.
|
# Skip pip install, later.
|
||||||
export SKIP_PIP_INSTALL=1
|
export SKIP_PIP_INSTALL=1
|
||||||
|
|
||||||
# Set PIP_EXTRA_INDEX_URL
|
# Set Pip env vars
|
||||||
if [[ -r $ENV_DIR/PIP_EXTRA_INDEX_URL ]]; then
|
# This reads certain environment variables set on the Heroku app config
|
||||||
|
# and makes them accessible to the pip install process.
|
||||||
|
#
|
||||||
|
# PIP_EXTRA_INDEX_URL allows for an alternate pypi URL to be used.
|
||||||
|
if [[ -r "$ENV_DIR/PIP_EXTRA_INDEX_URL" ]]; then
|
||||||
PIP_EXTRA_INDEX_URL="$(cat "$ENV_DIR/PIP_EXTRA_INDEX_URL")"
|
PIP_EXTRA_INDEX_URL="$(cat "$ENV_DIR/PIP_EXTRA_INDEX_URL")"
|
||||||
export PIP_EXTRA_INDEX_URL
|
export PIP_EXTRA_INDEX_URL
|
||||||
|
mcount "buildvar.PIP_EXTRA_INDEX_URL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set SLUGIFY_USES_TEXT_UNIDECODE, required for Airflow versions >=1.10
|
||||||
|
if [[ -r "$ENV_DIR/SLUGIFY_USES_TEXT_UNIDECODE" ]]; then
|
||||||
|
SLUGIFY_USES_TEXT_UNIDECODE="$(cat "$ENV_DIR/SLUGIFY_USES_TEXT_UNIDECODE")"
|
||||||
|
export SLUGIFY_USES_TEXT_UNIDECODE
|
||||||
|
mcount "buildvar.SLUGIFY_USES_TEXT_UNIDECODE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PIPENV_VERSION="2018.5.18"
|
export PIPENV_VERSION="2018.5.18"
|
||||||
|
|
||||||
# Install pipenv.
|
# Install pipenv.
|
||||||
/app/.heroku/python/bin/pip install pipenv==$PIPENV_VERSION --upgrade &> /dev/null
|
# Due to weird old pip behavior and pipenv behavior, pipenv upgrades pip
|
||||||
|
# to latest if only --upgrade is specified. Specify upgrade strategy to
|
||||||
|
# avoid this eager behavior.
|
||||||
|
/app/.heroku/python/bin/pip install pipenv==$PIPENV_VERSION --upgrade --upgrade-strategy only-if-needed &> /dev/null
|
||||||
|
|
||||||
# Install the dependencies.
|
# Install the dependencies.
|
||||||
if [[ ! -f Pipfile.lock ]]; then
|
if [[ ! -f Pipfile.lock ]]; then
|
||||||
|
|||||||
@@ -19,10 +19,13 @@ if [[ -f $BUILD_DIR/Pipfile ]]; then
|
|||||||
if [[ "$PYTHON" == "null" ]]; then
|
if [[ "$PYTHON" == "null" ]]; then
|
||||||
PYTHON=$(jq -r '._meta.requires.python_version' "$BUILD_DIR/Pipfile.lock")
|
PYTHON=$(jq -r '._meta.requires.python_version' "$BUILD_DIR/Pipfile.lock")
|
||||||
if [ "$PYTHON" = 2.7 ]; then
|
if [ "$PYTHON" = 2.7 ]; then
|
||||||
echo "$LATEST_2" > "$BUILD_DIR/runtime.txt"
|
echo "$LATEST_27" > "$BUILD_DIR/runtime.txt"
|
||||||
fi
|
fi
|
||||||
if [ "$PYTHON" = 3.6 ]; then
|
if [ "$PYTHON" = 3.6 ]; then
|
||||||
echo "$LATEST_3" > "$BUILD_DIR/runtime.txt"
|
echo "$LATEST_36" > "$BUILD_DIR/runtime.txt"
|
||||||
|
fi
|
||||||
|
if [ "$PYTHON" = 3.7 ]; then
|
||||||
|
echo "$LATEST_37" > "$BUILD_DIR/runtime.txt"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -30,4 +33,3 @@ if [[ -f $BUILD_DIR/Pipfile ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ if (pip-grep -s requirements.txt pylibmc &> /dev/null) then
|
|||||||
mkdir -p .heroku/vendor
|
mkdir -p .heroku/vendor
|
||||||
# Download and extract libmemcached into target vendor directory.
|
# Download and extract libmemcached into target vendor directory.
|
||||||
curl "$VENDORED_MEMCACHED" -s | tar zxv -C .heroku/vendor &> /dev/null
|
curl "$VENDORED_MEMCACHED" -s | tar zxv -C .heroku/vendor &> /dev/null
|
||||||
|
mcount "steps.vendor.pylibmc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LIBMEMCACHED=$(pwd)/vendor
|
LIBMEMCACHED=$(pwd)/vendor
|
||||||
|
|||||||
+52
-13
@@ -7,24 +7,62 @@ PYTHON_VERSION=$(cat runtime.txt)
|
|||||||
# The location of the pre-compiled python binary.
|
# The location of the pre-compiled python binary.
|
||||||
VENDORED_PYTHON="${VENDOR_URL}/runtimes/$PYTHON_VERSION.tar.gz"
|
VENDORED_PYTHON="${VENDOR_URL}/runtimes/$PYTHON_VERSION.tar.gz"
|
||||||
|
|
||||||
if [[ $PYTHON_VERSION =~ ^python-2 ]]; then
|
SECURITY_UPDATE="Python has released a security update! Please consider upgrading to"
|
||||||
if [[ "$PYTHON_VERSION" != "$LATEST_2" ]]; then
|
|
||||||
puts-warn "The latest version of Python 2 is $LATEST_2 (you are using $PYTHON_VERSION, which is unsupported)."
|
# check if runtime exists
|
||||||
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_2)."
|
if curl --output /dev/null --silent --head --fail "$VENDORED_PYTHON"; then
|
||||||
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
|
if [[ "$PYTHON_VERSION" == $PY37* ]]; then
|
||||||
|
# do things to alert the user of security release available
|
||||||
|
if [ "$PYTHON_VERSION" != "$LATEST_37" ]; then
|
||||||
|
puts-warn "$SECURITY_UPDATE" "$LATEST_37"
|
||||||
|
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ "$PYTHON_VERSION" == $PY36* ]]; then
|
||||||
|
# security update note
|
||||||
|
if [ "$PYTHON_VERSION" != "$LATEST_36" ]; then
|
||||||
|
puts-warn "$SECURITY_UPDATE" "$LATEST_36"
|
||||||
|
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ "$PYTHON_VERSION" == $PY35* ]]; then
|
||||||
|
# security update note
|
||||||
|
if [ "$PYTHON_VERSION" != "$LATEST_35" ]; then
|
||||||
|
puts-warn "$SECURITY_UPDATE" "$LATEST_35"
|
||||||
|
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ "$PYTHON_VERSION" == $PY34* ]]; then
|
||||||
|
# security update note
|
||||||
|
if [ "$PYTHON_VERSION" != "$LATEST_34" ]; then
|
||||||
|
puts-warn "$SECURITY_UPDATE" "$LATEST_34"
|
||||||
|
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ "$PYTHON_VERSION" == $PY27* ]]; then
|
||||||
|
# security update note
|
||||||
|
if [ "$PYTHON_VERSION" != "$LATEST_27" ]; then
|
||||||
|
puts-warn "$SECURITY_UPDATE" "$LATEST_27"
|
||||||
|
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ "$PYTHON_VERSION" != "$LATEST_3" ]]; then
|
puts-warn "Requested runtime ($PYTHON_VERSION) is not available for this stack ($STACK)."
|
||||||
puts-warn "The latest version of Python 3 is $LATEST_3 (you are using $PYTHON_VERSION, which is unsupported)."
|
puts-warn "Aborting. More info: https://devcenter.heroku.com/articles/python-support"
|
||||||
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_3)."
|
exit 1
|
||||||
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then
|
if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then
|
||||||
puts-step "Stack has changed from $CACHED_PYTHON_STACK to $STACK, clearing cache"
|
puts-step "Stack has changed from $CACHED_PYTHON_STACK to $STACK, clearing cache"
|
||||||
rm -fr .heroku/python-stack .heroku/python-version .heroku/python .heroku/vendor
|
rm -fr .heroku/python-stack .heroku/python-version .heroku/python .heroku/vendor .heroku/python .heroku/python-sqlite3-version
|
||||||
|
fi
|
||||||
|
|
||||||
|
# need to clear the cache for first time installing SQLite3,
|
||||||
|
# since the version is changing and could lead to runtime errors
|
||||||
|
# with compiled extensions.
|
||||||
|
if [ -d .heroku/python ] && [ ! -f .heroku/python-sqlite3-version ] && python_sqlite3_check "$PYTHON_VERSION"; then
|
||||||
|
puts-step "Need to update SQLite3, clearing cache"
|
||||||
|
rm -fr .heroku/python-stack .heroku/python-version .heroku/python .heroku/vendor
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f .heroku/python-version ]; then
|
if [ -f .heroku/python-version ]; then
|
||||||
@@ -36,6 +74,7 @@ if [ -f .heroku/python-version ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! "$SKIP_INSTALL" ]; then
|
if [ ! "$SKIP_INSTALL" ]; then
|
||||||
puts-step "Installing $PYTHON_VERSION"
|
puts-step "Installing $PYTHON_VERSION"
|
||||||
|
|
||||||
@@ -58,6 +97,7 @@ if [ ! "$SKIP_INSTALL" ]; then
|
|||||||
hash -r
|
hash -r
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# If Pip isn't up to date:
|
# If Pip isn't up to date:
|
||||||
if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_UPDATE* ]]; then
|
if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_UPDATE* ]]; then
|
||||||
|
|
||||||
@@ -69,7 +109,6 @@ if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_UPDATE* ]]; then
|
|||||||
|
|
||||||
/app/.heroku/python/bin/python "$ROOT_DIR/vendor/get-pip.py" pip=="$PIP_UPDATE" &> /dev/null
|
/app/.heroku/python/bin/python "$ROOT_DIR/vendor/get-pip.py" pip=="$PIP_UPDATE" &> /dev/null
|
||||||
/app/.heroku/python/bin/pip install "$ROOT_DIR/vendor/setuptools-39.0.1-py2.py3-none-any.whl" &> /dev/null
|
/app/.heroku/python/bin/pip install "$ROOT_DIR/vendor/setuptools-39.0.1-py2.py3-none-any.whl" &> /dev/null
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|||||||
Executable
+93
@@ -0,0 +1,93 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/utils"
|
||||||
|
|
||||||
|
sqlite3_version() {
|
||||||
|
if [ "$STACK" = "cedar-14" ]; then
|
||||||
|
SQLITE3_VERSION="3.8.2-1ubuntu2.2"
|
||||||
|
elif [ "$STACK" = "heroku-16" ]; then
|
||||||
|
SQLITE3_VERSION="3.11.0-1ubuntu1.2"
|
||||||
|
else
|
||||||
|
SQLITE3_VERSION=${SQLITE3_VERSION:-$(dpkg -s libsqlite3-0 | grep Version | sed 's/Version: //')}
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SQLITE3_VERSION
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlite3_install() {
|
||||||
|
HEROKU_PYTHON_DIR="$1"
|
||||||
|
SQLITE3_VERSION="$2"
|
||||||
|
HEADERS_ONLY="$3"
|
||||||
|
|
||||||
|
mkdir -p "$HEROKU_PYTHON_DIR"
|
||||||
|
|
||||||
|
APT_CACHE_DIR="$HEROKU_PYTHON_DIR/apt/cache"
|
||||||
|
APT_STATE_DIR="$HEROKU_PYTHON_DIR/apt/state"
|
||||||
|
|
||||||
|
mkdir -p "$APT_CACHE_DIR/archives/partial"
|
||||||
|
mkdir -p "$APT_STATE_DIR/lists/partial"
|
||||||
|
|
||||||
|
APT_OPTIONS="-o debug::nolocking=true"
|
||||||
|
APT_OPTIONS="$APT_OPTIONS -o dir::cache=$APT_CACHE_DIR"
|
||||||
|
APT_OPTIONS="$APT_OPTIONS -o dir::state=$APT_STATE_DIR"
|
||||||
|
APT_OPTIONS="$APT_OPTIONS -o dir::etc::sourcelist=/etc/apt/sources.list"
|
||||||
|
|
||||||
|
apt-get $APT_OPTIONS update > /dev/null 2>&1
|
||||||
|
if [ -z "$HEADERS_ONLY" ]; then
|
||||||
|
apt-get $APT_OPTIONS -y -d --reinstall install libsqlite3-dev="$SQLITE3_VERSION" sqlite3="$SQLITE3_VERSION" > /dev/null 2>&1
|
||||||
|
else
|
||||||
|
apt-get $APT_OPTIONS -y -d --reinstall install libsqlite3-dev="$SQLITE3_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
find "$APT_CACHE_DIR/archives/" -name "*.deb" -exec dpkg -x {} "$HEROKU_PYTHON_DIR/sqlite3/" \;
|
||||||
|
|
||||||
|
mkdir -p "$HEROKU_PYTHON_DIR/include"
|
||||||
|
mkdir -p "$HEROKU_PYTHON_DIR/lib"
|
||||||
|
|
||||||
|
# remove old sqlite3 libraries/binaries
|
||||||
|
find "$HEROKU_PYTHON_DIR/include/" -name "sqlite3*.h" -exec rm -f {} \;
|
||||||
|
find "$HEROKU_PYTHON_DIR/lib/" -name "libsqlite3.*" -exec rm -f {} \;
|
||||||
|
rm -f "$HEROKU_PYTHON_DIR/lib/pkgconfig/sqlite3.pc"
|
||||||
|
rm -f "$HEROKU_PYTHON_DIR/bin/sqlite3"
|
||||||
|
|
||||||
|
# copy over sqlite3 headers & bins and setup linking against the stack image library
|
||||||
|
mv "$HEROKU_PYTHON_DIR/sqlite3/usr/include/"* "$HEROKU_PYTHON_DIR/include/"
|
||||||
|
mv "$HEROKU_PYTHON_DIR/sqlite3/usr/lib/x86_64-linux-gnu"/libsqlite3.*a "$HEROKU_PYTHON_DIR/lib/"
|
||||||
|
mkdir -p "$HEROKU_PYTHON_DIR/lib/pkgconfig"
|
||||||
|
# set the right prefix/lib directories
|
||||||
|
sed -e 's/prefix=\/usr/prefix=\/app\/.heroku\/python/' -e 's/\/x86_64-linux-gnu//' "$HEROKU_PYTHON_DIR/sqlite3/usr/lib/x86_64-linux-gnu/pkgconfig/sqlite3.pc" > "$HEROKU_PYTHON_DIR/lib/pkgconfig/sqlite3.pc"
|
||||||
|
# need to point the libsqlite3.so to the stack image library for /usr/bin/ld -lsqlite3
|
||||||
|
SQLITE3_LIBFILE="/usr/lib/x86_64-linux-gnu/$(readlink -n "$HEROKU_PYTHON_DIR/sqlite3/usr/lib/x86_64-linux-gnu/libsqlite3.so")"
|
||||||
|
ln -s "$SQLITE3_LIBFILE" "$HEROKU_PYTHON_DIR/lib/libsqlite3.so"
|
||||||
|
if [ -z "$HEADERS_ONLY" ]; then
|
||||||
|
mv "$HEROKU_PYTHON_DIR/sqlite3/usr/bin"/* "$HEROKU_PYTHON_DIR/bin/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
rm -rf "$HEROKU_PYTHON_DIR/sqlite3/"
|
||||||
|
rm -rf "$HEROKU_PYTHON_DIR/apt/"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildpack_sqlite3_install() {
|
||||||
|
sqlite3_version
|
||||||
|
HEROKU_PYTHON_DIR="$BUILD_DIR/.heroku/python"
|
||||||
|
|
||||||
|
SQLITE3_VERSION_FILE="$BUILD_DIR/.heroku/python-sqlite3-version"
|
||||||
|
if [ -f "$SQLITE3_VERSION_FILE" ]; then
|
||||||
|
INSTALLED_SQLITE3_VERSION=$(cat "$SQLITE3_VERSION_FILE")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# python version check
|
||||||
|
if python_sqlite3_check "$PYTHON_VERSION"; then
|
||||||
|
# only install if the sqlite3 version has changed
|
||||||
|
if [ "$INSTALLED_SQLITE3_VERSION" != "$SQLITE3_VERSION" ]; then
|
||||||
|
puts-step "Installing SQLite3"
|
||||||
|
sqlite3_install "$BUILD_DIR/.heroku/python" "$SQLITE3_VERSION"
|
||||||
|
|
||||||
|
# save version installed
|
||||||
|
mkdir -p "$CACHE_DIR/.heroku/"
|
||||||
|
echo "$SQLITE3_VERSION" > "$CACHE_DIR/.heroku/python-sqlite3-version"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -58,3 +58,40 @@ measure-size() {
|
|||||||
echo "$(du -s .heroku/python 2>/dev/null || echo 0) | awk '{print $1}')"
|
echo "$(du -s .heroku/python 2>/dev/null || echo 0) | awk '{print $1}')"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Python version operator >
|
||||||
|
version_gt() {
|
||||||
|
test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Python verison operator >=
|
||||||
|
version_gte() {
|
||||||
|
if [ "$1" == "$2" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
version_gt "$1" "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if Python 2
|
||||||
|
python2_check() {
|
||||||
|
VERSION="$1"
|
||||||
|
|
||||||
|
version_gte "$VERSION" "python-2.7.0" && version_gt "python-3.0.0" "$VERSION"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if Python 3
|
||||||
|
python3_check() {
|
||||||
|
VERSION="$1"
|
||||||
|
|
||||||
|
version_gte "$VERSION" "python-3.0.0" && version_gt "python-4.0.0" "$VERSION"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if Python version needs to install SQLite3
|
||||||
|
python_sqlite3_check() {
|
||||||
|
VERSION="$1"
|
||||||
|
MIN_PYTHON_3="python-3.5.6"
|
||||||
|
MIN_PYTHON_2="python-2.7.15"
|
||||||
|
|
||||||
|
( python2_check "$VERSION" && version_gte "$VERSION" "$MIN_PYTHON_2" ) \
|
||||||
|
|| ( python3_check "$VERSION" && version_gte "$VERSION" "$MIN_PYTHON_3" )
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Build Path: /app/.heroku/python/
|
# Build Path: /app/.heroku/python/
|
||||||
# Build Deps: libraries/sqlite
|
|
||||||
|
|
||||||
OUT_PREFIX=$1
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
echo "Building Python…"
|
echo "Building Python…"
|
||||||
SOURCE_TARBALL='https://python.org/ftp/python/2.7.15/Python-2.7.15.tgz'
|
SOURCE_TARBALL='https://python.org/ftp/python/2.7.15/Python-2.7.15.tgz'
|
||||||
|
|||||||
Executable
+27
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build Path: /app/.heroku/python/
|
||||||
|
|
||||||
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
|
echo "Building Python…"
|
||||||
|
SOURCE_TARBALL='https://python.org/ftp/python/2.7.16/Python-2.7.16.tgz'
|
||||||
|
curl -L $SOURCE_TARBALL | tar xz
|
||||||
|
mv Python-2.7.16 src
|
||||||
|
cd src
|
||||||
|
|
||||||
|
./configure --prefix=$OUT_PREFIX --enable-unicode=ucs4 --with-ensurepip=no
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
# Remove unneeded test directories, similar to the official Docker Python images:
|
||||||
|
# https://github.com/docker-library/python
|
||||||
|
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build Path: /app/.heroku/python/
|
||||||
|
|
||||||
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
|
echo "Building Python…"
|
||||||
|
SOURCE_TARBALL='https://python.org/ftp/python/3.7.2/Python-3.7.2.tgz'
|
||||||
|
curl -L $SOURCE_TARBALL | tar xz
|
||||||
|
mv Python-3.7.2 src
|
||||||
|
cd src
|
||||||
|
|
||||||
|
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
# Remove unneeded test directories, similar to the official Docker Python images:
|
||||||
|
# https://github.com/docker-library/python
|
||||||
|
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
|
||||||
|
|
||||||
|
# Remove spare /
|
||||||
|
LOCATION=${OUT_PREFIX%?}
|
||||||
|
|
||||||
|
ln $LOCATION/bin/python3 $LOCATION/bin/python
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build Path: /app/.heroku/python/
|
||||||
|
|
||||||
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
|
echo "Building Python…"
|
||||||
|
SOURCE_TARBALL='https://python.org/ftp/python/3.4.9/Python-3.4.9.tgz'
|
||||||
|
curl -L $SOURCE_TARBALL | tar xz
|
||||||
|
mv Python-3.4.9 src
|
||||||
|
cd src
|
||||||
|
|
||||||
|
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
# Remove unneeded test directories, similar to the official Docker Python images:
|
||||||
|
# https://github.com/docker-library/python
|
||||||
|
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
|
||||||
|
|
||||||
|
# Remove spare /
|
||||||
|
LOCATION=${OUT_PREFIX%?}
|
||||||
|
|
||||||
|
ln $LOCATION/bin/python3 $LOCATION/bin/python
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build Path: /app/.heroku/python/
|
||||||
|
|
||||||
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
|
echo "Building Python…"
|
||||||
|
SOURCE_TARBALL='https://python.org/ftp/python/3.5.6/Python-3.5.6.tgz'
|
||||||
|
curl -L $SOURCE_TARBALL | tar xz
|
||||||
|
mv Python-3.5.6 src
|
||||||
|
cd src
|
||||||
|
|
||||||
|
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
# Remove unneeded test directories, similar to the official Docker Python images:
|
||||||
|
# https://github.com/docker-library/python
|
||||||
|
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
|
||||||
|
|
||||||
|
# Remove spare /
|
||||||
|
LOCATION=${OUT_PREFIX%?}
|
||||||
|
|
||||||
|
ln $LOCATION/bin/python3 $LOCATION/bin/python
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build Path: /app/.heroku/python/
|
||||||
|
|
||||||
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
|
echo "Building Python…"
|
||||||
|
SOURCE_TARBALL='https://python.org/ftp/python/3.5.7/Python-3.5.7.tgz'
|
||||||
|
curl -L $SOURCE_TARBALL | tar xz
|
||||||
|
mv Python-3.5.7 src
|
||||||
|
cd src
|
||||||
|
|
||||||
|
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
# Remove unneeded test directories, similar to the official Docker Python images:
|
||||||
|
# https://github.com/docker-library/python
|
||||||
|
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
|
||||||
|
|
||||||
|
# Remove spare /
|
||||||
|
LOCATION=${OUT_PREFIX%?}
|
||||||
|
|
||||||
|
ln $LOCATION/bin/python3 $LOCATION/bin/python
|
||||||
@@ -1,8 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Build Path: /app/.heroku/python/
|
# Build Path: /app/.heroku/python/
|
||||||
# Build Deps: libraries/sqlite
|
|
||||||
|
|
||||||
OUT_PREFIX=$1
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
echo "Building Python…"
|
echo "Building Python…"
|
||||||
SOURCE_TARBALL='https://python.org/ftp/python/3.6.6/Python-3.6.6.tgz'
|
SOURCE_TARBALL='https://python.org/ftp/python/3.6.6/Python-3.6.6.tgz'
|
||||||
|
|||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build Path: /app/.heroku/python/
|
||||||
|
|
||||||
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
|
echo "Building Python…"
|
||||||
|
SOURCE_TARBALL='https://python.org/ftp/python/3.6.7/Python-3.6.7.tgz'
|
||||||
|
curl -L $SOURCE_TARBALL | tar xz
|
||||||
|
mv Python-3.6.7 src
|
||||||
|
cd src
|
||||||
|
|
||||||
|
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
# Remove unneeded test directories, similar to the official Docker Python images:
|
||||||
|
# https://github.com/docker-library/python
|
||||||
|
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
|
||||||
|
|
||||||
|
# Remove spare /
|
||||||
|
LOCATION=${OUT_PREFIX%?}
|
||||||
|
|
||||||
|
ln $LOCATION/bin/python3 $LOCATION/bin/python
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build Path: /app/.heroku/python/
|
||||||
|
|
||||||
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
|
echo "Building Python…"
|
||||||
|
SOURCE_TARBALL='https://python.org/ftp/python/3.6.8/Python-3.6.8.tgz'
|
||||||
|
curl -L $SOURCE_TARBALL | tar xz
|
||||||
|
mv Python-3.6.8 src
|
||||||
|
cd src
|
||||||
|
|
||||||
|
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
# Remove unneeded test directories, similar to the official Docker Python images:
|
||||||
|
# https://github.com/docker-library/python
|
||||||
|
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
|
||||||
|
|
||||||
|
# Remove spare /
|
||||||
|
LOCATION=${OUT_PREFIX%?}
|
||||||
|
|
||||||
|
ln $LOCATION/bin/python3 $LOCATION/bin/python
|
||||||
@@ -1,8 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Build Path: /app/.heroku/python/
|
# Build Path: /app/.heroku/python/
|
||||||
# Build Deps: libraries/sqlite
|
|
||||||
|
|
||||||
OUT_PREFIX=$1
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
echo "Building Python…"
|
echo "Building Python…"
|
||||||
SOURCE_TARBALL='https://python.org/ftp/python/3.7.0/Python-3.7.0.tgz'
|
SOURCE_TARBALL='https://python.org/ftp/python/3.7.0/Python-3.7.0.tgz'
|
||||||
|
|||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build Path: /app/.heroku/python/
|
||||||
|
|
||||||
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
|
echo "Building Python…"
|
||||||
|
SOURCE_TARBALL='https://python.org/ftp/python/3.7.1/Python-3.7.1.tgz'
|
||||||
|
curl -L $SOURCE_TARBALL | tar xz
|
||||||
|
mv Python-3.7.1 src
|
||||||
|
cd src
|
||||||
|
|
||||||
|
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
# Remove unneeded test directories, similar to the official Docker Python images:
|
||||||
|
# https://github.com/docker-library/python
|
||||||
|
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
|
||||||
|
|
||||||
|
# Remove spare /
|
||||||
|
LOCATION=${OUT_PREFIX%?}
|
||||||
|
|
||||||
|
ln $LOCATION/bin/python3 $LOCATION/bin/python
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build Path: /app/.heroku/python/
|
||||||
|
|
||||||
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
|
echo "Building Python…"
|
||||||
|
SOURCE_TARBALL='https://python.org/ftp/python/3.7.2/Python-3.7.2.tgz'
|
||||||
|
curl -L $SOURCE_TARBALL | tar xz
|
||||||
|
mv Python-3.7.2 src
|
||||||
|
cd src
|
||||||
|
|
||||||
|
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
# Remove unneeded test directories, similar to the official Docker Python images:
|
||||||
|
# https://github.com/docker-library/python
|
||||||
|
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
|
||||||
|
|
||||||
|
# Remove spare /
|
||||||
|
LOCATION=${OUT_PREFIX%?}
|
||||||
|
|
||||||
|
ln $LOCATION/bin/python3 $LOCATION/bin/python
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build Path: /app/.heroku/python/
|
||||||
|
|
||||||
|
OUT_PREFIX=$1
|
||||||
|
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
|
||||||
|
export BIN_DIR
|
||||||
|
|
||||||
|
# shellcheck source=bin/utils
|
||||||
|
source "$BIN_DIR/steps/sqlite3"
|
||||||
|
|
||||||
|
sqlite3_version
|
||||||
|
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
|
||||||
|
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
|
||||||
|
|
||||||
|
echo "Building Python…"
|
||||||
|
SOURCE_TARBALL='https://python.org/ftp/python/3.7.3/Python-3.7.3.tgz'
|
||||||
|
curl -L $SOURCE_TARBALL | tar xz
|
||||||
|
mv Python-3.7.3 src
|
||||||
|
cd src
|
||||||
|
|
||||||
|
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
# Remove unneeded test directories, similar to the official Docker Python images:
|
||||||
|
# https://github.com/docker-library/python
|
||||||
|
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
|
||||||
|
|
||||||
|
# Remove spare /
|
||||||
|
LOCATION=${OUT_PREFIX%?}
|
||||||
|
|
||||||
|
ln $LOCATION/bin/python3 $LOCATION/bin/python
|
||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
sudo apt-get -qq update
|
||||||
|
sudo apt-get install software-properties-common
|
||||||
|
curl --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time 30 https://cli-assets.heroku.com/install-ubuntu.sh | sh
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BP_NAME=${1:-"heroku/python"}
|
||||||
|
|
||||||
|
curVersion=$(heroku buildpacks:versions "$BP_NAME" | awk 'FNR == 3 { print $1 }')
|
||||||
|
newVersion="v$((curVersion + 1))"
|
||||||
|
|
||||||
|
read -p "Deploy as version: $newVersion [y/n]? " choice
|
||||||
|
case "$choice" in
|
||||||
|
y|Y ) echo "";;
|
||||||
|
n|N ) exit 0;;
|
||||||
|
* ) exit 1;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
originMaster=$(git rev-parse origin/master)
|
||||||
|
echo "Tagging commit $originMaster with $newVersion... "
|
||||||
|
git tag "$newVersion" "${originMaster:?}"
|
||||||
|
git push origin refs/tags/$newVersion
|
||||||
|
|
||||||
|
heroku buildpacks:publish "$BP_NAME" "$newVersion"
|
||||||
|
|
||||||
|
if [ $(git tag | grep -q previous-version) ]; then
|
||||||
|
echo "Updating previous-version tag"
|
||||||
|
git tag -d previous-version
|
||||||
|
git push origin :previous-version
|
||||||
|
git tag previous-version latest-version
|
||||||
|
fi
|
||||||
|
if [ $(git tag | grep -q latest-version) ]; then
|
||||||
|
echo "Updating latest-version tag"
|
||||||
|
git tag -d latest-version
|
||||||
|
git push origin :latest-version
|
||||||
|
git tag latest-version "${originMaster:?}"
|
||||||
|
git push --tags
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Done."
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"python": [
|
||||||
|
"heroku/python-getting-started"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
- - "./repos/python/python-getting-started"
|
||||||
|
- f56b90499ec11e1c9576da2f8c7331300e189db3
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
docopt==0.6.2
|
docopt==0.6.2
|
||||||
bob-builder==0.0.13
|
bob-builder
|
||||||
boto==2.48.0
|
boto==2.48.0
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
require_relative '../spec_helper'
|
||||||
|
|
||||||
|
describe "Python!!!!!!!!!!!" do
|
||||||
|
it "🐍" do
|
||||||
|
Hatchet::Runner.new('python-getting-started', stack: DEFAULT_STACK).deploy do |app|
|
||||||
|
expect(app.output).to match(/Installing pip/)
|
||||||
|
expect(app.run('python -V')).to match(/3.6.8/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
ENV['HATCHET_BUILDPACK_BASE'] = 'https://github.com/' + ENV['TRAVIS_REPO_SLUG'] + '.git'
|
||||||
|
|
||||||
|
require 'rspec/core'
|
||||||
|
require 'rspec/retry'
|
||||||
|
require 'hatchet'
|
||||||
|
|
||||||
|
require 'date'
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.full_backtrace = true
|
||||||
|
config.verbose_retry = true # show retry status in spec process
|
||||||
|
config.default_retry_count = 2 if ENV['IS_RUNNING_ON_CI'] # retry all tests that fail again
|
||||||
|
config.expect_with :rspec do |c|
|
||||||
|
c.syntax = :expect
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ENV['TRAVIS']
|
||||||
|
# Don't execute tests against "merge" commits
|
||||||
|
exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master'
|
||||||
|
end
|
||||||
|
|
||||||
|
DEFAULT_STACK = 'heroku-16'
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
apache-airflow==1.10.2
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
python-2.7.13
|
python-3.6.6
|
||||||
|
|||||||
Vendored
+1
-1
@@ -6,4 +6,4 @@ verify_ssl = true
|
|||||||
requests = "*"
|
requests = "*"
|
||||||
|
|
||||||
[requires]
|
[requires]
|
||||||
python_version = "3.6"
|
python_version = "3.6"
|
||||||
|
|||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
[[source]]
|
||||||
|
url = "https://pypi.org/simple"
|
||||||
|
verify_ssl = true
|
||||||
|
name = "pypi"
|
||||||
|
|
||||||
|
[packages]
|
||||||
|
|
||||||
|
[dev-packages]
|
||||||
|
|
||||||
|
[requires]
|
||||||
|
python_version = "2.7"
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"_meta": {
|
||||||
|
"hash": {
|
||||||
|
"sha256": "ae4bdd7d4157baab65ae9d0e8389a6011e6b640995372c45ec81fa5d1ddfae9f"
|
||||||
|
},
|
||||||
|
"pipfile-spec": 6,
|
||||||
|
"requires": {
|
||||||
|
"python_version": "2.7"
|
||||||
|
},
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"name": "pypi",
|
||||||
|
"url": "https://pypi.org/simple",
|
||||||
|
"verify_ssl": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"default": {},
|
||||||
|
"develop": {}
|
||||||
|
}
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
python-2.7.15
|
python-2.7.16
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-2.7.99
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
requests
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-2.7.15
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
flask
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.4.9
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
flask
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.4.99
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
flask
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.4.0
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
requests
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.5.6
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
flask
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.5.99
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
flask
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.5.3
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
requests
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.6.8
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
flask
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.6.99
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
requests
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.6.7
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
requests
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.7.2
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
flask
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.7.99
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
requests
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.7.1
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
flask
|
||||||
@@ -1,5 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Default Python Versions
|
||||||
|
# shellcheck source=bin/default_pythons
|
||||||
|
source "bin/default_pythons"
|
||||||
|
|
||||||
|
testAirflow() {
|
||||||
|
export SLUGIFY_USES_TEXT_UNIDECODE="yes"
|
||||||
|
compile "airflow"
|
||||||
|
assertCaptured "apache-airflow==1.10.2"
|
||||||
|
assertCapturedSuccess
|
||||||
|
}
|
||||||
|
|
||||||
testPipenv() {
|
testPipenv() {
|
||||||
compile "pipenv"
|
compile "pipenv"
|
||||||
assertCapturedSuccess
|
assertCapturedSuccess
|
||||||
@@ -12,10 +23,15 @@ testPipenvLock() {
|
|||||||
|
|
||||||
testPipenvVersion() {
|
testPipenvVersion() {
|
||||||
compile "pipenv-version"
|
compile "pipenv-version"
|
||||||
assertCaptured "3.6.6"
|
assertCaptured $DEFAULT_PYTHON_VERSION
|
||||||
assertCapturedSuccess
|
assertCapturedSuccess
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testPipenvVersion2() {
|
||||||
|
compile "pipenv-version2"
|
||||||
|
assertCaptured $LATEST_27
|
||||||
|
assertCapturedSuccess
|
||||||
|
}
|
||||||
testPipenvFullVersion() {
|
testPipenvFullVersion() {
|
||||||
compile "pipenv-full-version"
|
compile "pipenv-full-version"
|
||||||
assertCaptured "3.6.3"
|
assertCaptured "3.6.3"
|
||||||
@@ -33,14 +49,20 @@ testCollectstatic() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testGEOS() {
|
testGEOS() {
|
||||||
BUILD_WITH_GEO_LIBRARIES=1 compile "geos"
|
export BUILD_WITH_GEO_LIBRARIES=1
|
||||||
|
compile "geos"
|
||||||
assertCaptured "geos"
|
assertCaptured "geos"
|
||||||
assertCapturedSuccess
|
assertCapturedSuccess
|
||||||
}
|
}
|
||||||
|
|
||||||
testNLTK() {
|
testNLTK() {
|
||||||
|
# NOTE: This is a RuntimeWarning emitted by Python 3's runpy.py script
|
||||||
|
# which is what is used when you call `python -m <module>`. This is due to
|
||||||
|
# how nltk imports things. It's not actually an error, but it would probably
|
||||||
|
# be bad to silence in Production.
|
||||||
|
export PYTHONWARNINGS="ignore::RuntimeWarning"
|
||||||
compile "nltk"
|
compile "nltk"
|
||||||
assertCaptured "Downloading NLTK packages: city_database stopwords"
|
assertCaptured "[nltk_data] Downloading package city_database" "STD_ERR"
|
||||||
assertCapturedSuccess
|
assertCapturedSuccess
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,18 +97,140 @@ testPylibmc() {
|
|||||||
assertCapturedSuccess
|
assertCapturedSuccess
|
||||||
}
|
}
|
||||||
|
|
||||||
testPython2() {
|
testPythonDefault() {
|
||||||
compile "python2"
|
updateVersion "pythonDefault" $DEFAULT_PYTHON_VERSION
|
||||||
assertCaptured "python-2.7.15"
|
compile "pythonDefault"
|
||||||
|
assertCaptured $DEFAULT_PYTHON_VERSION
|
||||||
|
assertNotCaptured "security update"
|
||||||
assertCapturedSuccess
|
assertCapturedSuccess
|
||||||
}
|
}
|
||||||
|
|
||||||
testPython3() {
|
testPython2() {
|
||||||
compile "python3"
|
updateVersion "python2" $LATEST_27
|
||||||
assertCaptured "python-3.6.6"
|
echo $LATEST_27 > "runtime.txt"
|
||||||
|
compile "python2"
|
||||||
|
assertCaptured $LATEST_27
|
||||||
|
assertNotCaptured "security update"
|
||||||
|
assertCapturedSuccess
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython2_warn() {
|
||||||
|
compile "python2_warn"
|
||||||
|
assertCaptured "python-2.7.15"
|
||||||
|
assertCaptured "security update!"
|
||||||
|
assertCapturedSuccess
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython2_fail() {
|
||||||
|
compile "python2_fail"
|
||||||
|
assertCaptured "Aborting"
|
||||||
|
assertCapturedError
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_4() {
|
||||||
|
if [[ $STACK != "cedar-14" ]]; then
|
||||||
|
updateVersion "python3_4" $LATEST_34
|
||||||
|
compile "python3_4"
|
||||||
|
assertCaptured $LATEST_34
|
||||||
|
assertNotCaptured "security update"
|
||||||
|
assertCapturedSuccess
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_4_warn() {
|
||||||
|
compile "python3_4_warn"
|
||||||
|
if [[ $STACK = "cedar-14" ]]; then
|
||||||
|
assertCaptured "python-3.4.0"
|
||||||
|
assertCaptured "security update!"
|
||||||
|
assertCapturedSuccess
|
||||||
|
else
|
||||||
|
assertCapturedError
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_4_fail() {
|
||||||
|
compile "python3_4_fail"
|
||||||
|
assertCaptured "Aborting"
|
||||||
|
assertCapturedError
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_5() {
|
||||||
|
if [[ $STACK != "cedar-14" ]]; then
|
||||||
|
updateVersion "python3_5" $LATEST_35
|
||||||
|
compile "python3_5"
|
||||||
|
assertCaptured $LATEST_35
|
||||||
|
assertNotCaptured "security update"
|
||||||
|
assertCapturedSuccess
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_5_warn() {
|
||||||
|
compile "python3_5_warn"
|
||||||
|
if [[ $STACK = "cedar-14" ]]; then
|
||||||
|
assertCaptured "python-3.5.3"
|
||||||
|
assertCaptured "security update!"
|
||||||
|
assertCapturedError
|
||||||
|
else
|
||||||
|
assertCapturedError
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_5_fail() {
|
||||||
|
compile "python3_5_fail"
|
||||||
|
assertCaptured "Aborting"
|
||||||
|
assertCapturedError
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_6() {
|
||||||
|
updateVersion "python3_6" $LATEST_36
|
||||||
|
compile "python3_6"
|
||||||
|
assertCaptured $LATEST_36
|
||||||
|
assertNotCaptured "security update"
|
||||||
assertCapturedSuccess
|
assertCapturedSuccess
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testPython3_6_warn() {
|
||||||
|
compile "python3_6_warn"
|
||||||
|
assertCaptured "python-3.6.7"
|
||||||
|
assertCaptured "security update!"
|
||||||
|
assertCapturedSuccess
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_6_fail() {
|
||||||
|
compile "python3_6_fail"
|
||||||
|
assertCaptured "Aborting"
|
||||||
|
assertCapturedError
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_7() {
|
||||||
|
updateVersion "python3_7" $LATEST_37
|
||||||
|
compile "python3_7"
|
||||||
|
if [[ $STACK = "cedar-14" ]]; then
|
||||||
|
assertCapturedError
|
||||||
|
else
|
||||||
|
assertNotCaptured "security update"
|
||||||
|
assertCaptured $LATEST_37
|
||||||
|
assertCapturedSuccess
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_7_warn() {
|
||||||
|
compile "python3_7_warn"
|
||||||
|
if [[ $STACK = "cedar-14" ]]; then
|
||||||
|
assertCapturedError
|
||||||
|
else
|
||||||
|
assertCaptured "python-3.7.1"
|
||||||
|
assertCaptured "security update!"
|
||||||
|
assertCapturedSuccess
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_7_fail() {
|
||||||
|
compile "python3_7_fail"
|
||||||
|
assertCaptured "Aborting"
|
||||||
|
assertCapturedError
|
||||||
|
}
|
||||||
|
|
||||||
testGitEgg() {
|
testGitEgg() {
|
||||||
compile "git-egg"
|
compile "git-egg"
|
||||||
assertCaptured "requests"
|
assertCaptured "requests"
|
||||||
|
|||||||
+8
-2
@@ -71,6 +71,11 @@ release()
|
|||||||
capture ${BUILDPACK_HOME}/bin/release ${BUILD_DIR}
|
capture ${BUILDPACK_HOME}/bin/release ${BUILD_DIR}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateVersion()
|
||||||
|
{
|
||||||
|
echo "$2" > "test/fixtures/${1}/runtime.txt"
|
||||||
|
}
|
||||||
|
|
||||||
assertCapturedEquals()
|
assertCapturedEquals()
|
||||||
{
|
{
|
||||||
assertEquals "$@" "$(cat ${STD_OUT})"
|
assertEquals "$@" "$(cat ${STD_OUT})"
|
||||||
@@ -83,7 +88,8 @@ assertCapturedNotEquals()
|
|||||||
|
|
||||||
assertCaptured()
|
assertCaptured()
|
||||||
{
|
{
|
||||||
assertFileContains "$@" "${STD_OUT}"
|
stdroute=${2:-STD_OUT}
|
||||||
|
assertFileContains "$1" "${!stdroute}"
|
||||||
}
|
}
|
||||||
|
|
||||||
assertNotCaptured()
|
assertNotCaptured()
|
||||||
@@ -94,7 +100,7 @@ assertNotCaptured()
|
|||||||
assertCapturedSuccess()
|
assertCapturedSuccess()
|
||||||
{
|
{
|
||||||
assertEquals "Captured exit code -" "0" "${RETURN}"
|
assertEquals "Captured exit code -" "0" "${RETURN}"
|
||||||
assertEquals "STD_ERR -" "" "$(cat ${STD_ERR})"
|
# assertEquals "STD_ERR -" "" "$(cat ${STD_ERR})"
|
||||||
|
|
||||||
if [ $RETURN -ne 0 -a -z "$(cat ${STD_ERR})" ]; then
|
if [ $RETURN -ne 0 -a -z "$(cat ${STD_ERR})" ]; then
|
||||||
# Failing exit code but stderr was empty. Display stdout to help debugging.
|
# Failing exit code but stderr was empty. Display stdout to help debugging.
|
||||||
|
|||||||
Reference in New Issue
Block a user