mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Compare commits
56 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b87419166 | |||
| d832b7425e | |||
| 2991dce623 | |||
| ffd0bb57ee | |||
| 75870dd412 | |||
| 831d73e302 | |||
| 0cf2e2849d | |||
| 6ba8d47927 | |||
| af940b5390 | |||
| 819bc2da5b | |||
| 2dad2e73f3 | |||
| e550b32ea8 | |||
| 6af8d81086 | |||
| 0ed4089cb9 | |||
| f09191ec8b | |||
| aef7b65b95 | |||
| 5438aab121 | |||
| a259143c0b | |||
| 0896d6a0c4 | |||
| 39f2efe296 | |||
| d047f26ad4 | |||
| 998f996a32 | |||
| c620980e5a | |||
| 2983fcfbea | |||
| e3511e7202 | |||
| 692f040618 | |||
| 8645a965aa | |||
| 3a483865e8 | |||
| 6ea6a0ccaf | |||
| 6bc94eaf6e | |||
| 49e409cb64 | |||
| 2693de45c7 | |||
| 88f711b6e7 | |||
| a7976fc177 | |||
| 8a837a23e7 | |||
| f37597ad9d | |||
| 928a664544 | |||
| 9fb715ef1c | |||
| 3cff2e39fe | |||
| 653a5be104 | |||
| 67ade52e95 | |||
| ab3e365ff6 | |||
| 902672e934 | |||
| 6207b3506b | |||
| 5446d448fd | |||
| 366def6c16 | |||
| a84fc7a248 | |||
| e4aa40216b | |||
| 87d03e62d7 | |||
| 92b4f5e8aa | |||
| 19cd447b83 | |||
| 570182b6b7 | |||
| 0a6ed0de43 | |||
| 0b7a1fc14e | |||
| 2c69e3b98f | |||
| 4c9de740d2 |
@@ -0,0 +1,2 @@
|
||||
sudo: false
|
||||
script: exit 0
|
||||
@@ -1,5 +1,22 @@
|
||||
# Python Buildpack Changelog
|
||||
|
||||
## v82 (2016-08-22)
|
||||
|
||||
Update to library detection mechnisms (pip-pop).
|
||||
|
||||
- Updated setuptools to v25.5.0
|
||||
|
||||
## v81 (2016-06-28)
|
||||
|
||||
Updated default Python to 2.7.11.
|
||||
|
||||
- Updated setuptools to v8.1.2.
|
||||
- Updated pip to v23.1.0.
|
||||
|
||||
## v80 (2016-04-05)
|
||||
|
||||
Improved pip-pop compatibility with latest pip releases.
|
||||
|
||||
## v79 (2016-03-22)
|
||||
|
||||
Compatibility improvements with heroku-apt-buildpack.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-
|
||||
|
||||
# Heroku Buildpack: Python
|
||||

