diff options
author | Donald Stufft <donald@stufft.io> | 2014-12-13 21:13:51 -0500 |
---|---|---|
committer | Donald Stufft <donald@stufft.io> | 2014-12-13 21:38:34 -0500 |
commit | d5b2651806419540f8bf746c201fd94ad2085c0a (patch) | |
tree | bb44db89c237f49cedb5ae565e67824cb43fd440 | |
parent | bff1145f929c31c3f6da5189ab226c79cb190d92 (diff) | |
download | pip-d5b2651806419540f8bf746c201fd94ad2085c0a.tar.gz |
Support importing from Wheels automatically
-rw-r--r-- | .travis.yml | 4 | ||||
-rwxr-xr-x | .travis/run.sh | 14 | ||||
-rw-r--r-- | pip/_vendor/__init__.py | 13 |
3 files changed, 30 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml index c6d101e67..130bd206c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,10 @@ env: - TOXENV=py33 VENDOR=no - TOXENV=py34 VENDOR=no - TOXENV=pypy VENDOR=no + - TOXENV=py27 VENDOR=no WHEELS=yes + - TOXENV=py33 VENDOR=no WHEELS=yes + - TOXENV=py34 VENDOR=no WHEELS=yes + - TOXENV=pypy VENDOR=no WHEELS=yes install: .travis/install.sh diff --git a/.travis/run.sh b/.travis/run.sh index 759efcdbd..83cc00eed 100755 --- a/.travis/run.sh +++ b/.travis/run.sh @@ -13,9 +13,21 @@ tox --notest # environment without the vendor directory included as well as install the # dependencies we need installed. if [[ $VENDOR = "no" ]]; then - .tox/$TOXENV/bin/pip install -r pip/_vendor/vendor.txt + # Install our dependencies if we're not installing from wheels + if [[ $WHEELS != "yes" ]]; then + .tox/$TOXENV/bin/pip install -r pip/_vendor/vendor.txt --no-deps + fi + + # Actually install pip without the bundled dependencies PIP_NO_VENDOR_FOR_DOWNSTREAM=1 .tox/$TOXENV/bin/pip install . + # Install our dependencies if we're installing from wheels + if [[ $WHEELS = "yes" ]]; then + mkdir -p /tmp/wheels + pip wheel --wheel-dir /tmp/wheels --no-deps -r pip/_vendor/vendor.txt + cp /tmp/wheels/* `echo .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/` + fi + # Test to make sure that we successfully installed without vendoring if [ -f .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/six.py ]; then echo "Did not successfully unvendor" diff --git a/pip/_vendor/__init__.py b/pip/_vendor/__init__.py index 5c329d6f5..baf14a343 100644 --- a/pip/_vendor/__init__.py +++ b/pip/_vendor/__init__.py @@ -7,9 +7,22 @@ updated to versions from upstream. """ from __future__ import absolute_import +import glob +import os.path import sys +# By default, look in this directory for a bunch of .whl files which we will +# add to the beginning of sys.path before attempting to import anything. This +# is done to support downstream re-distributors like Debian and Fedora who +# wish to create their own Wheels for our dependencies to aid in debundling. +WHEEL_DIR = os.path.abspath(os.path.dirname(__file__)) + +# Actually look inside of WHEEL_DIR to find .whl files and add them to the +# front of our sys.path. +sys.path = glob.glob(os.path.join(WHEEL_DIR, "*.whl")) + sys.path + + class VendorAlias(object): def __init__(self): |