commit | 601ca85a8247967da48dac6526e6989221ff71da | [log] [tgz] |
---|---|---|
author | Mike Nichols <mikenichols@chromium.org> | Tue Aug 20 14:13:52 2019 -0600 |
committer | Mike Frysinger <vapier@chromium.org> | Fri Mar 27 05:32:50 2020 +0000 |
tree | 110456ff38919b1dd4bfb0eb293d6e7392a9366a | |
parent | a54ac383f8c3749e565c080fba50e3bcb01d0bea [diff] |
httplib2: Update httplib2 to 0.13.1 Upgrade pip package for httplib2 to 0.13.1, which is the latest release of the package, in an attempt to resolve issues with the latest version of python with Bionic. Bug: chromium:989683 Change-Id: I0cada2c7121462d480c562074bd96081b6481782 (cherry picked from commit a070aaec477f1a6d192d70b0b2491d1184424aba) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra_virtualenv/+/2124091 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
This repository provides a common Python virtualenv interface that infra code (such as chromite) can depend on.
Virtualenv users should mimic this repository, which itself uses virtualenv for running unit tests.
venv
directory. All packages and modules in this directory will be importable inside the virtualenv.requirements.txt
file inside venv
to list external packages to install.bin/python_venv
and bin/turtle
which serve as templates.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.
The bin/create_venv
script prepares a virtualenv using a requirements.txt
file.
$ bin/create_venv requirements.txt
The script will print the path to the virtualenv to stdout. Note that the output ends with a newline; Bash handles this, but Python does not.
To run the virtualenv Python, call bin/python
under the virtualenv directory.
Together, this might look up:
$ venv=$(bin/create_venv requirements.txt) $ ${venv}/bin/python
NOTE: it is not generally safe to run the other scripts in the virtualenv's bin
directory due to hard-coded paths. Instead of running bin/pip
for example, use bin/python -m pip
.
NOTE: Do not use this for third party dependencies (stuff not owned by ChromiumOS)! This should only be used to set up imports for stuff we own. For example, importing python-MySQL SHOULD NOT use this, but importing chromite from Autotest MAY use this.
This should be handled by the minimum amount of code in the package's __init__.py
file.
Example:
"""Autotest package.""" import sys # Use the minimum amount of logic to find the path to add _chromite_parent = 'site-packages' sys.path.append(_chromite_parent)
A solid understanding of the Python import system is recommended (the link is for Python 3, but it is informative).
In brief, __init__.py
is executed whenever a package is imported. A package is imported before any submodule or subpackage is imported. A package is only imported once per Python process; future imports are looked up in sys.modules
. Thus, __init__.py
will modify sys.path
exactly once and is guaranteed to be run before anything in that package is imported.