|
||||
|
||||
This is the official [Heroku buildpack](https://devcenter.heroku.com/articles/buildpacks) for Python apps, powered by [pip](https://pip.pypa.io/) and other excellent software.
|
||||
|
||||
@@ -20,12 +21,12 @@ Deploying a Python application couldn't be easier:
|
||||
$ git push heroku master
|
||||
...
|
||||
-----> Python app detected
|
||||
-----> Installing python-2.7.11
|
||||
-----> Installing python-2.7.12
|
||||
$ pip install -r requirements.txt
|
||||
Collecting requests (from -r requirements.txt (line 1))
|
||||
Downloading requests-2.9.1-py2.py3-none-any.whl (501kB)
|
||||
Downloading requests-2.10.0-py2.py3-none-any.whl (501kB)
|
||||
Installing collected packages: requests
|
||||
Successfully installed requests-2.9.1
|
||||
Successfully installed requests-2.10.0
|
||||
|
||||
-----> Discovering process types
|
||||
Procfile declares types -> (none)
|
||||
@@ -43,12 +44,12 @@ Specify a Python Runtime
|
||||
Specific versions of the Python runtime can be specified with a `runtime.txt` file:
|
||||
|
||||
$ cat runtime.txt
|
||||
python-3.5.1
|
||||
python-3.5.2
|
||||
|
||||
Runtime options include:
|
||||
|
||||
- `python-2.7.11`
|
||||
- `python-3.5.1`
|
||||
- `pypy-5.0.1` (unsupported, experimental)
|
||||
- `python-2.7.12`
|
||||
- `python-3.5.2`
|
||||
- `pypy-5.3.1` (unsupported, experimental)
|
||||
|
||||
Other [unsupported runtimes](https://github.com/heroku/heroku-buildpack-python/tree/master/builds/runtimes) are available as well. Use at your own risk.
|
||||
+4
-4
@@ -31,11 +31,11 @@ ENV_DIR=$3
|
||||
VIRTUALENV_LOC=".heroku/venv"
|
||||
LEGACY_TRIGGER="lib/python2.7"
|
||||
|
||||
DEFAULT_PYTHON_VERSION="python-2.7.11"
|
||||
DEFAULT_PYTHON_VERSION="python-2.7.12"
|
||||
DEFAULT_PYTHON_STACK="cedar-14"
|
||||
PYTHON_EXE="/app/.heroku/python/bin/python"
|
||||
PIP_VERSION="8.1.1"
|
||||
SETUPTOOLS_VERSION="20.3"
|
||||
PIP_VERSION="8.1.2"
|
||||
SETUPTOOLS_VERSION="25.2.0"
|
||||
|
||||
# Common Problem Warnings
|
||||
export WARNINGS_LOG=$(mktemp)
|
||||
@@ -56,7 +56,7 @@ export PATH=$PATH:$ROOT_DIR/vendor/pip-pop
|
||||
[ ! "$STACK" ] && STACK=$DEFAULT_PYTHON_STACK
|
||||
|
||||
# Sanitizing environment variables.
|
||||
unset GIT_DIR PYTHONHOME PYTHONPATH LD_LIBRARY_PATH LIBRARY_PATH
|
||||
unset GIT_DIR PYTHONHOME PYTHONPATH
|
||||
unset RECEIVE_DATA RUN_KEY BUILD_INFO DEPLOY LOG_TOKEN DYNO
|
||||
unset CYTOKINE_LOG_FILE GEM_PATH
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script serves as the Pylibmc build step of the
|
||||
# This script serves as the Cryptography build step of the
|
||||
# [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python)
|
||||
# compiler.
|
||||
#
|
||||
@@ -20,18 +20,16 @@ source $BIN_DIR/utils
|
||||
bpwatch start libffi_install
|
||||
|
||||
# If a package using cffi exists within requirements, use vendored libffi.
|
||||
if (pip-grep -s requirements.txt bcrypt cffi cryptography django[bcrypt] Django[bcrypt] pyOpenSSL PyOpenSSL requests[security] &> /dev/null) then
|
||||
if (pip-grep -s requirements.txt bcrypt cffi cryptography django[bcrypt] Django[bcrypt] PyNaCl pyOpenSSL PyOpenSSL requests[security] misaka &> /dev/null) then
|
||||
|
||||
if [ -d ".heroku/vendor/lib/libffi-3.1.1" ]; then
|
||||
export LIBFFI=$(pwd)/vendor
|
||||
else
|
||||
if [ ! -d ".heroku/vendor/lib/libffi-3.1" ]; then
|
||||
echo "-----> Noticed cffi. Bootstrapping libffi."
|
||||
mkdir -p .heroku/vendor
|
||||
# Download and extract libffi into target vendor directory.
|
||||
curl $VENDORED_LIBFFI -s | tar zxv -C .heroku/vendor &> /dev/null
|
||||
|
||||
export LIBFFI=$(pwd)/vendor
|
||||
fi
|
||||
|
||||
export LIBFFI=$(pwd)/vendor
|
||||
fi
|
||||
|
||||
bpwatch stop libffi_install
|
||||
|
||||
+3
-5
@@ -22,16 +22,14 @@ bpwatch start gdal_install
|
||||
# If GDAL exists within requirements, use vendored gdal.
|
||||
if (pip-grep -s requirements.txt GDAL gdal pygdal &> /dev/null) then
|
||||
|
||||
if [ -f ".heroku/vendor/bin/gdalserver" ]; then
|
||||
export GDAL=$(pwd)/vendor
|
||||
else
|
||||
if [ ! -f ".heroku/vendor/bin/gdalserver" ]; then
|
||||
echo "-----> Noticed GDAL. Bootstrapping gdal."
|
||||
mkdir -p .heroku/vendor
|
||||
# Download and extract cryptography into target vendor directory.
|
||||
curl $VENDORED_GDAL -s | tar zxv -C .heroku/vendor &> /dev/null
|
||||
|
||||
export GDAL=$(pwd)/vendor
|
||||
fi
|
||||
|
||||
export GDAL=$(pwd)/vendor
|
||||
fi
|
||||
|
||||
bpwatch stop gdal_install
|
||||
|
||||
+3
-5
@@ -24,18 +24,16 @@ bpwatch start geo_libs_install
|
||||
# If GDAL exists within requirements, use vendored gdal.
|
||||
if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then
|
||||
|
||||
if [ -f ".heroku/vendor/bin/gdalserver" ]; then
|
||||
export GDAL=$(pwd)/vendor
|
||||
else
|
||||
if [ ! -f ".heroku/vendor/bin/proj" ]; then
|
||||
echo "-----> Bootstrapping gdal, geos, proj."
|
||||
mkdir -p .heroku/vendor
|
||||
# Download and extract cryptography into target vendor directory.
|
||||
curl $VENDORED_GDAL -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
|
||||
|
||||
export GDAL=$(pwd)/vendor
|
||||
fi
|
||||
|
||||
export GDAL=$(pwd)/vendor
|
||||
fi
|
||||
|
||||
bpwatch stop geo_libs_install
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ if (grep -Fiq "hg+" requirements.txt) then
|
||||
bpwatch start mercurial_install
|
||||
/app/.heroku/python/bin/pip install mercurial | cleanup | indent
|
||||
bpwatch stop mercurial_install
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -15,4 +15,4 @@ if [[ -f .heroku/python/requirements-declared.txt ]]; then
|
||||
fi
|
||||
fi
|
||||
bpwatch stop pip_uninstall
|
||||
set -e
|
||||
set -e
|
||||
|
||||
+3
-5
@@ -21,16 +21,14 @@ bpwatch start pylibmc_install
|
||||
# If pylibmc exists within requirements, use vendored libmemcached.
|
||||
if (pip-grep -s requirements.txt pylibmc &> /dev/null) then
|
||||
|
||||
if [ -d ".heroku/vendor/lib/sasl2" ]; then
|
||||
export LIBMEMCACHED=$(pwd)/vendor
|
||||
else
|
||||
if [ ! -d ".heroku/vendor/lib/sasl2" ]; then
|
||||
echo "-----> Noticed pylibmc. Bootstrapping libmemcached."
|
||||
mkdir -p .heroku/vendor
|
||||
# Download and extract libmemcached into target vendor directory.
|
||||
curl $VENDORED_MEMCACHED -s | tar zxv -C .heroku/vendor &> /dev/null
|
||||
|
||||
export LIBMEMCACHED=$(pwd)/vendor
|
||||
fi
|
||||
|
||||
export LIBMEMCACHED=$(pwd)/vendor
|
||||
fi
|
||||
|
||||
bpwatch stop pylibmc_install
|
||||
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
# NOTICE: This formula only works for the cedar-14 stack, not cedar.
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building PyPy..."
|
||||
SOURCE_TARBALL='https://bitbucket.org/pypy/pypy/downloads/pypy-5.1.0-linux64.tar.bz2'
|
||||
curl -L $SOURCE_TARBALL | tar jx
|
||||
cp -R pypy-5.1.0-linux64/* $OUT_PREFIX
|
||||
|
||||
ln $OUT_PREFIX/bin/pypy $OUT_PREFIX/bin/python
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
# NOTICE: This formula only works for the cedar-14 stack, not cedar.
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building PyPy..."
|
||||
SOURCE_TARBALL='https://bitbucket.org/pypy/pypy/downloads/pypy-5.1.1-linux64.tar.bz2'
|
||||
curl -L $SOURCE_TARBALL | tar jx
|
||||
cp -R pypy-5.1.1-linux64/* $OUT_PREFIX
|
||||
|
||||
ln $OUT_PREFIX/bin/pypy $OUT_PREFIX/bin/python
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
# NOTICE: This formula only works for the cedar-14 stack, not cedar.
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building PyPy..."
|
||||
SOURCE_TARBALL='https://bbuseruploads.s3.amazonaws.com/54220cd1-b139-4188-9455-1e13e663f1ac/downloads/265504fc-8c03-4c1d-935a-2b8fbc6da51a/pypy2-v5.3.1-linux64.tar.bz2?Signature=F%2FnnB39QrCTPldSErIJoqzAt8YA%3D&Expires=1471612628&AWSAccessKeyId=AKIAIWY5XSVPZPDQYRQQ&versionId=kJjoDTh5eNcLrGrt5hYT0_5XGjg3.gl0&response-content-disposition=attachment%3B%20filename%3D%22pypy2-v5.3.1-linux64.tar.bz2%22'
|
||||
curl -L $SOURCE_TARBALL | tar jx
|
||||
cp -R pypy2-v5.3.1-linux64/* $OUT_PREFIX
|
||||
|
||||
ln $OUT_PREFIX/bin/pypy $OUT_PREFIX/bin/python
|
||||
@@ -5,9 +5,9 @@
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='https://www.python.org/ftp/python/2.7.11/Python-2.7.11rc1.tgz'
|
||||
SOURCE_TARBALL='https://python.org/ftp/python/2.7.12/Python-2.7.12.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.7.11rc1 src
|
||||
mv Python-2.7.12 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='https://python.org/ftp/python/3.5.2/Python-3.5.2.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.5.2 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
+10
-13
@@ -18,6 +18,7 @@ from pip._vendor.requests import session
|
||||
|
||||
requests = session()
|
||||
|
||||
|
||||
class Requirements(object):
|
||||
def __init__(self, reqfile=None):
|
||||
super(Requirements, self).__init__()
|
||||
@@ -31,13 +32,15 @@ class Requirements(object):
|
||||
return '<Requirements \'{}\'>'.format(self.path)
|
||||
|
||||
def load(self, reqfile):
|
||||
|
||||
if not os.path.exists(reqfile):
|
||||
raise ValueError('The given requirements file does not exist.')
|
||||
|
||||
finder = PackageFinder([], [], session=requests)
|
||||
for requirement in parse_requirements(reqfile, finder=finder, session=requests):
|
||||
if requirement.req:
|
||||
if not getattr(requirement.req, 'name', None):
|
||||
# Prior to pip 8.1.2 the attribute `name` did not exist.
|
||||
requirement.req.name = requirement.req.project_name
|
||||
self.requirements.append(requirement.req)
|
||||
|
||||
|
||||
@@ -48,24 +51,24 @@ class Requirements(object):
|
||||
|
||||
# Generate fresh packages.
|
||||
other_reqs = (
|
||||
[r.project_name for r in r1.requirements]
|
||||
[r.name for r in r1.requirements]
|
||||
if ignore_versions else r1.requirements
|
||||
)
|
||||
|
||||
for req in r2.requirements:
|
||||
r = req.project_name if ignore_versions else req
|
||||
r = req.name if ignore_versions else req
|
||||
|
||||
if r not in other_reqs and r not in excludes:
|
||||
results['fresh'].append(req)
|
||||
|
||||
# Generate stale packages.
|
||||
other_reqs = (
|
||||
[r.project_name for r in r2.requirements]
|
||||
[r.name for r in r2.requirements]
|
||||
if ignore_versions else r2.requirements
|
||||
)
|
||||
|
||||
for req in r1.requirements:
|
||||
r = req.project_name if ignore_versions else req
|
||||
r = req.name if ignore_versions else req
|
||||
|
||||
if r not in other_reqs and r not in excludes:
|
||||
results['stale'].append(req)
|
||||
@@ -73,11 +76,7 @@ class Requirements(object):
|
||||
return results
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def diff(r1, r2, include_fresh=False, include_stale=False, excludes=None):
|
||||
|
||||
include_versions = True if include_stale else False
|
||||
excludes = excludes if len(excludes) else []
|
||||
|
||||
@@ -92,12 +91,11 @@ def diff(r1, r2, include_fresh=False, include_stale=False, excludes=None):
|
||||
|
||||
if include_fresh:
|
||||
for line in results['fresh']:
|
||||
print(line.project_name if include_versions else line)
|
||||
print(line.name if include_versions else line)
|
||||
|
||||
if include_stale:
|
||||
for line in results['stale']:
|
||||
print(line.project_name if include_versions else line)
|
||||
|
||||
print(line.name if include_versions else line)
|
||||
|
||||
|
||||
def main():
|
||||
@@ -114,6 +112,5 @@ def main():
|
||||
diff(**kwargs)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Vendored
+12
-20
@@ -15,6 +15,7 @@ from pip._vendor.requests import session
|
||||
|
||||
requests = session()
|
||||
|
||||
|
||||
class Requirements(object):
|
||||
def __init__(self, reqfile=None):
|
||||
super(Requirements, self).__init__()
|
||||
@@ -28,41 +29,34 @@ class Requirements(object):
|
||||
return '<Requirements \'{}\'>'.format(self.path)
|
||||
|
||||
def load(self, reqfile):
|
||||
|
||||
if not os.path.exists(reqfile):
|
||||
raise ValueError('The given requirements file does not exist.')
|
||||
|
||||
finder = PackageFinder([], [], session=requests)
|
||||
for requirement in parse_requirements(reqfile, finder=finder, session=requests):
|
||||
self.requirements.append(requirement)
|
||||
|
||||
|
||||
if requirement.req:
|
||||
if not getattr(requirement.req, 'name', None):
|
||||
# Prior to pip 8.1.2 the attribute `name` did not exist.
|
||||
requirement.req.name = requirement.req.project_name
|
||||
self.requirements.append(requirement.req)
|
||||
|
||||
|
||||
def grep(reqfile, packages, silent=False):
|
||||
|
||||
try:
|
||||
r = Requirements(reqfile)
|
||||
except ValueError:
|
||||
|
||||
if not silent:
|
||||
print('There was a problem loading the given requirement file.')
|
||||
|
||||
exit(os.EX_NOINPUT)
|
||||
|
||||
for requirement in r.requirements:
|
||||
|
||||
if requirement.req:
|
||||
|
||||
if requirement.req.project_name in packages:
|
||||
|
||||
if not silent:
|
||||
print('Package {} found!'.format(requirement.req.project_name))
|
||||
|
||||
exit(0)
|
||||
for req in r.requirements:
|
||||
if req.name in packages:
|
||||
if not silent:
|
||||
print('Package {} found!'.format(req.name))
|
||||
exit(0)
|
||||
|
||||
if not silent:
|
||||
print('Not found.'.format(requirement.req.project_name))
|
||||
print('Not found.')
|
||||
|
||||
exit(1)
|
||||
|
||||
@@ -72,10 +66,8 @@ def main():
|
||||
|
||||
kwargs = {'reqfile': args['<reqfile>'], 'packages': args['<package>'], 'silent': args['-s']}
|
||||
|
||||
|
||||
grep(**kwargs)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Reference in New Issue
Block a user