commit | 974dd1eb5ed3a8aae6f8c95def0eaf7a7e5a67a8 | [log] [tgz] |
---|---|---|
author | Allen Li <ayatane@google.com> | Mon Dec 19 11:06:58 2016 -0800 |
committer | chrome-bot <chrome-bot@chromium.org> | Tue Dec 20 21:55:33 2016 -0800 |
tree | 5ccb6f36e9291bbb9e05887fe34e2158240ada3c | |
parent | 9670ff631439c3530cb2934a2f869faa9b3b8f66 [diff] |
Pass search path directly to virtualenv Both pip and virtualenv take a path for finding packages, however the two are separate with distinct behavior with regard to finding packages (for perfectly valid reasons). So, we pass the path directly to virtualenv, but pass it as a file URL to pip. BUG=chromium:674681 TEST=Debug on builder Change-Id: I32f9e4e604f01387d6995230a10817f10951e9c2 Reviewed-on: https://chromium-review.googlesource.com/421183 Commit-Ready: Allen Li <ayatane@chromium.org> Tested-by: Allen Li <ayatane@chromium.org> Reviewed-by: David Riley <davidriley@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
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 >>>