Add tar.gz version of pip, setuptools

(Some) builders are running virtualenv 1.7, which is the most
up-to-date version of virtualenv on Ubuntu Precise (Goobuntus are
running virtualenv 1.11).

This version of virtualenv does not work with wheels, so it does not
detect the version of pip that we ship (8.1.2).  Furthermore, the
version of pip that virtualenv defaults to (1.1) does not support
wheels either, so it cannot install any of the dependency packages
that we ship.

This version of virtualenv also ships with a woefully out of date copy
of setuptools (0.9 something), which provides an out of date version
of pkg_resources.  The consequence of this is that gcloud, which uses
pkg_resources to find its own distribution version, fails.

The easiest workaround is to ship a tar.gz version of pip 8.1.2, which
virtualenv 1.7 does detect and install.  With an up to date version of
pip installed, we can install the rest of the necessary wheels.

We also ship a tar.gz version of an updated setuptools.  virtualenv
does not detect and install this updated setuptools, but we install
this using pip (added in a separate commit).

Note that it should be possible to install setuptools as a wheel,
however I suspect there are more fun things required to get that
working reliably and is probably not worth it.  Therefore, we ship
portable tar.gz of setuptools and pip, which should enable us to
portably get a virtualenv up and running with the basic dependencies
we need, and pip+setuptools takes care of everything else.

BUG=chromium:674687
TEST=Debug on builder

Change-Id: I1a4c48fcb81d2964e0007a2be1bf0c70e34c7995
Reviewed-on: https://chromium-review.googlesource.com/421101
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
2 files changed
tree: 97622521550f353a6915fffc256cf69d4656cd90
  1. pip_packages/
  2. create_venv
  3. expand_reqs.py
  4. README.md
  5. venv_command
README.md

infra_virtualenv README

This repository provides a common Python virtualenv interface that infra code (such as chromite) can depend on. At this point, it is experimental and not yet used in production.

Virtualenv users should create a requirements.txt file listing the packages that they need and use the wrapper scripts (described below) to create the virtualenv and run commands within it.

To add packages to this repository, run:

$ pip wheel -w path/to/pip_packages -r path/to/requirements.txt

Commit the changes and make a CL.

For example for chromite, from within chromite/virtualenv, run:

$ pip wheel -w pip_packages -r requirements.txt

Wrapper scripts

This repository contains two scripts for working with Python virtualenvs.

venv_command runs a command in a virtualenv environment. This is more convenient than having to start a shell and source bin/activate. For example, to start Python inside the virtualenv:

$ venv_command path/to/venv python

create_venv creates or updates a virtualenv using a requirements.txt file.

$ create_venv path/to/venv path/to/requirements.txt

Here’s a complete example:

$ echo mock=2.0.0 > requirements.txt
$ ./create_venv venv requirements.txt
$ ./venv_command venv python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mock
>>>