Compare commits

...

31 Commits

Author SHA1 Message Date
Kenneth Reitz e2e97b774a Merge remote-tracking branch 'origin/master' 2014-08-21 14:33:06 -04:00
Kenneth Reitz 4f0f97959f package finder update for pip-pop 2014-08-21 14:33:02 -04:00
kennethreitz 93f4eeb227 Merge pull request #162 from cclauss/patch-6
Updated pypy to 2.3.1 and added pypy3
2014-08-19 12:49:28 -04:00
cclauss ec769e00bb Update Readme.md 2014-08-12 22:12:02 +02:00
cclauss ade975d48f Update Readme.md 2014-08-09 08:33:40 +02:00
Kenneth Reitz 16a07abd51 fix for libmemcached & cedar-14 2014-08-06 17:10:23 -04:00
Kenneth Reitz 2bc071b323 python 3 compatibility 2014-08-05 13:33:12 -04:00
cclauss 3c07ec133e Updated pypy to 2.3.1 and added pypy3
Both are marked (unsupported, experimental).
2014-08-05 14:46:28 +02:00
Kenneth Reitz 5c74244695 fix for cryptography detection 2014-08-04 13:11:05 -04:00
Kenneth Reitz 4e877e4f11 conanical source tarball 2014-08-04 12:11:29 -04:00
Kenneth Reitz 51ec7e3741 attempt of libffi 2014-08-01 21:19:44 -04:00
Kenneth Reitz 1f983fea40 libffi for cedar attempt 2014-08-01 21:12:30 -04:00
Kenneth Reitz a26f0374ec setuptools sanity check 2014-08-01 18:16:54 -04:00
Kenneth Reitz a0029a8411 suppress pip-grep errors 2014-08-01 18:10:15 -04:00
Kenneth Reitz 2de3b6cf1c remove debug statement 2014-08-01 18:04:46 -04:00
Kenneth Reitz fd19ec2c6a support for cryptography! 2014-08-01 18:00:49 -04:00
Kenneth Reitz 6aec3ed37a pylibmc 2014-08-01 17:56:44 -04:00
Kenneth Reitz 7f7f0f7e3d actual libffi support! 2014-08-01 17:37:26 -04:00
Kenneth Reitz dd210c9002 libffi support? 2014-08-01 17:32:17 -04:00
Kenneth Reitz 2ae4bd156f vendor dir for libffi 2014-08-01 16:58:17 -04:00
Kenneth Reitz 8740fcdbad bugfix! 2014-08-01 16:49:08 -04:00
Kenneth Reitz fb18948243 Merge branch 'master' into pylibmc 2014-08-01 16:40:39 -04:00
Kenneth Reitz e104d36785 sub-env 2014-08-01 16:37:00 -04:00
Kenneth Reitz 1786231a49 move requirements to home directory first. 2014-08-01 16:34:53 -04:00
Kenneth Reitz fa8e09ae9c debug 2014-08-01 16:05:57 -04:00
Kenneth Reitz 2dd212d020 silence untar 2014-08-01 16:03:45 -04:00
Kenneth Reitz 15acd305d1 mkdir -p 2014-08-01 16:02:32 -04:00
Kenneth Reitz 5a65a39c5e sub-env, not source 2014-08-01 15:57:24 -04:00
Kenneth Reitz f18754f8f0 pylibmc attempt 2014-08-01 15:46:14 -04:00
Kenneth Reitz e860234d05 fix for pip-grep 2014-08-01 15:15:37 -04:00
Kenneth Reitz 50d61d2935 moving things around 2014-08-01 15:12:19 -04:00
12 changed files with 159 additions and 32 deletions
+2 -1
View File
@@ -46,6 +46,7 @@ Runtime options include:
- python-2.7.8 - python-2.7.8
- python-3.4.1 - python-3.4.1
- pypy-1.9 (experimental) - pypy-2.3.1 (unsupported, experimental)
- pypy3-2.3.1 (unsupported, experimental)
Other [unsupported runtimes](https://github.com/heroku/heroku-buildpack-python/tree/master/builds/runtimes) are available as well. Other [unsupported runtimes](https://github.com/heroku/heroku-buildpack-python/tree/master/builds/runtimes) are available as well.
+7 -1
View File
@@ -150,6 +150,9 @@ mkdir -p $(dirname $PROFILE_PATH)
# Install Python. # Install Python.
source $BIN_DIR/steps/python source $BIN_DIR/steps/python
# Sanity check for setuptools/distribute.
source $BIN_DIR/steps/setuptools
# Uninstall removed dependencies with Pip. # Uninstall removed dependencies with Pip.
source $BIN_DIR/steps/pip-uninstall source $BIN_DIR/steps/pip-uninstall
@@ -159,11 +162,14 @@ source $BIN_DIR/steps/mercurial
# Pylibmc support. # Pylibmc support.
source $BIN_DIR/steps/pylibmc source $BIN_DIR/steps/pylibmc
# Libffi support.
source $BIN_DIR/steps/cryptography
# Install dependencies with Pip. # Install dependencies with Pip.
source $BIN_DIR/steps/pip-install source $BIN_DIR/steps/pip-install
# Django collectstatic support. # Django collectstatic support.
source $BIN_DIR/steps/collectstatic sub-env $BIN_DIR/steps/collectstatic
# ### Finalize # ### Finalize
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# This script serves as the Pylibmc 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_LIBFFI="http://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/libffi.tar.gz"
PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"
# Syntax sugar.
source $BIN_DIR/utils
bpwatch start libffi_install
# If pylibmc exists within requirements, use vendored cryptography.
if (pip-grep -s requirements.txt cffi crytography &> /dev/null) then
if [ -d ".heroku/vendor/lib/libffi-3.1.1" ]; then
export LIBFFI=$(pwd)/vendor
else
echo "-----> Noticed cffi. Bootstrapping libffi."
mkdir -p .heroku/vendor
# Download and extract cryptography into target vendor directory.
curl $VENDORED_LIBFFI -s | tar zxv -C .heroku/vendor &> /dev/null
export LIBFFI=$(pwd)/vendor
fi
fi
bpwatch stop libffi_install
+5 -1
View File
@@ -3,7 +3,11 @@ set +e
bpwatch start pip_uninstall bpwatch start pip_uninstall
if [[ -f .heroku/python/requirements-declared.txt ]]; then if [[ -f .heroku/python/requirements-declared.txt ]]; then
pip-diff --stale .heroku/python/requirements-declared.txt requirements.txt > .heroku/python/requirements-stale.txt cp .heroku/python/requirements-declared.txt requirements-declared.txt
pip-diff --stale requirements-declared.txt requirements.txt > .heroku/python/requirements-stale.txt
rm -fr requirements-declared.txt
if [[ -s .heroku/python/requirements-stale.txt ]]; then if [[ -s .heroku/python/requirements-stale.txt ]]; then
puts-step "Uninstalling stale dependencies" puts-step "Uninstalling stale dependencies"
+8 -11
View File
@@ -10,30 +10,27 @@
# This script is invoked by [`bin/compile`](/). # This script is invoked by [`bin/compile`](/).
# The location of the pre-compiled libmemcached binary. # The location of the pre-compiled libmemcached binary.
VENDORED_MEMCACHED="http://cl.ly/0a191R3K160t1w1P0N25/vendor-libmemcached.tar.gz" VENDORED_MEMCACHED="http://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/libmemcache.tar.gz"
# Syntax sugar. # Syntax sugar.
source $BIN_DIR/utils source $BIN_DIR/utils
bpwatch start pylibmc_install bpwatch start pylibmc_install
# If pylibmc exists within requirements, use vendored libmemcached. # If pylibmc exists within requirements, use vendored libmemcached.
if (pip-grep -s requirements.txt pylibmc) then if (pip-grep -s requirements.txt pylibmc &> /dev/null) then
echo "-----> Noticed pylibmc. Bootstrapping libmemcached."
cd .heroku
if [ -d "vendor/lib/sasl2" ]; then if [ -d ".heroku/vendor/lib/sasl2" ]; then
export LIBMEMCACHED=$(pwd)/vendor export LIBMEMCACHED=$(pwd)/vendor
else else
echo "-----> Noticed pylibmc. Bootstrapping libmemcached."
mkdir -p .heroku/vendor
# Download and extract libmemcached into target vendor directory. # Download and extract libmemcached into target vendor directory.
curl -s -L -o tmp-libmemcached.tar.gz $VENDORED_MEMCACHED curl $VENDORED_MEMCACHED -s | tar zxv -C .heroku/vendor &> /dev/null
tar -zxvf tmp-libmemcached.tar.gz > /dev/null
rm tmp-libmemcached.tar.gz
export LIBMEMCACHED=$(pwd)/vendor export LIBMEMCACHED=$(pwd)/vendor
fi fi
export LIBMEMCACHED=$(pwd)/vendor
cd ..
fi fi
bpwatch stop pylibmc_install bpwatch stop pylibmc_install
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Syntax sugar.
source $BIN_DIR/utils
if (pip-grep -s requirements.txt setuptools distribute &> /dev/null) then
puts-warn 'The package setuptools/distribute is listed in requirements.txt.'
puts-warn 'Please remove to ensure expected behavior. '
fi
+4 -7
View File
@@ -1,6 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build Path: /app/.heroku/python/ # Build Path: /app/.heroku/python/
# Build Deps: libraries/autoconf
OUT_PREFIX=$1 OUT_PREFIX=$1
@@ -11,14 +10,12 @@ hash -r
echo "Building libffi..." echo "Building libffi..."
SOURCE_TARBALL='https://github.com/atgreen/libffi/archive/master.tar.gz' SOURCE_TARBALL='http://cl.ly/2s1t1u3v0N0I/download/libffi-3.1.tar'
curl -L $SOURCE_TARBALL | tar xz curl -L $SOURCE_TARBALL | tar x
mv libffi-master libffi
cd libffi cd libffi-3.1
./autogen.sh ./configure --prefix=$OUT_PREFIX --disable-static &&
./configure --prefix=$OUT_PREFIX --enable-shared
make make
make install make install
+23
View File
@@ -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 libffi..."
SOURCE_TARBALL='ftp://sourceware.org/pub/libffi/libffi-3.1.tar.gz'
curl -L $SOURCE_TARBALL | tar x
cd libffi-3.1
./configure --prefix=$OUT_PREFIX --disable-static &&
make
make install
# Cleanup
cd ..
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/vendor/
OUT_PREFIX=$1
# fail hard
set -o pipefail
# fail harder
set -eux
DEFAULT_VERSION="1.0.18"
dep_version=${VERSION:-$DEFAULT_VERSION}
dep_dirname=libmemcached-${dep_version}
dep_archive_name=${dep_dirname}.tar.gz
dep_url=https://launchpad.net/libmemcached/1.0/${dep_version}/+download/${dep_archive_name}
# SASL Support.
echo "-----> Building cyrus-sasl 2.1.26..."
curl -LO ftp://ftp.cyrusimap.org/cyrus-sasl/cyrus-sasl-2.1.26.tar.gz
# FTP doesn't play well with piping into tar xz
tar xzf cyrus-sasl-2.1.26.tar.gz
pushd cyrus-sasl-2.1.26
./configure --prefix=${OUT_PREFIX} --with-plugindir=${OUT_PREFIX}lib/sasl2 --with-configdir=${OUT_PREFIX}lib/sasl2
make -s -j 9
make install -s
popd
echo "-----> Building libmemcached ${dep_version}..."
curl -L ${dep_url} | tar xz
pushd ${dep_dirname}
CPPFLAGS=-I${OUT_PREFIX}/include LDFLAGS=-L${OUT_PREFIX}/lib ./configure --prefix=${OUT_PREFIX} --without-memcached
make -s -j 9
make install -s
popd
echo "-----> Done."
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build Path: /app/.heroku/python/ # Build Path: /app/.heroku/python/
# Build Deps: libraries/sqlite # Build Deps: libraries/sqlite, libraries/libffi
# NOTICE: This formula only works for the cedar-14 stack, not cedar. # NOTICE: This formula only works for the cedar-14 stack, not cedar.
+7 -5
View File
@@ -13,6 +13,7 @@ Options:
import os import os
from docopt import docopt from docopt import docopt
from pip.req import parse_requirements from pip.req import parse_requirements
from pip.index import PackageFinder
class Requirements(object): class Requirements(object):
def __init__(self, reqfile=None): def __init__(self, reqfile=None):
@@ -31,7 +32,8 @@ class Requirements(object):
if not os.path.exists(reqfile): if not os.path.exists(reqfile):
raise ValueError('The given requirements file does not exist.') raise ValueError('The given requirements file does not exist.')
for requirement in parse_requirements(reqfile): finder = PackageFinder([], [])
for requirement in parse_requirements(reqfile, finder=finder):
if requirement.req: if requirement.req:
self.requirements.append(requirement.req) self.requirements.append(requirement.req)
@@ -79,18 +81,18 @@ def diff(r1, r2, include_fresh=False, include_stale=False):
r1 = Requirements(r1) r1 = Requirements(r1)
r2 = Requirements(r2) r2 = Requirements(r2)
except ValueError: except ValueError:
print 'There was a problem loading the given requirements files.' print('There was a problem loading the given requirements files.')
exit(os.EX_NOINPUT) exit(os.EX_NOINPUT)
results = r1.diff(r2, ignore_versions=True) results = r1.diff(r2, ignore_versions=True)
if include_fresh: if include_fresh:
for line in results['fresh']: for line in results['fresh']:
print line.project_name if include_versions else line print(line.project_name if include_versions else line)
if include_stale: if include_stale:
for line in results['stale']: for line in results['stale']:
print line.project_name if include_versions else line print(line.project_name if include_versions else line)
@@ -109,4 +111,4 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
main() main()
+14 -5
View File
@@ -10,6 +10,8 @@ Options:
import os import os
from docopt import docopt from docopt import docopt
from pip.req import parse_requirements from pip.req import parse_requirements
from pip.index import PackageFinder
class Requirements(object): class Requirements(object):
def __init__(self, reqfile=None): def __init__(self, reqfile=None):
@@ -28,7 +30,8 @@ class Requirements(object):
if not os.path.exists(reqfile): if not os.path.exists(reqfile):
raise ValueError('The given requirements file does not exist.') raise ValueError('The given requirements file does not exist.')
for requirement in parse_requirements(reqfile): finder = PackageFinder([], [])
for requirement in parse_requirements(reqfile, finder=finder):
self.requirements.append(requirement) self.requirements.append(requirement)
@@ -39,8 +42,10 @@ def grep(reqfile, packages, silent=False):
try: try:
r = Requirements(reqfile) r = Requirements(reqfile)
except ValueError: except ValueError:
if not silent: if not silent:
print 'There was a problem loading the given requirement file.' print('There was a problem loading the given requirement file.')
exit(os.EX_NOINPUT) exit(os.EX_NOINPUT)
for requirement in r.requirements: for requirement in r.requirements:
@@ -48,11 +53,15 @@ def grep(reqfile, packages, silent=False):
if requirement.req: if requirement.req:
if requirement.req.project_name in packages: if requirement.req.project_name in packages:
if not silent: if not silent:
print 'Package {} found!'.format(requirement.req.project_name) print('Package {} found!'.format(requirement.req.project_name))
exit(0) exit(0)
print 'Not found.'.format(requirement.req.project_name) if not silent:
print('Not found.'.format(requirement.req.project_name))
exit(1) exit(1)
@@ -67,4 +76,4 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
main() main()