A collection of active distributions on sys.path (or a similar list)
def pip._vendor.pkg_resources.WorkingSet.__init__ |
( |
|
self, |
|
|
|
entries = None |
|
) |
| |
A collection of active distributions on sys.path (or a similar list)
Create working set from list of path entries (default=sys.path)
def pip._vendor.pkg_resources.WorkingSet.__contains__ |
( |
|
self, |
|
|
|
dist |
|
) |
| |
True if `dist` is the active distribution for its project
def pip._vendor.pkg_resources.WorkingSet.__getstate__ |
( |
|
self | ) |
|
def pip._vendor.pkg_resources.WorkingSet.__iter__ |
( |
|
self | ) |
|
Yield distributions for non-duplicate projects in the working set
The yield order is the order in which the items' path entries were
added to the working set.
def pip._vendor.pkg_resources.WorkingSet.__setstate__ |
( |
|
self, |
|
|
|
e_k_b_c |
|
) |
| |
def pip._vendor.pkg_resources.WorkingSet._added_new |
( |
|
self, |
|
|
|
dist |
|
) |
| |
|
private |
def pip._vendor.pkg_resources.WorkingSet._build_from_requirements |
( |
|
cls, |
|
|
|
req_spec |
|
) |
| |
|
private |
Build a working set from a requirement spec. Rewrites sys.path.
def pip._vendor.pkg_resources.WorkingSet._build_master |
( |
|
cls | ) |
|
|
private |
Prepare the master working set.
def pip._vendor.pkg_resources.WorkingSet.add |
( |
|
self, |
|
|
|
dist, |
|
|
|
entry = None , |
|
|
|
insert = True , |
|
|
|
replace = False |
|
) |
| |
Add `dist` to working set, associated with `entry`
If `entry` is unspecified, it defaults to the ``.location`` of `dist`.
On exit from this routine, `entry` is added to the end of the working
set's ``.entries`` (if it wasn't already present).
`dist` is only added to the working set if it's for a project that
doesn't already have a distribution in the set, unless `replace=True`.
If it's added, any callbacks registered with the ``subscribe()`` method
will be called.
def pip._vendor.pkg_resources.WorkingSet.add_entry |
( |
|
self, |
|
|
|
entry |
|
) |
| |
Add a path item to ``.entries``, finding any distributions on it
``find_distributions(entry, True)`` is used to find distributions
corresponding to the path entry, and they are added. `entry` is
always appended to ``.entries``, even if it is already present.
(This is because ``sys.path`` can contain the same value more than
once, and the ``.entries`` of the ``sys.path`` WorkingSet should always
equal ``sys.path``.)
def pip._vendor.pkg_resources.WorkingSet.find |
( |
|
self, |
|
|
|
req |
|
) |
| |
Find a distribution matching requirement `req`
If there is an active distribution for the requested project, this
returns it as long as it meets the version requirement specified by
`req`. But, if there is an active distribution for the project and it
does *not* meet the `req` requirement, ``VersionConflict`` is raised.
If there is no active distribution for the requested project, ``None``
is returned.
def pip._vendor.pkg_resources.WorkingSet.find_plugins |
( |
|
self, |
|
|
|
plugin_env, |
|
|
|
full_env = None , |
|
|
|
installer = None , |
|
|
|
fallback = True |
|
) |
| |
Find all activatable distributions in `plugin_env`
Example usage::
distributions, errors = working_set.find_plugins(
Environment(plugin_dirlist)
)
map(working_set.add, distributions) # add plugins+libs to sys.path
print 'Could not load', errors # display errors
The `plugin_env` should be an ``Environment`` instance that contains
only distributions that are in the project's "plugin directory" or
directories. The `full_env`, if supplied, should be an ``Environment``
contains all currently-available distributions. If `full_env` is not
supplied, one is created automatically from the ``WorkingSet`` this
method is called on, which will typically mean that every directory on
``sys.path`` will be scanned for distributions.
`installer` is a standard installer callback as used by the
``resolve()`` method. The `fallback` flag indicates whether we should
attempt to resolve older versions of a plugin if the newest version
cannot be resolved.
This method returns a 2-tuple: (`distributions`, `error_info`), where
`distributions` is a list of the distributions found in `plugin_env`
that were loadable, along with any other distributions that are needed
to resolve their dependencies. `error_info` is a dictionary mapping
unloadable plugin distributions to an exception instance describing the
error that occurred. Usually this will be a ``DistributionNotFound`` or
``VersionConflict`` instance.
def pip._vendor.pkg_resources.WorkingSet.iter_entry_points |
( |
|
self, |
|
|
|
group, |
|
|
|
name = None |
|
) |
| |
Yield entry point objects from `group` matching `name`
If `name` is None, yields all entry points in `group` from all
distributions in the working set, otherwise only ones matching
both `group` and `name` are yielded (in distribution order).
def pip._vendor.pkg_resources.WorkingSet.require |
( |
|
self, |
|
|
|
requirements |
|
) |
| |
Ensure that distributions matching `requirements` are activated
`requirements` must be a string or a (possibly-nested) sequence
thereof, specifying the distributions and versions required. The
return value is a sequence of the distributions that needed to be
activated to fulfill the requirements; all relevant distributions are
included, even if they were already activated in this working set.
def pip._vendor.pkg_resources.WorkingSet.resolve |
( |
|
self, |
|
|
|
requirements, |
|
|
|
env = None , |
|
|
|
installer = None , |
|
|
|
replace_conflicting = False |
|
) |
| |
List all distributions needed to (recursively) meet `requirements`
`requirements` must be a sequence of ``Requirement`` objects. `env`,
if supplied, should be an ``Environment`` instance. If
not supplied, it defaults to all distributions available within any
entry or distribution in the working set. `installer`, if supplied,
will be invoked with each requirement that cannot be met by an
already-installed distribution; it should return a ``Distribution`` or
``None``.
Unless `replace_conflicting=True`, raises a VersionConflict exception if
any requirements are found on the path that have the correct name but
the wrong version. Otherwise, if an `installer` is supplied it will be
invoked to obtain the correct version of the requirement and activate
it.
def pip._vendor.pkg_resources.WorkingSet.run_script |
( |
|
self, |
|
|
|
requires, |
|
|
|
script_name |
|
) |
| |
Locate distribution for `requires` and run `script_name` script
def pip._vendor.pkg_resources.WorkingSet.subscribe |
( |
|
self, |
|
|
|
callback |
|
) |
| |
Invoke `callback` for all distributions (including existing ones)
pip._vendor.pkg_resources.WorkingSet.by_key |
pip._vendor.pkg_resources.WorkingSet.callbacks |
pip._vendor.pkg_resources.WorkingSet.entries |
pip._vendor.pkg_resources.WorkingSet.entry_keys |
The documentation for this class was generated from the following file:
Copyright 2014 Google Inc. All rights reserved.