commit | 50165f83f4eac72ab5d0425fd3b804880fd862b7 | [log] [tgz] |
---|---|---|
author | Allen Li <ayatane@google.com> | Thu Dec 22 15:34:55 2016 -0800 |
committer | chrome-bot <chrome-bot@chromium.org> | Wed Jan 04 15:36:13 2017 -0800 |
tree | acfd34ab043396ec615f25c9f4b664557123ead2 | |
parent | 6a1c8c67d8712ed4ac9c03f2eef6c7f2fe5d0d22 [diff] |
Deprecate venv_command BUG=chromium:674687 TEST=Run virtualenvs locally Change-Id: I42c0007ca012ca46ee6cbba80ac94a2570b8d262 Reviewed-on: https://chromium-review.googlesource.com/423334 Commit-Ready: Allen Li <ayatane@chromium.org> Tested-by: Allen Li <ayatane@chromium.org> Reviewed-by: Allen Li <ayatane@chromium.org>
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
create_venv
creates or updates a virtualenv using a requirements.txt
file.
$ create_venv .venv requirements.txt
To run the virtualenv python, use:
$ .venv/bin/python
NOTE: it is not generally safe to run the other scripts in .venv/bin
due to the hard-coded paths in the virtualenv. Instead of running .venv/bin/pip
for example, use .venv/bin/python -m pip
.
Here’s a complete example:
$ echo mock==2.0.0 > requirements.txt $ ./create_venv .venv requirements.txt $ .venv/bin/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 sys >>> sys.prefix # This points to the virtualenv now '/usr/local/google/home/ayatane/src/chromiumos/infra_virtualenv/.venv' >>> import mock