python
index
/home/aki/wrk/git-mozharness-ro/mozharness/base/python.py

Python usage, esp. virtualenv.

 
Modules
       
os

 
Classes
       
__builtin__.object
VirtualenvMixin

 
class VirtualenvMixin(__builtin__.object)
    BaseScript mixin, designed to create and use virtualenvs.
 
Config items:
 * virtualenv_path points to the virtualenv location on disk.
 * virtualenv_modules lists the module names.
 * MODULE_url list points to the module URLs (optional)
Requires virtualenv to be in PATH.
Depends on ScriptMixin
 
  Methods defined here:
create_virtualenv(self, modules=(), requirements=())
Create a python virtualenv.
 
The virtualenv exe can be defined in c['virtualenv'] or
c['exes']['virtualenv'], as a string (path) or list (path +
arguments).
 
c['virtualenv_python_dll'] is an optional config item that works
around an old windows virtualenv bug.
 
virtualenv_modules can be a list of module names to install, e.g.
 
    virtualenv_modules = ['module1', 'module2']
 
or it can be a list of dicts that define a module: url-or-path,
or a combination.
 
    virtualenv_modules = [
        'module1',
        {'module2': 'http://url/to/package'},
        {'module3': os.path.join('path', 'to', 'setup_py', 'dir')},
    ]
 
virtualenv_requirements is an optional list of pip requirements files to
use when invoking pip, e.g.,
 
    virtualenv_requirements = [
        '/path/to/requirements1.txt',
        '/path/to/requirements2.txt'
    ]
install_module(self, module=None, module_url=None, install_method=None, requirements=())
Install module via pip.
 
module_url can be a url to a python package tarball, a path to
a directory containing a setup.py (absolute or relative to work_dir)
or None, in which case it will default to the module name.
 
requirements is a list of pip requirements files.  If specified, these
will be combined with the module_url (if any), like so:
 
pip install -r requirements1.txt -r requirements2.txt module_url
is_python_package_installed(self, package_name, error_level='warning')
Return whether the package is installed
package_versions(self, pip_freeze_output=None, error_level='warning', log_output=False)
reads packages from `pip freeze` output and returns a dict of
{package_name: 'version'}
query_python_path(self, binary='python')
Return the path of a binary inside the virtualenv, if
c['virtualenv_path'] is set; otherwise return the binary name.
Otherwise return None
query_python_site_packages_path(self)
query_virtualenv_path(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
python_paths = {}
site_packages_path = None

 
Data
        FATAL = 'fatal'
VirtualenvErrorList = [{'level': 'warning', 'substr': 'not found or a compiler error:'}, {'level': 'error', 'regex': <_sre.SRE_Pattern object at 0xb7e8d100>}, {'level': 'warning', 'regex': <_sre.SRE_Pattern object at 0xb7e8c458>}, {'level': 'debug', 'regex': <_sre.SRE_Pattern object at 0x824f808>}, {'level': 'error', 'substr': 'command not found'}, {'level': 'error', 'substr': 'Traceback (most recent call last)'}, {'level': 'error', 'substr': 'SyntaxError: '}, {'level': 'error', 'substr': 'TypeError: '}, {'level': 'error', 'substr': 'NameError: '}, {'level': 'error', 'substr': 'ZeroDivisionError: '}, {'level': 'critical', 'regex': <_sre.SRE_Pattern object at 0xb7eab180>}, {'level': 'critical', 'regex': <_sre.SRE_Pattern object at 0xb7edcac0>}]
WARNING = 'warning'
virtualenv_config_options = [[['--venv-path', '--virtualenv-path'], {'action': 'store', 'default': 'venv', 'dest': 'virtualenv_path', 'help': 'Specify the path to the virtualenv top level directory'}], [['--virtualenv'], {'action': 'store', 'dest': 'virtualenv', 'help': 'Specify the virtualenv executable to use'}], [['--pypi-url'], {'action': 'store', 'dest': 'pypi_url', 'help': 'Base URL of Python Package Index (default http://pypi.python.org/simple/)'}], [['--find-links'], {'action': 'extend', 'dest': 'find_links', 'help': 'URL to look for packages at'}], [['--pip-index'], {'action': 'store_true', 'default': True, 'dest': 'pip_index', 'help': 'Use pip indexes (default)'}], [['--no-pip-index'], {'action': 'store_false', 'dest': 'pip_index', 'help': "Don't use pip indexes"}]]