Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into merge-upstream-94…
Browse files Browse the repository at this point in the history
…986024

[#94986024]

Signed-off-by: Colin Jackson <[email protected]>
  • Loading branch information
Anthony Emengo authored and crawsible committed May 20, 2015
2 parents 789e72f + 7fd3a04 commit 45edbe9
Show file tree
Hide file tree
Showing 14 changed files with 121 additions and 22 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@

tests:
./bin/test

tools:
git clone https://github.com/kennethreitz/pip-pop.git
mv pip-pop/bin/* vendor/pip-pop/
rm -fr pip-pop
26 changes: 15 additions & 11 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ WEBCONCURRENCY_PROFILE_PATH="$BUILD_DIR/.profile.d/python.webconcurrency.sh"
DEFAULT_PYTHON_VERSION="python-2.7.9"
DEFAULT_PYTHON_STACK="cedar"
PYTHON_EXE="/app/.heroku/python/bin/python"
PIP_VERSION="6.0.8"
SETUPTOOLS_VERSION="11.3.1"
PIP_VERSION="6.1.1"
SETUPTOOLS_VERSION="15.2"

# Setup bpwatch
export PATH=$PATH:$ROOT_DIR/vendor/bpwatch
Expand Down Expand Up @@ -86,12 +86,12 @@ TMP_APP_DIR=$CACHE_DIR/tmp_app_dir

# Copy Anvil app dir to temporary storage...
bpwatch start anvil_appdir_stage
if [ "$SLUG_ID" ]; then
mkdir -p $TMP_APP_DIR
deep-mv $APP_DIR $TMP_APP_DIR
else
deep-rm $APP_DIR
fi
if [ "$SLUG_ID" ]; then
mkdir -p $TMP_APP_DIR
deep-mv $APP_DIR $TMP_APP_DIR
else
deep-rm $APP_DIR
fi
bpwatch stop anvil_appdir_stage

# Copy Application code in.
Expand Down Expand Up @@ -126,6 +126,7 @@ if [ ! -f requirements.txt ]; then
echo "-e ." > requirements.txt
fi


# Sticky runtimes.
if [ -f $CACHE_DIR/.heroku/python-version ]; then
DEFAULT_PYTHON_VERSION=$(cat $CACHE_DIR/.heroku/python-version)
Expand Down Expand Up @@ -194,6 +195,9 @@ source $BIN_DIR/steps/pylibmc
# Libffi support.
source $BIN_DIR/steps/cryptography

# GDAL support.
source $BIN_DIR/steps/gdal

# Install dependencies with Pip.
source $BIN_DIR/steps/pip-install

Expand Down Expand Up @@ -238,9 +242,9 @@ bpwatch start appdir_commit
bpwatch stop appdir_commit

bpwatch start anvil_appdir_commit
if [ "$SLUG_ID" ]; then
deep-mv $TMP_APP_DIR $APP_DIR
fi
if [ "$SLUG_ID" ]; then
deep-mv $TMP_APP_DIR $APP_DIR
fi

bpwatch stop anvil_appdir_commit
bpwatch stop compile
Expand Down
2 changes: 1 addition & 1 deletion bin/steps/collectstatic
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source $BIN_DIR/utils

MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1)
MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' -printf '%d\t%P\n' | sort -nk1 | cut -f2 | head -1)
MANAGE_FILE=${MANAGE_FILE:-fakepath}

[ -f .heroku/collectstatic_disabled ] && DISABLE_COLLECTSTATIC=1
Expand Down
2 changes: 1 addition & 1 deletion bin/steps/cryptography
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ source $BIN_DIR/utils
bpwatch start libffi_install

# If pylibmc exists within requirements, use vendored cryptography.
if (pip-grep -s requirements.txt bcrypt cffi cryptography PyOpenSSL &> /dev/null) then
if (pip-grep -s requirements.txt bcrypt cffi cryptography pyOpenSSL PyOpenSSL &> /dev/null) then

if [ -d ".heroku/vendor/lib/libffi-3.1.1" ]; then
export LIBFFI=$(pwd)/vendor
Expand Down
37 changes: 37 additions & 0 deletions bin/steps/gdal
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

# This script serves as the GDAL build step of the
# [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python)
# compiler.
#
# A [buildpack](http://devcenter.heroku.com/articles/buildpacks) is an
# adapter between a Python application and Heroku's runtime.
#
# This script is invoked by [`bin/compile`](/).

# The location of the pre-compiled cryptography binary.
VENDORED_GDAL="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/gdal.tar.gz"

PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"

# Syntax sugar.
source $BIN_DIR/utils

bpwatch start gdal_install

# If GDAL exists within requirements, use vendored gdal.
if (pip-grep -s requirements.txt GDAL &> /dev/null) then

if [ -f ".heroku/vendor/bin/gdalserver" ]; then
export GDAL=$(pwd)/vendor
else
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
fi

bpwatch stop gdal_install
2 changes: 1 addition & 1 deletion bin/steps/pip-uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [[ -f .heroku/python/requirements-declared.txt ]]; then

cp .heroku/python/requirements-declared.txt requirements-declared.txt

pip-diff --stale requirements-declared.txt requirements.txt > .heroku/python/requirements-stale.txt
pip-diff --stale requirements-declared.txt requirements.txt --exclude setuptools pip > .heroku/python/requirements-stale.txt

rm -fr requirements-declared.txt

Expand Down
2 changes: 1 addition & 1 deletion bin/utils
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set-default-env() {
echo "export $1=\${$1:-$2}" >> $PROFILE_PATH
}

# Usage: $ set-default-env key value
# Usage: $ un-set-env key
un-set-env() {
echo "unset $1" >> $PROFILE_PATH
}
Expand Down
23 changes: 23 additions & 0 deletions builds/libraries/vendor/gdal
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/vendor/

OUT_PREFIX=$1

# Use new path, containing autoconf.
export PATH="/app/.heroku/python/bin/:$PATH"
hash -r


echo "Building gdal..."

SOURCE_TARBALL='http://download.osgeo.org/gdal/1.11.0/gdal-1.11.0.tar.gz'

curl -L $SOURCE_TARBALL | tar zx

cd gdal-1.11.0
./configure --prefix=$OUT_PREFIX &&
make
make install

# Cleanup
cd ..
14 changes: 14 additions & 0 deletions builds/runtimes/pypy-2.5.0
Original file line number Diff line number Diff line change
@@ -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-2.5.0-linux64.tar.bz2'
curl -L $SOURCE_TARBALL | tar jx
cp -R pypy-2.5.0-linux64/* $OUT_PREFIX

ln $OUT_PREFIX/bin/pypy $OUT_PREFIX/bin/python
14 changes: 14 additions & 0 deletions builds/runtimes/pypy-2.5.1
Original file line number Diff line number Diff line change
@@ -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-2.5.1-linux64.tar.bz2'
curl -L $SOURCE_TARBALL | tar jx
cp -R pypy-2.5.1-linux64/* $OUT_PREFIX

ln $OUT_PREFIX/bin/pypy $OUT_PREFIX/bin/python
Binary file added vendor/pip-6.1.1.tar.gz
Binary file not shown.
16 changes: 9 additions & 7 deletions vendor/pip-pop/pip-diff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

"""Usage:
pip-diff (--fresh | --stale) <reqfile1> <reqfile2>
pip-diff (--fresh | --stale) <reqfile1> <reqfile2> [--exclude <package>...]
pip-diff (-h | --help)
Options:
Expand Down Expand Up @@ -41,7 +41,7 @@ class Requirements(object):
self.requirements.append(requirement.req)


def diff(self, requirements, ignore_versions=False):
def diff(self, requirements, ignore_versions=False, excludes=None):
r1 = self
r2 = requirements
results = {'fresh': [], 'stale': []}
Expand All @@ -55,7 +55,7 @@ class Requirements(object):
for req in r2.requirements:
r = req.project_name if ignore_versions else req

if r not in other_reqs:
if r not in other_reqs and r not in excludes:
results['fresh'].append(req)

# Generate stale packages.
Expand All @@ -67,7 +67,7 @@ class Requirements(object):
for req in r1.requirements:
r = req.project_name if ignore_versions else req

if r not in other_reqs:
if r not in other_reqs and r not in excludes:
results['stale'].append(req)

return results
Expand All @@ -76,9 +76,10 @@ class Requirements(object):



def diff(r1, r2, include_fresh=False, include_stale=False):
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 []

try:
r1 = Requirements(r1)
Expand All @@ -87,7 +88,7 @@ def diff(r1, r2, include_fresh=False, include_stale=False):
print('There was a problem loading the given requirements files.')
exit(os.EX_NOINPUT)

results = r1.diff(r2, ignore_versions=True)
results = r1.diff(r2, ignore_versions=True, excludes=excludes)

if include_fresh:
for line in results['fresh']:
Expand All @@ -106,7 +107,8 @@ def main():
'r1': args['<reqfile1>'],
'r2': args['<reqfile2>'],
'include_fresh': args['--fresh'],
'include_stale': args['--stale']
'include_stale': args['--stale'],
'excludes': args['<package>']
}

diff(**kwargs)
Expand Down
Binary file removed vendor/setuptools-11.3.1.tar.gz
Binary file not shown.
Binary file added vendor/setuptools-15.2.tar.gz
Binary file not shown.

0 comments on commit 45edbe9

Please sign in to comment.