mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Compare commits
61 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 |
@@ -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
|
||||||
+35
-22
@@ -1,25 +1,38 @@
|
|||||||
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:
|
before_install:
|
||||||
- wget -c https://goo.gl/ZzKHFv -O - | tar -xvJ -C /tmp/
|
- wget -c https://goo.gl/ZzKHFv -O - | tar -xvJ -C /tmp/
|
||||||
- PATH="/tmp/shellcheck-latest:$PATH"
|
- PATH="/tmp/shellcheck-latest:$PATH"
|
||||||
script: make check
|
script: make check
|
||||||
|
- stage: Stack Unit Tests
|
||||||
- stage: "Stack Tests"
|
services: docker
|
||||||
services: docker
|
env: STACK=heroku-18
|
||||||
env: STACK=heroku-18
|
script: "./tests.sh"
|
||||||
script: ./tests.sh
|
- stage: Stack Unit Tests
|
||||||
|
services: docker
|
||||||
- stage: "Stack Tests"
|
env: STACK=heroku-16
|
||||||
services: docker
|
script: "./tests.sh"
|
||||||
env: STACK=heroku-16
|
- stage: Stack Unit Tests
|
||||||
script: ./tests.sh
|
services: docker
|
||||||
|
env: STACK=cedar-14
|
||||||
- stage: "Stack Tests"
|
script: "./tests.sh"
|
||||||
services: docker
|
- stage: Hatchet Integration
|
||||||
env: STACK=cedar-14
|
script: "bundle exec rspec"
|
||||||
script: ./tests.sh
|
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=
|
||||||
|
|||||||
+27
-5
@@ -1,22 +1,44 @@
|
|||||||
# Python Buildpack Changelog
|
# Python Buildpack Changelog
|
||||||
|
|
||||||
# 138
|
# 145 (2018-11-08)
|
||||||
|
|
||||||
|
Python 3.7.1, 3.6.7, 3.5.6 and 3.4.9 now available on all Heroku stacks.
|
||||||
|
|
||||||
|
# 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
|
Use stack image SQLite3 instead of vendoring
|
||||||
|
|
||||||
# 137
|
# 137 (2018-07-17)
|
||||||
|
|
||||||
Prevent 3.7.0 from appearing as unsupported in buildpack messaging.
|
Prevent 3.7.0 from appearing as unsupported in buildpack messaging.
|
||||||
|
|
||||||
# 136
|
# 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.
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
+13
-2
@@ -52,14 +52,25 @@ export VENDOR_URL
|
|||||||
DEFAULT_PYTHON_VERSION="python-3.6.6"
|
DEFAULT_PYTHON_VERSION="python-3.6.6"
|
||||||
LATEST_36="python-3.6.6"
|
LATEST_36="python-3.6.6"
|
||||||
LATEST_37="python-3.7.0"
|
LATEST_37="python-3.7.0"
|
||||||
LATEST_2="python-2.7.15"
|
LATEST_35="python-3.5.6"
|
||||||
|
LATEST_34="python-3.4.9"
|
||||||
|
LATEST_27="python-2.7.15"
|
||||||
|
|
||||||
|
# Supported Python Branches
|
||||||
|
PY37="python-3.7"
|
||||||
|
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_36 LATEST_37
|
export DEFAULT_PYTHON_VERSION DEFAULT_PYTHON_STACK PIP_UPDATE
|
||||||
|
export LATEST_27 LATEST_36 LATEST_37 LATEST_35 LATEST_34
|
||||||
|
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`.
|
||||||
|
|||||||
+16
-2
@@ -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
|
||||||
|
|||||||
+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
|
||||||
|
|||||||
+42
-15
@@ -7,24 +7,49 @@ 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
|
||||||
fi
|
# do things to alert the user of security release available
|
||||||
else
|
if [ "$PYTHON_VERSION" != "$LATEST_37" ]; then
|
||||||
if [[ $PYTHON_VERSION =~ ^python-3.7 ]] && [[ "$PYTHON_VERSION" != "$LATEST_37" ]]; then
|
puts-warn "$SECURITY_UPDATE" "$LATEST_37"
|
||||||
puts-warn "The latest version of Python 3.7 is $LATEST_37 (you are using $PYTHON_VERSION, which is unsupported)."
|
|
||||||
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_37)."
|
|
||||||
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
|
|
||||||
else
|
|
||||||
if [[ "$PYTHON_VERSION" != "$LATEST_36" ]]; then
|
|
||||||
puts-warn "The latest version of Python 3.6 is $LATEST_36 (you are using $PYTHON_VERSION, which is unsupported)."
|
|
||||||
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_36)."
|
|
||||||
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
|
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
|
||||||
fi
|
fi
|
||||||
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
|
||||||
|
else
|
||||||
|
puts-warn "Requested runtime ($PYTHON_VERSION) is not available for this stack ($STACK)."
|
||||||
|
puts-warn "Aborting. More info: https://devcenter.heroku.com/articles/python-support"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then
|
if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then
|
||||||
@@ -49,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"
|
||||||
|
|
||||||
@@ -71,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
|
||||||
|
|
||||||
|
|||||||
@@ -89,10 +89,9 @@ python3_check() {
|
|||||||
# Check if Python version needs to install SQLite3
|
# Check if Python version needs to install SQLite3
|
||||||
python_sqlite3_check() {
|
python_sqlite3_check() {
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
MIN_PYTHON_3="python-3.6.6"
|
MIN_PYTHON_3="python-3.5.6"
|
||||||
MIN_PYTHON_2="python-2.7.15"
|
MIN_PYTHON_2="python-2.7.15"
|
||||||
|
|
||||||
( python2_check "$VERSION" && version_gte "$VERSION" "$MIN_PYTHON_2" ) \
|
( python2_check "$VERSION" && version_gte "$VERSION" "$MIN_PYTHON_2" ) \
|
||||||
|| ( python3_check "$VERSION" && version_gte "$VERSION" "$MIN_PYTHON_3" ) \
|
|| ( python3_check "$VERSION" && version_gte "$VERSION" "$MIN_PYTHON_3" )
|
||||||
|| ( version_gte "$VERSION" "3.7.0" )
|
|
||||||
}
|
}
|
||||||
|
|||||||
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.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.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
+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,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.6/)
|
||||||
|
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
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-2.7.14
|
||||||
+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.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.3
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
requests
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.6.6
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
flask
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.6.7
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
requests
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.6.5
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
requests
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.7.0
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
flask
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
python-3.7.1
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
testAirflow() {
|
||||||
|
export SLUGIFY_USES_TEXT_UNIDECODE="yes"
|
||||||
|
compile "airflow"
|
||||||
|
assertCaptured "apache-airflow==1.10"
|
||||||
|
assertCapturedSuccess
|
||||||
|
}
|
||||||
|
|
||||||
testPipenv() {
|
testPipenv() {
|
||||||
compile "pipenv"
|
compile "pipenv"
|
||||||
assertCapturedSuccess
|
assertCapturedSuccess
|
||||||
@@ -80,27 +87,98 @@ testPylibmc() {
|
|||||||
assertCapturedSuccess
|
assertCapturedSuccess
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testPython2_warn() {
|
||||||
|
compile "python2_warn"
|
||||||
|
if [[ $STACK = "heroku-18" ]]; then
|
||||||
|
assertCapturedError
|
||||||
|
else
|
||||||
|
assertCaptured "python-2.7.14"
|
||||||
|
assertCaptured "security update!"
|
||||||
|
assertCapturedSuccess
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
testPython2() {
|
testPython2() {
|
||||||
if [[ "$STACK" == "heroku-16" ]] || [[ "$STACK" == "cedar-14" ]]; then
|
|
||||||
compile "python2"
|
compile "python2"
|
||||||
assertCaptured "python-2.7.15"
|
assertCaptured "python-2.7.15"
|
||||||
assertCapturedSuccess
|
assertCapturedSuccess
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
testNoPython2() {
|
# This fail
|
||||||
if [[ "$STACK" == "heroku-18" ]]; then
|
testPython3_4_warn() {
|
||||||
compile "python2"
|
compile "python3_4_warn"
|
||||||
|
if [[ $STACK = "cedar-14" ]]; then
|
||||||
|
assertCaptured "python-3.4.0"
|
||||||
|
assertCapturedSuccess
|
||||||
|
else
|
||||||
assertCapturedError
|
assertCapturedError
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
testPython3() {
|
# This fail
|
||||||
compile "python3"
|
testPython3_4() {
|
||||||
|
compile "python3_4"
|
||||||
|
assertCaptured "python-3.4.9"
|
||||||
|
assertCapturedError
|
||||||
|
}
|
||||||
|
|
||||||
|
# This fail
|
||||||
|
testPython3_5_warn() {
|
||||||
|
compile "python3_5_warn"
|
||||||
|
if [[ $STACK = "cedar-14" ]]; then
|
||||||
|
assertCaptured "python-3.5.3"
|
||||||
|
assertCaptured "security update!"
|
||||||
|
assertCapturedError
|
||||||
|
else
|
||||||
|
assertCapturedError
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# This will fail
|
||||||
|
testPython3_5() {
|
||||||
|
compile "python3_5"
|
||||||
|
assertCaptured "python-3.5.6"
|
||||||
|
assertCapturedError
|
||||||
|
}
|
||||||
|
|
||||||
|
# This will warn
|
||||||
|
testPython3_6_warn() {
|
||||||
|
compile "python3_6_warn"
|
||||||
|
assertCaptured "python-3.6.5"
|
||||||
|
assertCaptured "security update!"
|
||||||
|
assertCapturedSuccess
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_6() {
|
||||||
|
compile "python3_6"
|
||||||
assertCaptured "python-3.6.6"
|
assertCaptured "python-3.6.6"
|
||||||
assertCapturedSuccess
|
assertCapturedSuccess
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# This will fail
|
||||||
|
testPython3_6_7() {
|
||||||
|
compile "python3_6_7"
|
||||||
|
assertCaptured "python-3.6.7"
|
||||||
|
assertCapturedError
|
||||||
|
}
|
||||||
|
|
||||||
|
testPython3_7() {
|
||||||
|
compile "python3_7"
|
||||||
|
if [[ $STACK = "cedar-14" ]]; then
|
||||||
|
assertCapturedError
|
||||||
|
else
|
||||||
|
assertCaptured "python-3.7.0"
|
||||||
|
assertCapturedSuccess
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# This will fail
|
||||||
|
testPython3_7_1() {
|
||||||
|
compile "python3_7_1"
|
||||||
|
assertCaptured "python-3.7.1"
|
||||||
|
assertCapturedError
|
||||||
|
}
|
||||||
|
|
||||||
testGitEgg() {
|
testGitEgg() {
|
||||||
compile "git-egg"
|
compile "git-egg"
|
||||||
assertCaptured "requests"
|
assertCaptured "requests"
|
||||||
|
|||||||
Reference in New Issue
Block a user