Merge pull request #2184 from dstufft/support-import-wheels

Add Wheels to sys.path If They Exist In The Vendor Directory
This commit is contained in:
Donald Stufft 2014-12-18 20:51:06 -05:00
commit b1c3afe1b5
3 changed files with 28 additions and 3 deletions

View File

@ -12,9 +12,9 @@ env:
- TOXENV=py34
- TOXENV=pypy
- TOXENV=py27 VENDOR=no
- TOXENV=py33 VENDOR=no
- TOXENV=py34 VENDOR=no
- TOXENV=pypy VENDOR=no
- TOXENV=py27 VENDOR=no WHEELS=yes
- TOXENV=py34 VENDOR=no WHEELS=yes
install: .travis/install.sh

View File

@ -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"

View File

@ -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):