Your IP : 3.141.41.109


Current Path : /lib/python2.7/site-packages/pkg_resources/
Upload File :
Current File : //lib/python2.7/site-packages/pkg_resources/__init__.pyc

�
�fcF@@s�
dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZyddlZWnek
r]ddlZnXddlmZddl m!Z!m"Z"m#Z#ddlm$Z$y&ddlm%Z%m&Z&m'Z'e(Z)Wnek
r�e*Z)nXdd	lm+Z,dd
l-m.Z.m/Z/yddl0j1Z2e2j3Wnek
r3e4Z2nXddl5m6Z6dd
lm7Z7ddlm8Z8e9d�e9d�e9d�e9d�ddfej:ko�ddfknr�e;d��nej<r�e4Z=e4Z>ne4Z?e4Z@e4ZAe4ZBe4ZCe4ZDe4ZEe4ZFe4ZGe4ZHe4ZIe4ZJe4ZKe4ZLe4ZMe4ZNe4ZOdePfd��YZQd�ZRiZSd�ZTd�ZUd�ZVd�ZWd�ZXd�ZYd�ZZd�Z[Z\d �Z]d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@ddAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddegFZ^d<e_fdf��YZ`d=e`fdg��YZadheafdi��YZbd>e`fdj��YZcd?e`fdk��YZdiZeejfd ZgdZhdlZidZjdZkdmZldn�Zmdo�Zngdp�Zodq�Zpdr�Zqejrds�Zsejrdt�ZteqZudu�Zvdv�ZwewZxdw�Zydx�Zze4dy�Z{dz�Z|dTfd{��YZ}dUe}fd|��YZ~d7efd}��YZ�d~e�fd��YZ�d6efd���YZ�e�Z�d@e;fd���YZ�d8fd���YZ�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e4d��Z�d[fd���YZ�emee��d\e�fd���YZ�d]e�fd���YZ�e�j��dYe�fd���YZ�e��Z�d�e�fd���YZ�d�e�fd���YZ�d^e�fd���YZ�eme
j�e��dVe�fd���YZ�dWe�fd���YZ�dXe�fd���YZ�eTd�d�i�d��Z�e*d��Z�e*d��Z�e�e
j�e��e*d��Z�e�ee��d��Z�e*d��Z�d��Z�d�fd���YZ�d��Z�d��Z�d��Z�d��Z�e�ej�e��e�e2d��r�e�e2j�e��neTd�d�i�eTd�d�i�d��Z�d��Z�d��Z�d��Z�e4d��Z�d��Z�e�ej�e��e�e
j�e��e�e2d��r)	e�e2j�e��nd��Z�e�ee��d��Z�id��Z�d��Z�d��Z�d��Z�d��Z�ejrd��j�Z�ejrd�ej�ej�B�j�Z�d;efd���YZ�d��Z�d��Z�d9efd���YZ�d�e�fd���YZ�d�e�fd���YZ�ie�d�6e�d�6e�d�6Z�d��Z�d�e�fd���YZ�d��Z�d:e8j�j�fd���YZ�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�ej�d�d�eQd�e(�d��Z�e�e��d���Z�e�d���Z�dS(�sZ
Package resource API
--------------------

A resource is a logical file contained within a package, or a logical
subdirectory thereof.  The package resource API expects resource names
to have their path parts separated with ``/``, *not* whatever the local
path separator is.  Do not use os.path operations to manipulate resource
names being passed into the API.

The package resource API is designed to work with normal filesystem packages,
.egg files, and unpacked .egg files.  It can also work in a limited way with
.zip files and with custom PEP 302 loaders that support the ``get_data()``
method.
i(tabsolute_importN(tget_importer(tsix(turllibtmaptfilter(tutime(tmkdirtrenametunlink(topen(tisdirtspliti(t
py31compat(tappdirs(t	packagings&pkg_resources.extern.packaging.versions)pkg_resources.extern.packaging.specifierss+pkg_resources.extern.packaging.requirementss&pkg_resources.extern.packaging.markersisPython 3.3 or later is requiredt
PEP440WarningcB@seZdZRS(sa
    Used when there is an issue with a version or specifier not complying with
    PEP 440.
    (t__name__t
__module__t__doc__(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRnscC@s?ytjj|�SWn$tjjk
r:tjj|�SXdS(N(RtversiontVersiontInvalidVersiont
LegacyVersion(tv((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt
parse_versionuscK@s-t�j|�tjtj||��dS(N(tglobalstupdatet_state_varstdicttfromkeys(tvartypetkw((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_declare_statescC@sLi}t�}x6tj�D](\}}|d|||�||<qW|S(Nt_sget_(RRtitems(tstatetgtkR((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__getstate__�s
	 cC@sJt�}x:|j�D],\}}|dt|||||�qW|S(Nt_sset_(RR#R(R$R%R&R((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__setstate__�s	$cC@s
|j�S(N(tcopy(tval((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt
_sget_dict�scC@s|j�|j|�dS(N(tclearR(tkeytobR$((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt
_sset_dict�s
cC@s
|j�S(N(R'(R+((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_sget_object�scC@s|j|�dS(N(R)(R.R/R$((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_sset_object�scG@sdS(N(tNone(targs((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt<lambda>�tcC@s{t�}tj|�}|dk	rwtjdkrwy-ddjt�d �|jd�f}Wqwt	k
rsqwXn|S(sZReturn this platform's maximum compatible version.

    distutils.util.get_platform() normally reports the minimum version
    of Mac OS X that would be required to *use* extensions produced by
    distutils.  But what we want when checking compatibility is to know the
    version of Mac OS X that we are *running*.  To allow usage of packages that
    explicitly require a newer version of Mac OS X, we must also know the
    current version of the OS.

    If this condition occurs for any other platform with a version in its
    platform strings, this function should be extended accordingly.
    tdarwinsmacosx-%s-%st.iiN(
tget_build_platformtmacosVersionStringtmatchR3tsystplatformtjoint_macosx_verstgroupt
ValueError(tplattm((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytget_supported_platform�s
	-
trequiret
run_scripttget_providertget_distributiontload_entry_pointt
get_entry_maptget_entry_infotiter_entry_pointstresource_stringtresource_streamtresource_filenametresource_listdirtresource_existstresource_isdirtdeclare_namespacetworking_settadd_activation_listenertfind_distributionstset_extraction_pathtcleanup_resourcestget_default_cachetEnvironmentt
WorkingSettResourceManagertDistributiontRequirementt
EntryPointtResolutionErrortVersionConflicttDistributionNotFoundtUnknownExtratExtractionErrortparse_requirementsRt	safe_nametsafe_versiontget_platformtcompatible_platformstyield_linestsplit_sectionst
safe_extratto_filenametinvalid_markertevaluate_markertensure_directorytnormalize_pathtEGG_DISTtBINARY_DISTtSOURCE_DISTt
CHECKOUT_DISTtDEVELOP_DISTtIMetadataProvidertIResourceProvidertFileMetadatatPathMetadatatEggMetadatat
EmptyProvidertempty_providertNullProvidertEggProvidertDefaultProvidertZipProvidertregister_findertregister_namespace_handlertregister_loader_typetfixup_namespace_packagesRtrun_maintAvailableDistributionscB@seZdZd�ZRS(s.Abstract base for dependency resolution errorscC@s|jjt|j�S(N(t	__class__RtreprR4(tself((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__repr__�s(RRRR�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR`�scB@sDeZdZdZed��Zed��Zd�Zd�ZRS(s�
    An already-installed version conflicts with the requested version.

    Should be initialized with the installed Distribution and the requested
    Requirement.
    s3{self.dist} is installed but {self.req} is requiredcC@s|jdS(Ni(R4(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytdist�scC@s|jdS(Ni(R4(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytreqscC@s|jjt��S(N(t	_templatetformattlocals(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytreportscC@s$|s
|S|j|f}t|�S(st
        If required_by is non-empty, return a version of self that is a
        ContextualVersionConflict.
        (R4tContextualVersionConflict(R�trequired_byR4((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytwith_context
s(	RRRR�tpropertyR�R�R�R�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRa�s	R�cB@s*eZdZejdZed��ZRS(s�
    A VersionConflict that accepts a third parameter, the set of the
    requirements that required the installed Distribution.
    s by {self.required_by}cC@s|jdS(Ni(R4(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�s(RRRRaR�R�R�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�s
cB@sSeZdZdZed��Zed��Zed��Zd�Zd�Z	RS(s&A requested distribution was not foundsSThe '{self.req}' distribution was not found and is required by {self.requirers_str}cC@s|jdS(Ni(R4(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�(scC@s|jdS(Ni(R4(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt	requirers,scC@s|js
dSdj|j�S(Nsthe applications, (R�R>(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt
requirers_str0s	cC@s|jjt��S(N(R�R�R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�6scC@s
|j�S(N(R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__str__9s(
RRRR�R�R�R�R�R�R�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRb"s	cB@seZdZRS(s>Distribution doesn't have an "extra feature" of the given name(RRR(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRc=sii����cC@s|t|<dS(sRegister `provider_factory` to make providers for `loader_type`

    `loader_type` is the type or class of a PEP 302 ``module.__loader__``,
    and `provider_factory` is a function that, passed a *module* object,
    returns an ``IResourceProvider`` for that module.
    N(t_provider_factories(tloader_typetprovider_factory((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�KscC@s�t|t�r2tj|�p1tt|��dSytj|}Wn(tk
rmt	|�tj|}nXt
|dd�}tt
|�|�S(s?Return an IResourceProvider for the named module or requirementit
__loader__N(t
isinstanceR^RTtfindREtstrR<tmodulestKeyErrort
__import__tgetattrR3t
_find_adapterR�(tmoduleOrReqtmoduletloader((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRGUs#

cC@s�|s�tj�d}|dkrzd}tjj|�rzttd�rwtj|�}d|krt|d}qtqwqzn|j|j	d��n|dS(NiR6s0/System/Library/CoreServices/SystemVersion.plistt	readPlisttProductVersionR8(
R=tmac_vertostpathtexiststhasattrtplistlibR�tappendR(t_cacheRtplistt
plist_content((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR?bscC@sidd6dd6j||�S(NtppctPowerPCtPower_Macintosh(tget(tmachine((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_macosx_archrscC@s�yddlm}Wn!tk
r7ddlm}nX|�}tjdkr�|jd�r�yTt�}tj	�dj
dd�}dt|d�t|d	�t|�fSWq�t
k
r�q�Xn|S(
s�Return this platform's string for platform-specific distributions

    XXX Currently this is the same as ``distutils.util.get_platform()``, but it
    needs some hacks for Linux and Mac OS X.
    i(RhR7smacosx-it t_smacosx-%d.%d-%si(t	sysconfigRhtImportErrortdistutils.utilR<R=t
startswithR?R�tunametreplacetintR�RA(RhRBRR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR9vs
		
smacosx-(\d+)\.(\d+)-(.*)sdarwin-(\d+)\.(\d+)\.(\d+)-(.*)cC@sO|d	ks$|d	ks$||kr(tStj|�}|rKtj|�}|s�tj|�}|r�t|jd��}d|jd�|jd�f}|dkr�|dks�|dkr�|dkr�tSntS|jd�|jd�ks|jd�|jd�krtSt|jd��t|jd��krGtStStS(
s�Can code for the `provided` platform run on the `required` platform?

    Returns true if either platform is ``None``, or the platforms are equal.

    XXX Needs compatibility checks for Linux and other unixy OSes.
    is%s.%siis10.3is10.4iN(R3tTrueR:R;tdarwinVersionStringR�R@tFalse(tprovidedtrequiredtreqMactprovMact
provDarwintdversiontmacosversion((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRi�s*$"*cC@sNtjd�j}|d}|j�||d<t|�dj||�dS(s@Locate distribution `dist_spec` and run its `script_name` scriptiRiN(R<t	_getframet	f_globalsR-RERF(t	dist_spectscript_nametnstname((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRF�s



cC@sgt|tj�r$tj|�}nt|t�rBt|�}nt|t�sctd|��n|S(s@Return a current distribution object for a Requirement or strings-Expected string, Requirement, or Distribution(R�Rtstring_typesR^tparseRGR]t	TypeError(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRH�scC@st|�j||�S(sDReturn `name` entry point of `group` for `dist` or raise ImportError(RHRI(R�R@R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRI�scC@st|�j|�S(s=Return the entry point map for `group`, or the full entry map(RHRJ(R�R@((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRJ�scC@st|�j||�S(s<Return the EntryPoint object for `group`+`name`, or ``None``(RHRK(R�R@R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRK�scB@s>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cC@sdS(s;Does the package's distribution contain the named metadata?N((R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pythas_metadata�R6cC@sdS(s'The named metadata resource as a stringN((R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytget_metadata�R6cC@sdS(s�Yield named metadata resource as list of non-blank non-comment lines

       Leading and trailing whitespace is stripped from each line, and lines
       with ``#`` as the first non-blank character are omitted.N((R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytget_metadata_lines�R6cC@sdS(s>Is the named metadata a directory?  (like ``os.path.isdir()``)N((R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytmetadata_isdir�R6cC@sdS(s?List of metadata names in the directory (like ``os.listdir()``)N((R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytmetadata_listdir�R6cC@sdS(s=Execute the named script in the supplied namespace dictionaryN((R�t	namespace((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRFR6(RRR�R�R�R�R�RF(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRw�s					cB@sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s3An object that provides access to package resourcescC@sdS(sdReturn a true filesystem path for `resource_name`

        `manager` must be an ``IResourceManager``N((tmanagert
resource_name((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytget_resource_filenameR6cC@sdS(siReturn a readable file-like object for `resource_name`

        `manager` must be an ``IResourceManager``N((R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytget_resource_streamR6cC@sdS(smReturn a string containing the contents of `resource_name`

        `manager` must be an ``IResourceManager``N((R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytget_resource_stringR6cC@sdS(s,Does the package contain the named resource?N((R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pythas_resourceR6cC@sdS(s>Is the named resource a directory?  (like ``os.path.isdir()``)N((R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRRR6cC@sdS(s?List of resource names in the directory (like ``os.listdir()``)N((R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRPR6(	RRRR�R�R�R�RRRP(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRxs					cB@s�eZdZdd�Zed��Zed��Zd�Zd�Z	d�Z
dd�Zd�Zd	�Z
deed
�Zddedd�Zdded�Zd
�Zed�Zd�Zd�Zd�ZRS(sDA collection of active distributions on sys.path (or a similar list)cC@s^g|_i|_i|_g|_|dkr<tj}nx|D]}|j|�qCWdS(s?Create working set from list of path entries (default=sys.path)N(tentriest
entry_keystby_keyt	callbacksR3R<R�t	add_entry(R�R�tentry((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__init__#s				
cC@se|�}yddlm}Wntk
r1|SXy|j|�Wntk
r`|j|�SX|S(s1
        Prepare the master working set.
        i(t__requires__(t__main__R�R�RERat_build_from_requirements(tclstwsR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt
_build_master0s	

cC@s�|g�}t|�}|j|t��}x|D]}|j|�q4Wx0tjD]%}||jkrU|j|�qUqUW|jtj(|S(sQ
        Build a working set from a requirement spec. Rewrites sys.path.
        (RetresolveRZtaddR<R�R�R�(R�treq_specR�treqstdistsR�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�Ds

cC@sT|jj|g�|jj|�x*t|t�D]}|j||t�q3WdS(s�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``.)
        N(R�t
setdefaultR�R�RVR�R�R�(R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�Zs
cC@s|jj|j�|kS(s9True if `dist` is the active distribution for its project(R�R�R.(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__contains__iscC@sC|jj|j�}|dk	r?||kr?t||��n|S(s�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.
        N(R�R�R.R3Ra(R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�ms
cc@sgx`|D]X}|j|�}|dkrGx4|j�D]}|Vq5Wq||kr||VqqWdS(sYield 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).
        N(RJR3tvalues(R�R@R�R�R�tep((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRL}s
cC@sQtjd�j}|d}|j�||d<|j|�dj||�dS(s?Locate distribution for `requires` and run `script_name` scriptiRiN(R<R�R�R-RERF(R�trequiresR�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRF�s



cc@spi}xc|jD]X}||jkr+qnx:|j|D]+}||kr9d||<|j|Vq9q9WqWdS(s�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.
        iN(R�R�R�(R�tseentitemR.((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__iter__�s
cC@s�|r"|j|j|d|�n|dkr:|j}n|jj|g�}|jj|jg�}|r�|j|jkr�dS||j|j<|j|kr�|j|j�n|j|kr�|j|j�n|j	|�dS(sAdd `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.
        R�N(
t	insert_onR�R3tlocationR�R�R.R�R�t
_added_new(R�R�R�tinsertR�tkeystkeys2((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s+t|�ddd�}i}i}g}t�}	tjt�}
x�|r&|jd�}||krmqFn|	j||�s�qFn|j|j�}|dkr�|j
j|j�}|dks�||krz|rz|}
|dkr!|dkrt|j�}q!tg�}t
g�}
n|j||
|d|�}||j<|dkrz|
j|d�}t||��qzn|j|�n||kr�|
|}t||�j|��n|j|j�ddd�}|j|�x/|D]'}|
|j|j�|j|	|<q�Wt||<qFW|S(s�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.

        `extras` is a list of the extras to be used with these requirements.
        This is important because extra requirements may look like `my_req;
        extra = "my_extra"`, which would otherwise be interpreted as a purely
        optional requirement.  Instead, we want to be able to assert that these
        requirements are truly required.
        Ni����itreplace_conflicting(tlistt
_ReqExtrastcollectionstdefaultdicttsettpoptmarkers_passR�R.R3R�RZR�R[t
best_matchRbR�RaR�R�textrastextendR�tproject_nameR�(R�trequirementstenvt	installerRRt	processedtbesttto_activatet
req_extrasR�R�R�R�R�t
dependent_reqtnew_requirementstnew_requirement((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��sN		


cC@sAt|�}|j�i}i}|dkrJt|j�}||7}n
||}|jg�}	tt|	j|��x�|D]�}
x�||
D]�}|j�g}y|	j	|||�}
Wn*t
k
r�}|||<|r�q�qPq�Xtt|	j|
��|jtj
|
��Pq�Wq�Wt|�}|j�||fS(ssFind all activatable distributions in `plugin_env`

        Example usage::

            distributions, errors = working_set.find_plugins(
                Environment(plugin_dirlist)
            )
            # add plugins+libs to sys.path
            map(working_set.add, distributions)
            # display errors
            print('Could not load', 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.
        N(RtsortR3RZR�R�RR�tas_requirementR�R`RRR(R�t
plugin_envtfull_envRtfallbacktplugin_projectst
error_infot
distributionsRt
shadow_setR
R�R�t	resolveesR((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytfind_pluginss4$




	
cG@s7|jt|��}x|D]}|j|�qW|S(s�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.
        (R�ReR�(R�RtneededR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyREss	
cC@sL||jkrdS|jj|�|s-dSx|D]}||�q4WdS(s�Invoke `callback` for all distributions

        If `existing=True` (default),
        call on all existing ones, as well.
        N(R�R�(R�tcallbacktexistingR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt	subscribe�s
cC@s"x|jD]}||�q
WdS(N(R�(R�R�R$((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s*|j|jj�|jj�|jfS(N(R�R�R*R�R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR'�scC@sH|\}}}}||_|j�|_|j�|_||_dS(N(R�R*R�R�R�(R�te_k_b_cR�RR�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR)�s

N(RRRR3R�tclassmethodR�R�R�R�R�RLRFR�R�R�R�R�R"RER&R�R'R)(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR[ s&
					\S			RcB@seZdZdd�ZRS(s>
    Map each requirement to the extras that demanded it.
    c@s@�fd�|j�d�|p$dD�}�jp?t|�S(s�
        Evaluate markers for req against each extra that
        demanded it.

        Return False if the req has a marker and fails
        evaluation. Otherwise, return True.
        c3@s(|]}�jji|d6�VqdS(textraN(tmarkertevaluate(t.0R)(R�(s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pys	<genexpr>�s(N(N(R�R3R*tany(R�R�Rtextra_evals((R�s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR	�s	 N(RRRR3R	(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�scB@s�eZdZde�ed�Zd�Zd�Zdd�Z	d�Z
d�Zded�Z
dd�Zd	�Zd
�Zd�ZRS(
s5Searchable snapshot of distributions on a search pathcC@s,i|_||_||_|j|�dS(s!Snapshot distributions available on a search path

        Any distributions found on `search_path` are added to the environment.
        `search_path` should be a sequence of ``sys.path`` items.  If not
        supplied, ``sys.path`` is used.

        `platform` is an optional string specifying the name of the platform
        that platform-specific distributions must be compatible with.  If
        unspecified, it defaults to the current platform.  `python` is an
        optional string naming the desired version of Python (e.g. ``'3.3'``);
        it defaults to the current version.

        You may explicitly set `platform` (and/or `python`) to ``None`` if you
        wish to map *all* distributions, not just those compatible with the
        running platform or Python version.
        N(t_distmapR=tpythontscan(R�tsearch_pathR=R0((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s			cC@sI|jdkp-|jdkp-|j|jk}|oHt|j|j�S(s�Is distribution `dist` acceptable for this environment?

        The distribution must match the platform and python version
        requirements specified when this environment was created, or False
        is returned.
        N(R0R3t
py_versionRiR=(R�R�t	py_compat((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytcan_add�scC@s|j|jj|�dS(s"Remove `dist` from the environmentN(R/R.tremove(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR6�scC@sQ|dkrtj}nx2|D]*}x!t|�D]}|j|�q2WqWdS(sdScan `search_path` for distributions usable in this environment

        Any distributions found are added to the environment.
        `search_path` should be a sequence of ``sys.path`` items.  If not
        supplied, ``sys.path`` is used.  Only distributions conforming to
        the platform/python version defined at initialization are added.
        N(R3R<R�RVR�(R�R2R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR1�s

cC@s|j�}|jj|g�S(sReturn a newest-to-oldest list of distributions for `project_name`

        Uses case-insensitive `project_name` comparison, assuming all the
        project's distributions use their project's name converted to all
        lowercase as their key.

        (tlowerR/R�(R�R
tdistribution_key((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__getitem__�scC@su|j|�rq|j�rq|jj|jg�}||krq|j|�|jdtjd�dt	�qqndS(sLAdd `dist` if we ``can_add()`` it and it has not already been added
        R.thashcmptreverseN(
R5thas_versionR/R�R.R�Rtoperatort
attrgetterR�(R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s

cC@s�y|j|�}Wn#tk
r8|s/�nd}nX|dk	rI|Sx%||jD]}||krW|SqWW|j||�S(s�Find distribution best matching `req` and usable on `working_set`

        This calls the ``find(req)`` method of the `working_set` to see if a
        suitable distribution is already active.  (This may raise
        ``VersionConflict`` if an unsuitable version of the project is already
        active in the specified `working_set`.)  If a suitable distribution
        isn't active, this method returns the newest distribution in the
        environment that meets the ``Requirement`` in `req`.  If no suitable
        distribution is found, and `installer` is supplied, then the result of
        calling the environment's ``obtain(req, installer)`` method will be
        returned.
        N(R�RaR3R.tobtain(R�R�RTRRR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR
s

cC@s|dk	r||�SdS(s�Obtain a distribution matching `requirement` (e.g. via download)

        Obtain a distro that matches requirement (e.g. via download).  In the
        base ``Environment`` class, this routine just returns
        ``installer(requirement)``, unless `installer` is None, in which case
        None is returned instead.  This method is a hook that allows subclasses
        to attempt other ways of obtaining a distribution before falling back
        to the `installer` argument.N(R3(R�trequirementR((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR?#s	cc@s0x)|jj�D]}||r|VqqWdS(s=Yield the unique project names of the available distributionsN(R/R(R�R.((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�/s
cC@s{t|t�r|j|�nXt|t�rdxF|D](}x||D]}|j|�qFWq5Wntd|f��|S(s2In-place addition of a distribution or environmentsCan't add %r to environment(R�R]R�RZR�(R�tothertprojectR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__iadd__5s
cC@s@|jgdddd�}x||fD]}||7}q(W|S(s4Add an environment or distribution to an environmentR=R0N(R�R3(R�RAtnewR((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__add__AsN(RRRR3RDtPY_MAJORR�R5R6R1R9R�R�R
R?R�RCRE(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRZ�s					
		cB@seZdZRS(sTAn error occurred extracting a resource

    The following attributes are available from instances of this exception:

    manager
        The resource manager that raised this exception

    cache_path
        The base directory for resource extraction

    original_error
        The exception instance that caused extraction to fail
    (RRR(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRdMs
cB@s�eZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zdd	�Z
ed
��Zd�Zd�Zed
�ZRS(s'Manage resource extraction and packagescC@s
i|_dS(N(tcached_files(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�ascC@st|�j|�S(sDoes the named resource exist?(RGR�(R�tpackage_or_requirementR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRQdscC@st|�j|�S(s,Is the named resource an existing directory?(RGRR(R�RHR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRRhscC@st|�j||�S(s4Return a true filesystem path for specified resource(RGR�(R�RHR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyROnscC@st|�j||�S(s9Return a readable file-like object for specified resource(RGR�(R�RHR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRNtscC@st|�j||�S(s%Return specified resource as a string(RGR�(R�RHR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRMzscC@st|�j|�S(s1List the contents of the named resource directory(RGRP(R�RHR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRP�scC@sttj�d}|jpt�}tjd�j�}t|jt	���}||_
||_||_|�dS(s5Give an error message for problems extracting file(s)is
            Can't extract file(s) to egg cache

            The following error occurred while trying to extract file(s)
            to the Python egg cache:

              {old_exc}

            The Python egg cache directory is currently set to:

              {cache_path}

            Perhaps your account does not have write access to this directory?
            You can change the cache directory by setting the PYTHON_EGG_CACHE
            environment variable to point to an accessible directory.
            N(
R<texc_infotextraction_pathRYttextwraptdedenttlstripRdR�R�R�t
cache_pathtoriginal_error(R�told_excRNttmplterr((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytextraction_error�s			cC@sx|jpt�}tjj||d|�}yt|�Wntk
rY|j�nX|j|�d|j	|<|S(s�Return absolute location in cache for `archive_name` and `names`

        The parent directory of the resulting path will be created if it does
        not already exist.  `archive_name` should be the base filename of the
        enclosing egg (which may not be the name of the enclosing zipfile!),
        including its ".egg" extension.  `names`, if provided, should be a
        sequence of path name parts "under" the egg's extraction location.

        This method should only be called by resource providers that need to
        obtain an extraction location, and only for names they intend to
        extract, as it tracks the generated names for possible cleanup later.
        s-tmpi(
RJRYR�R�R>t_bypass_ensure_directoryt	ExceptionRSt_warn_unsafe_extraction_pathRG(R�tarchive_nametnamestextract_pathttarget_path((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytget_cache_path�s



cC@swtjdkr*|jtjd�r*dStj|�j}|tj@sV|tj@rsd|}tj	|t
�ndS(sN
        If the default extraction path is overridden and set to an insecure
        location, such as /tmp, it opens up an opportunity for an attacker to
        replace an extracted file with an unauthorized payload. Warn the user
        if a known insecure location is used.

        See Distribute #375 for more details.
        tnttwindirNs�%s is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).(R�R�R�tenvirontstattst_modetS_IWOTHtS_IWGRPtwarningstwarntUserWarning(R�tmodetmsg((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRV�s
&cC@s@tjdkr<tj|�jdBd@}tj||�ndS(s4Perform any platform-specific postprocessing of `tempname`

        This is where Mac header rewrites should be done; other platforms don't
        have anything special they should do.

        Resource providers should call this method ONLY after successfully
        extracting a compressed resource.  They must NOT call it on resources
        that are already in the filesystem.

        `tempname` is the current (temporary) name of the file, and `filename`
        is the name it will be renamed to by the caller after this routine
        returns.
        tposiximi�N(R�R�R_R`tchmod(R�ttempnametfilenameRf((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytpostprocess�scC@s%|jrtd��n||_dS(s�Set the base path where resources will be extracted to, if needed.

        If you do not call this routine before any extractions take place, the
        path defaults to the return value of ``get_default_cache()``.  (Which
        is based on the ``PYTHON_EGG_CACHE`` environment variable, with various
        platform-specific fallbacks.  See that routine's documentation for more
        details.)

        Resources are extracted to subdirectories of this path based upon
        information given by the ``IResourceProvider``.  You may set this to a
        temporary directory, but then you must call ``cleanup_resources()`` to
        delete the extracted files when done.  There is no guarantee that
        ``cleanup_resources()`` will be able to remove all extracted files.

        (Note: you may not change the extraction path for a given resource
        manager once resources have been extracted, unless you first call
        ``cleanup_resources()``.)
        s5Can't change extraction path, files already extractedN(RGRARJ(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRW�s	cC@sdS(sB
        Delete all extracted resource files and directories, returning a list
        of the file and directory names that could not be successfully removed.
        This function does not have any concurrency protection, so it should
        generally only be called when the extraction path is a temporary
        directory exclusive to a single process.  This method is not
        automatically called; you must call it explicitly or register it as an
        ``atexit`` function if you wish to ensure cleanup of a temporary
        directory used for extractions.
        N((R�tforce((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRXR6N((RRRR3RJR�RQRRRORNRMRPRSR[tstaticmethodRVRlRWR�RX(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR\]s										cC@s"tjjd�p!tjdd�S(s�
    Return the ``PYTHON_EGG_CACHE`` environment variable
    or a platform-relevant user cache dir for an app
    named "Python-Eggs".
    tPYTHON_EGG_CACHEtappnamesPython-Eggs(R�R^R�Rtuser_cache_dir(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRYscC@stjdd|�S(s�Convert an arbitrary string to a standard distribution name

    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    s[^A-Za-z0-9.]+t-(tretsub(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRfscC@sZyttjj|��SWn9tjjk
rU|jdd�}tjdd|�SXdS(sB
    Convert an arbitrary string to a standard version string
    R�R8s[^A-Za-z0-9.]+RrN(R�RRRRR�RsRt(R((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRg%s
cC@stjdd|�j�S(s�Convert an arbitrary string to a standard 'extra' name

    Any runs of non-alphanumeric characters are replaced with a single '_',
    and the result is always lowercased.
    s[^A-Za-z0-9.-]+R�(RsRtR7(R)((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRl1scC@s|jdd�S(s|Convert a project or version name to its filename-escaped form

    Any '-' characters are currently replaced with '_'.
    RrR�(R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRm:scC@s;yt|�Wn&tk
r6}d|_d|_|SXtS(so
    Validate text as a PEP 508 environment marker; return an exception
    if invalid or False otherwise.
    N(RotSyntaxErrorR3RktlinenoR�(ttextte((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRnBs		cC@sLy tjj|�}|j�SWn%tjjk
rG}t|��nXdS(s�
    Evaluate a PEP 508 environment marker.
    Return a boolean indicating the marker result in this environment.
    Raise SyntaxError if marker is invalid.

    This implementation uses the 'pyparsing' module.
    N(RtmarkerstMarkerR+t
InvalidMarkerRu(RwR)R*Rx((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRoPs
cB@s�eZdZdZdZdZd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�ZRS(sETry to implement resources and metadata for arbitrary PEP 302 loaderscC@s:t|dd�|_tjjt|dd��|_dS(NR�t__file__R6(R�R3R�R�R�tdirnametmodule_path(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�fscC@s|j|j|�S(N(t_fnR~(R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�jscC@stj|j||��S(N(tiotBytesIOR�(R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�mscC@s|j|j|j|��S(N(t_getRR~(R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�pscC@s|j|j|j|��S(N(t_hasRR~(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�sscC@s%|jo$|j|j|j|��S(N(tegg_infoR�R(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�vscC@sE|js
dS|j|j|j|��}tjrA|jd�S|S(NR6sutf-8(R�R�RRtPY3tdecode(R�R�tvalue((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�ys	cC@st|j|��S(N(RjR�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�scC@s|j|j|j|��S(N(t_isdirRR~(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRR�scC@s%|jo$|j|j|j|��S(N(R�R�R(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s|j|j|j|��S(N(t_listdirRR~(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRP�scC@s)|jr%|j|j|j|��SgS(N(R�R�R(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s	c
B@sd|}|j|�s4edje����n|j|�jdd�}|jdd�}|j|j|�}||d<ej	j
|�r�e|�j�}e
||d�}|||UnQdd	lm}e|�d|jd�|f||<e
||d�}	|	||UdS(
Nsscripts/s<Script {script!r} not found in metadata at {self.egg_info!r}s
s
s
R|texeci(tcache(R�R`R�R�R�R�RR�R�R�R�R
treadtcompilet	linecacheR�tlenR(
R�R�R�tscripttscript_texttscript_filenametsourcetcodeR�tscript_code((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRF�s"


%cC@std��dS(Ns9Can't perform this operation for unregistered loader type(tNotImplementedError(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@std��dS(Ns9Can't perform this operation for unregistered loader type(R�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@std��dS(Ns9Can't perform this operation for unregistered loader type(R�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s&|r"tjj||jd��S|S(Nt/(R�R�R>R(R�tbaseR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�scC@s2t|jd�r"|jj|�Std��dS(Ntget_datas=Can't perform this operation for loaders without 'get_data()'(R�R�R�R�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��sN(RRRR3tegg_nameR�R�R�R�R�R�R�R�R�R�RRR�RPR�RFR�R�R�RR�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR~_s,																	cB@s eZdZd�Zd�ZRS(s&Provider based on a virtual filesystemcC@stj||�|j�dS(N(R~R�t
_setup_prefix(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s�|j}d}xt||kr�t|�rdtjj|�|_tjj|d�|_||_	Pn|}tjj
|�\}}qWdS(NsEGG-INFO(R~R3t_is_egg_pathR�R�tbasenameR�R>R�tegg_rootR(R�R�toldR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s		(RRRR�R�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�s	cB@sJeZdZd�Zd�Zd�Zd�Zd�Zed��Z	RS(s6Provides access to package resources in the filesystemcC@stjj|�S(N(R�R�R�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@stjj|�S(N(R�R�R(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s
tj|�S(N(R�tlistdir(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@st|j|j|�d�S(Ntrb(R
RR~(R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s&t|d��}|j�SWdQXdS(NR�(R
R�(R�R�tstream((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s)ttdtd��}t||�dS(NtSourceFileLoader(R�timportlib_machineryttypeR3R�(R�t
loader_cls((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt	_register�s
(
RRRR�R�R�R�R�R(R�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s					cB@s<eZdZdZd�ZZd�Zd�Zd�Z	RS(s.Provider that returns nothing for all requestscC@stS(N(R�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR5R6cC@sdS(NR6((R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�scC@sgS(N((R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�scC@sdS(N((R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�	sN(
RRRR3R~R�R�R�R�R�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR|�s
		tZipManifestscB@s#eZdZed��ZeZRS(s
    zip manifest builder
    c@sBtj|��-��fd��j�D�}t|�SWdQXdS(s
        Build a dictionary similar to the zipimport directory
        caches, except instead of tuples, store ZipInfo objects.

        Use a platform-specific path separator (os.sep) for the path keys
        for compatibility with pypy on Windows.
        c3@s3|])}|jdtj��j|�fVqdS(R�N(R�R�tseptgetinfo(R,R�(tzfile(s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pys	<genexpr> sN(tzipfiletZipFiletnamelistR(R�R�R#((R�s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytbuilds	(RRRR(R�tload(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�stMemoizedZipManifestscB@s)eZdZejdd�Zd�ZRS(s%
    Memoized zipfile manifests.
    tmanifest_modsmanifest mtimecC@svtjj|�}tj|�j}||ksC||j|krk|j|�}|j||�||<n||jS(sW
        Load a manifest at path or return a suitable manifest already loaded.
        (	R�R�tnormpathR_tst_mtimetmtimeR�R�tmanifest(R�R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�1s(RRRRt
namedtupleR�R�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�+scB@s�eZdZdZe�Zd�Zd�Zd�Z	e
d��Zd�Ze
d��Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�ZRS(s"Resource support for zips and eggscC@s*tj||�|jjtj|_dS(N(RR�R�tarchiveR�R�tzip_pre(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�EscC@sh|jtj�}||jjkr(dS|j|j�rK|t|j�Std||jf��dS(NR6s%s is not a subpath of %s(	trstripR�R�R�R�R�R�R�tAssertionError(R�tfspath((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt
_zipinfo_nameIscC@sd|j|}|j|jtj�rG|t|j�djtj�Std||jf��dS(Nis%s is not a subpath of %s(R�R�R�R�R�R�RR�(R�tzip_pathR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_partsUs

!cC@s|jj|jj�S(N(t_zip_manifestsR�R�R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytzipinfo_scC@s�|jstd��n|j|�}|j�}dj|j|��|kr~x*|D]}|j||j|��qXWn|j||�S(Ns5resource_filename() only supported for .egg, not .zipR�(R�R�t_resource_to_zipt_get_eager_resourcesR>R�t_extract_resourcet
_eager_to_zip(R�R�R�R�teagersR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�cs	
 cC@s/|j}|jd}tj|�}||fS(Nii����(iii����(t	file_sizet	date_timettimetmktime(tzip_stattsizeR�t	timestamp((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_get_date_and_sizeps	
c
C@s�||j�kr^x9|j�|D]'}|j|tjj||��}q#Wtjj|�S|j|j|�\}}ts�t	d��ny(|j
|j|j|��}|j
||�r�|Stddtjj|��\}}	tj||jj|��tj|�t|	||f�|j|	|�yt|	|�Wnltjk
r�tjj|�r�|j
||�r�|Stjdkr�t|�t|	|�|Sn�nXWntjk
r�|j�nX|S(Ns>"os.rename" and "os.unlink" are not supported on this platforms	.$extracttdirR\(t_indexR�R�R�R>R}R�R�t
WRITE_SUPPORTtIOErrorR[R�R�t_is_currentt_mkstemptwriteR�R�tcloseRRlRterrortisfileR�R	RS(
R�R�R�R�tlastR�R�t	real_pathtoutfttmpnam((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�ysD


c	C@s�|j|j|�\}}tjj|�s2tStj|�}|j|ks_|j|krctS|j	j
|�}t|d��}|j�}WdQX||kS(sK
        Return True if the file_path is current for this zip_path
        R�N(
R�R�R�R�R�R�R_tst_sizeR�R�R�R
R�(	R�t	file_pathR�R�R�R_tzip_contentstft
file_contents((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@sa|jdkrZg}x6dD].}|j|�r|j|j|��qqW||_n|jS(Nsnative_libs.txtseager_resources.txt(snative_libs.txtseager_resources.txt(R�R3R�RR�(R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s
cC@s�y|jSWn�tk
r�i}x~|jD]s}|jtj�}xX|r�tjj|d �}||kr�||j|d�PqF|j�g||<qFWq+W||_|SXdS(Ni����(	t	_dirindextAttributeErrorR�RR�R�R>R�R(R�tindR�tpartstparent((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s
		cC@s.|j|�}||jkp-||j�kS(N(R�R�R�(R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s|j|�|j�kS(N(R�R�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s%t|j�j|j|�d��S(N((RR�R�R�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s|j|j|j|��S(N(R�RR�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s|j|j|j|��S(N(R�RR~(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��sN(RRRR3R�R�R�R�R�R�R�R�R�RnR�R�R�R�R�R�R�R�R�R�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�?s$				
	
		7								cB@s;eZdZd�Zd�Zd�Zd�Zd�ZRS(s*Metadata handler for standalone PKG-INFO files

    Usage::

        metadata = FileMetadata("/path/to/PKG-INFO")

    This provider rejects all data and metadata requests except for PKG-INFO,
    which is treated as existing, and will be the contents of the file at
    the provided location.
    cC@s
||_dS(N(R�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s|dkotjj|j�S(NsPKG-INFO(R�R�R�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s_|dkrtd��ntj|jdddd��}|j�}WdQX|j|�|S(NsPKG-INFOs(No metadata except PKG-INFO is availabletencodingsutf-8terrorsR�(R�R�R
R�R�t_warn_on_replacement(R�R�R�tmetadata((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�s!
cC@sGdjd�}||krCd}|jt��}tj|�ndS(Ns�sutf-8s2{self.path} could not be properly decoded in UTF-8(R�R�R�RcRd(R�R�treplacement_charRQRg((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�	s
cC@st|j|��S(N(RjR�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�s(RRRR�R�R�R�R�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRy�s
					cB@seZdZd�ZRS(ssMetadata provider for egg directories

    Usage::

        # Development eggs:

        egg_info = "/path/to/PackageName.egg-info"
        base_dir = os.path.dirname(egg_info)
        metadata = PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        dist = Distribution(basedir, project_name=dist_name, metadata=metadata)

        # Unpacked egg directories:

        egg_path = "/path/to/PackageName-ver-pyver-etc.egg"
        metadata = PathMetadata(egg_path, os.path.join(egg_path,'EGG-INFO'))
        dist = Distribution.from_filename(egg_path, metadata=metadata)
    cC@s||_||_dS(N(R~R�(R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�)s	(RRRR�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRzscB@seZdZd�ZRS(s Metadata provider for .egg filescC@s`|jtj|_||_|jrFtjj|j|j�|_n|j|_|j	�dS(s-Create a metadata provider from a zipimporterN(
R�R�R�R�R�tprefixR�R>R~R�(R�timporter((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�1s		!(RRRR�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR{.sRt_distribution_finderscC@s|t|<dS(sxRegister `distribution_finder` to find distributions in sys.path items

    `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
    handler), and `distribution_finder` is a callable that, passed a path
    item and the importer instance, yields ``Distribution`` instances found on
    that path item.  See ``pkg_resources.find_on_path`` for an example.N(R�(t
importer_typetdistribution_finder((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�@scC@s+t|�}tt|�}||||�S(s.Yield distributions accessible via `path_item`(RR�R�(t	path_itemtonlyR�tfinder((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRVJsc	c@s!|jjd�rdSt|�}|jd�rHtj|d|�Vn|rRdSx�|jd�D]�}t|�r�tj	j
||�}ttj
|�|�}xu|D]}|Vq�Wqb|j�jd�rbtj	j
||�}ttj
|��}||_tj|||�VqbqbWdS(s@
    Find eggs in zip files; possibly multiple nested eggs.
    s.whlNsPKG-INFOR�R�s
.dist-info(R�tendswithR{R�R]t
from_filenameRPR�R�R�R>tfind_eggs_in_zipt	zipimporttzipimporterR7R�t
from_location(	R�R�R�R�tsubitemtsubpathR�R�tsubmeta((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�Qs$
	cC@sdS(N(((R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytfind_nothingoscC@sd�}t|d|dt�S(sL
    Given a list of filenames, return them in descending order
    by version number.

    >>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg'
    >>> _by_version_descending(names)
    ['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar']
    >>> names = 'Setuptools-1.2.3b1.egg', 'Setuptools-1.2.3.egg'
    >>> _by_version_descending(names)
    ['Setuptools-1.2.3.egg', 'Setuptools-1.2.3b1.egg']
    >>> names = 'Setuptools-1.2.3b1.egg', 'Setuptools-1.2.3.post1.egg'
    >>> _by_version_descending(names)
    ['Setuptools-1.2.3.post1.egg', 'Setuptools-1.2.3b1.egg']
    cS@sYtjj|�\}}tj|jd�|g�}g|D]}tjj|�^q=S(s6
        Parse each component of the filename
        Rr(	R�R�tsplitextt	itertoolstchainRRRR�(R�textR�tpart((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_by_version�sR.R;(tsortedR�(RXR((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_by_version_descendingvs	c
#@s�t���t��rHtj�dt�tjj�d���VdSt��}��fd�|D�}t	|�}xQ|D]I}tjj�|�}t
�|��}x||�D]}	|	Vq�Wq�WdS(s6Yield distributions accessible on a sys.path directoryR�sEGG-INFONc3@s'|]}t�|��r|VqdS(N(tdist_factory(R,R�(R�R�(s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pys	<genexpr>�s(t_normalize_cachedt_is_unpacked_eggR]R�RzR�R�R>tsafe_listdirRR(
R�R�R�R�tfilteredtpath_item_entriesR�tfullpathtfactoryR�((R�R�s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytfind_on_path�s	

cC@sf|j�}tt|jd��}|r.tS|rEt|�rEtS|r_|jd�r_tSt�S(s9
    Return a dist_factory for a path_item and entry
    s	.egg-infos
.dist-infos	.egg-link(s	.egg-infos
.dist-info(	R7R-RR�tdistributions_from_metadataR�RVtresolve_egg_linktNoDists(R�R�R�R7tis_meta((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�s
RcB@s2eZdZd�Zejr'eZnd�ZRS(sS
    >>> bool(NoDists())
    False

    >>> list(NoDists()('anything'))
    []
    cC@stS(N(R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__bool__�scC@s
td�S(N((titer(R�R((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__call__�s(RRRRRtPY2t__nonzero__R(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�s
			cC@s�ytj|�SWnnttfk
r*nXtk
r�}|jtjtjtjfkpot	|dd�dk}|s��q�nXdS(sI
    Attempt to list contents of path, but suppress some exceptions.
    twinerroriN((R�R�tPermissionErrortNotADirectoryErrortOSErrorterrnotENOTDIRtEACCEStENOENTR�R3(R�Rxt	ignorable((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR	�s!
cc@s�tjj|�}tjj|�rUttj|��dkrCdSt||�}nt|�}tjj|�}t	j
|||dt�VdS(Nit
precedence(R�R�R}RR�R�RzRyR�R]R�Rv(R�trootR�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�scc@sDt|��2}x(|D] }|j�}|r|VqqWWdQXdS(s1
    Yield non-empty lines from file at path
    N(R
tstrip(R�R�tline((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytnon_empty_lines�s

c@s>t��}�fd�|D�}tt|�}t|d�S(sa
    Given a path to an .egg-link, resolve distributions
    present in the referenced path.
    c3@s0|]&}tjjtjj��|�VqdS(N(R�R�R>R}(R,tref(R�(s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pys	<genexpr>s((R%RRVtnext(R�treferenced_pathstresolved_pathstdist_groups((R�s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRs

t
FileFindert_namespace_handlerst_namespace_packagescC@s|t|<dS(s�Register `namespace_handler` to declare namespace packages

    `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
    handler), and `namespace_handler` is a callable like this::

        def namespace_handler(importer, path_entry, moduleName, module):
            # return a path_entry to use for child packages

    Namespace handlers are only called if the importer object has already
    agreed that it can handle the relevant path item, and they should only
    return a subpath if the module __path__ does not already contain an
    equivalent subpath.  For an example namespace handler, see
    ``pkg_resources.file_ns_handler``.
    N(R,(R�tnamespace_handler((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�scC@st|�}|dkrdS|j|�}|dkr;dStjj|�}|dkr�tj|�}tj|<g|_t	|�n!t
|d�s�td|��ntt
|�}|||||�}|dk	r|j}|j|�|j|�t|||�n|S(sEEnsure that named package includes a subpath of path_item (if needed)t__path__sNot a package:N(RR3tfind_moduleR<R�R�ttypest
ModuleTypeR/t_set_parent_nsR�R�R�R,R�tload_modulet_rebuild_mod_path(tpackageNameR�R�R�R�thandlerR�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt
_handle_ns*s*	
	

c@s�gtjD]}t|�^q
��fd����fd�}t|t�sVdS|jd|�g|D]}t|�^qm|j(dS(sq
    Rebuild module.__path__ ensuring that all entries are ordered
    corresponding to their sys.path order
    c@s0y�j|�SWntk
r+td�SXdS(s/
        Workaround for #520 and #513.
        tinfN(tindexRAtfloat(R�(tsys_path(s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytsafe_sys_path_indexKs
c@sL|jtj�}�jd�d}|| }�ttjj|���S(sR
        Return the ordinal of the path based on its position in sys.path
        R8i(RR�R�tcountRR>(R�t
path_partstmodule_partsR�(tpackage_nameR=(s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytposition_in_sys_pathTsNR.(R<R�RR�RRR/(t	orig_pathRAR�tpRB((RAR=R<s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR5Ds"		cC@stj�z�|tkrdStjd}}d|kr�dj|jd�d �}t|�|tkrxt	|�nytj
|j}Wq�tk
r�t
d|��q�Xntj|g�j|�tj|g�x|D]}t||�q�WWdtj�XdS(s9Declare that package 'packageName' is a namespace packageNR8i����sNot a package:(t_imptacquire_lockR-R<R�R3R>RRSR�R�R/R�R�R�R�R8trelease_lock(R6R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRSes&




cC@sbtj�zFx?tj|d�D]+}t||�}|r t||�q q WWdtj�XdS(sDEnsure that previously-declared namespace packages include path_itemN((RERFR-R�R8R�RG(R�R�tpackageR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s
cC@s`tjj||jd�d�}t|�}x+|jD]}t|�|kr8Pq8q8W|SdS(sBCompute an ns-package subpath for a filesystem or zipfile importerR8i����N(R�R�R>RRR/(R�R�R6R�R�t
normalizedR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytfile_ns_handler�s"cC@sdS(N(R3(R�R�R6R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytnull_ns_handler�scC@stjjtjj|��S(s1Normalize a file/dir name for comparison purposes(R�R�tnormcasetrealpath(Rk((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRq�scC@s9y||SWn&tk
r4t|�||<}|SXdS(N(R�Rq(RkR�tresult((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�s

cC@s|j�jd�S(s7
    Determine if given path appears to be an egg.
    s.egg(R7R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s.t|�o-tjjtjj|dd��S(s@
    Determine if given path appears to be an unpacked egg.
    sEGG-INFOsPKG-INFO(R�R�R�R�R>(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�scC@sU|jd�}|j�}|rQdj|�}ttj||tj|�ndS(NR8(RRR>tsetattrR<R�(R6R�R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR3�s
cc@s�t|tj�rVxn|j�D]0}|j�}|r|jd�r|VqqWn-x*|D]"}xt|�D]}|VqpWq]WdS(s9Yield non-empty/non-comment lines of a string or sequencet#N(R�RR�t
splitlinesR#R�Rj(tstrststss((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRj�s
s\w+(\.\w+)*$s�
    (?P<name>[^-]+) (
        -(?P<ver>[^-]+) (
            -py(?P<pyver>[^-]+) (
                -(?P<plat>.+)
            )?
        )?
    )?
    cB@s�eZdZdd
dd�Zd�Zd�Zed�Zd�Z	ddd�Z
ejd�Z
edd��Zed	��Zedd
��Zedd��ZRS(s3Object representing an advertised importable objectcC@s[t|�std|��n||_||_t|�|_t|�|_||_dS(NsInvalid module name(tMODULERAR�tmodule_namettupletattrsRR�(R�R�RVRXRR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s		cC@sfd|j|jf}|jr<|ddj|j�7}n|jrb|ddj|j�7}n|S(Ns%s = %st:R8s [%s]t,(R�RVRXR>R(R�RS((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s		cC@sdt|�S(NsEntryPoint.parse(%r)(R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�	scO@sO|s|s|r,tjdtdd�n|rE|j||�n|j�S(sH
        Require packages for this EntryPoint, then resolve it.
        sJParameters to load are deprecated.  Call .resolve and .require separately.t
stackleveli(RcRdtDeprecationWarningRER�(R�RER4tkwargs((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�	s
cC@sdt|jddgdd�}ytjt|j|�SWn%tk
r_}tt|���nXdS(sD
        Resolve the entry point from its module and attrs.
        tfromlistRtleveliN(	R�RVt	functoolstreduceR�RXR�R�R�(R�R�texc((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�	s
cC@sr|jr%|jr%td|��n|jj|j�}tj|||d|j�}tttj|��dS(Ns&Can't require() without a distributionR(	RR�RcR�RTR�RRR�(R�RRR�R#((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRE 	s
s]\s*(?P<name>.+?)\s*=\s*(?P<module>[\w.]+)\s*(:\s*(?P<attr>[\w.]+))?\s*(?P<extras>\[.*\])?\s*$cC@s�|jj|�}|s0d}t||��n|j�}|j|d�}|drl|djd�nd}||d|d|||�S(sParse a single entry point from string `src`

        Entry point syntax follows the form::

            name = some.module:some.attr [extra1, extra2]

        The entry name and module name are required, but the ``:attrs`` and
        ``[extras]`` parts are optional
        s9EntryPoint must be in 'name=module:attrs [extras]' formatRtattrR8R�R�((tpatternR;RAt	groupdictt
_parse_extrasR(R�tsrcR�RCRgtresRRX((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�6	s#cC@s9|s
dStjd|�}|jr2t��n|jS(Ntx((R^R�tspecsRAR(R�textras_specR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRfJ	s	cC@s�t|�std|��ni}xZt|�D]L}|j||�}|j|krptd||j��n|||j<q1W|S(sParse an entry point groupsInvalid group namesDuplicate entry point(RURARjR�R�(R�R@tlinesR�tthisR$R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytparse_groupS	scC@s�t|t�r|j�}nt|�}i}x~|D]v\}}|dkrj|s[q7ntd��n|j�}||kr�td|��n|j|||�||<q7W|S(s!Parse a map of entry point groupss%Entry points must be listed in groupssDuplicate group nameN(R�RR#RkR3RAR#Rn(R�tdataR�tmapsR@Rl((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt	parse_map`	s((N(RRRR3R�R�R�R�R�R�RERsR�RdR(R�RfRnRq(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR_�s 				

		cC@sK|s
dStjj|�}|djd�rGtjj|d d�S|S(NR6i����smd5=(R6(RR�turlparseR�t
urlunparse(R�tparsed((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_remove_md5_fragmentt	scC@s[d�}t||�}tt|�d�}|jd�\}}}t|j��pZdS(s�
    Given an iterable of lines from a Metadata file, return
    the value of the Version field, if present, or None otherwise.
    cS@s|j�jd�S(Nsversion:(R7R�(R$((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytis_version_line�	sR6RYN(RR'Rt	partitionRgR#R3(RlRvt
version_linesR$R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_version_from_file}	s
	cB@s�eZdZdZd%d%d%d%ed%ed�Zed%d��Z	d�Z
ed��Zd�Z
d�Zd�Zd	�Zd
�Zd�Zd�Zed
��Zed��Zd�Zed��Zed��Zed��Zd�Zd&d�Zd�Zd%ed�Zd�Z d�Z!d�Z"d�Z#ed%d��Z$d�Z%d�Z&d%d�Z'd�Z(d%ed �Z)d!�Z*d"�Z+d#�Z,ed$��Z-RS('s5Wrap an actual or potential sys.path entry w/metadatasPKG-INFOcC@sjt|pd�|_|dk	r3t|�|_n||_||_||_||_|p`t	|_
dS(NtUnknown(RfR
R3Rgt_versionR3R=R�R!R}t	_provider(R�R�R�R
RR3R=R!((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��	s				cK@s�dgd\}}}}tjj|�\}}	|	j�tkr�t|	j�}t|�}
|
r�|
jdddd�\}}}}q�n|||d|d|d|d	||�j�S(
NiR�tvertpyverRBR
RR3R=(	R3R�R�R�R7t_distributionImpltEGG_NAMER@t_reload_version(R�R�R�R�R R
RR3R=RR;((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��	s$cC@s|S(N((R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��	scC@s:|j|j|jt|j�|jp*d|jp6dfS(NR6(tparsed_versionR!R.RuR�R3R=(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR:�	scC@s
t|j�S(N(thashR:(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__hash__�	scC@s|j|jkS(N(R:(R�RA((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__lt__�	scC@s|j|jkS(N(R:(R�RA((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__le__�	scC@s|j|jkS(N(R:(R�RA((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__gt__�	scC@s|j|jkS(N(R:(R�RA((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__ge__�	scC@s&t||j�stS|j|jkS(N(R�R�R�R:(R�RA((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__eq__�	scC@s||kS(N((R�RA((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__ne__�	scC@s:y|jSWn(tk
r5|jj�|_}|SXdS(N(t_keyR�R
R7(R�R.((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR.�	s

cC@s+t|d�s$t|j�|_n|jS(Nt_parsed_version(R�RRR�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��	scC@sytjj}t|j|�}|s(dS|js5dStjd�j�jdd�}t	j
|jt|��t
�dS(Ns>
            '{project_name} ({version})' is being parsed as a legacy,
            non PEP 440,
            version. You may find odd behavior and sort order.
            In particular it will be sorted as less than 0.0. It
            is recommended to migrate to PEP 440 compatible
            versions.
            s
R�(RRRR�R�RKRLR#R�RcRdR�tvarsR(R�tLVt	is_legacyRQ((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_warn_legacy_version�	s	cC@sgy|jSWnUtk
rbt|j|j��}|dkr^d}t||j|��n|SXdS(Ns(Missing 'Version:' header and/or %s file(R{R�Ryt
_get_metadatatPKG_INFOR3RA(R�RRQ((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�	s
cC@s>y|jSWn)tk
r6|j|j��|_nX|jS(s~
        A map of extra to its list of (direct) requirements
        for this distribution, including the null extra.
        (t_Distribution__dep_mapR�t_filter_extrast_build_dep_map(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_dep_map

s

cC@s�x�ttd|��D]�}|}|j|�}|jd�\}}}|oet|�pet|�}|rwg}nt|�p�d}|j|g�j	|�qW|S(s�
        Given a mapping of extras to dependencies, strip off
        environment markers and filter out any dependencies
        not matching the markers.
        RYN(
RRR3RRwRnRoRlR�R(tdmR)t	new_extraR�R�R*tfails_marker((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�
s
	cC@s`i}xSdD]K}xBt|j|��D]+\}}|j|g�jt|��q)Wq
W|S(Nsrequires.txtsdepends.txt(srequires.txtsdepends.txt(RkR�R�RRe(R�R�R�R)R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�,
s

"'cC@s�|j}g}|j|jdd��xS|D]K}y|j|t|��Wq/tk
rytd||f��q/Xq/W|S(s@List of Requirements needed for this distro if `extras` are useds%s has no such extra feature %rN((R�RR�R3RlR�Rc(R�RR�tdepsR((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�3
s	

cc@s5|j|�r1x|j|�D]}|VqWndS(N(R�R�(R�R�R$((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�A
scC@s�|dkrtj}n|j|d|�|tjkr�t|j�x6|jd�D]"}|tjkrWt|�qWqWWndS(s>Ensure distribution is importable on `path` (default=sys.path)R�snamespace_packages.txtN(	R3R<R�R�R�R�R�R�RS(R�R�R�tpkg((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytactivateF
s
cC@sOdt|j�t|j�|jp'tf}|jrK|d|j7}n|S(s@Return what this distribution's standard .egg filename should bes
%s-%s-py%sRr(RmR
RR3RFR=(R�Rk((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�Q
s	cC@s(|jrd||jfSt|�SdS(Ns%s (%s)(R�R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�\
s	cC@sMyt|dd�}Wntk
r/d}nX|p9d}d|j|fS(NRs[unknown version]s%s %s(R�R3RAR
(R�R((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�b
s

cC@s.|jd�rt|��nt|j|�S(sADelegate all unrecognized public attributes to .metadata providerR�(R�R�R�R|(R�Rc((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt__getattr__j
scK@s(|jt|�tjj|�||�S(N(R�RR�R�R�(R�RkR�R ((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�p
scC@sTt|jtjj�r1d|j|jf}nd|j|jf}tj|�S(s?Return a ``Requirement`` that matches this distribution exactlys%s==%ss%s===%s(R�R�RRRR
R^R�(R�tspec((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRw
scC@sD|j||�}|dkr:td||ff��n|j�S(s=Return the `name` entry point of `group` or raise ImportErrorsEntry point %r not foundN(RKR3R�R�(R�R@R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRI�
scC@scy
|j}Wn3tk
rBtj|jd�|�}|_nX|dk	r_|j|i�S|S(s=Return the entry point map for `group`, or the full entry mapsentry_points.txtN(t_ep_mapR�R_RqR�R3R�(R�R@tep_map((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRJ�
s

 cC@s|j|�j|�S(s<Return the EntryPoint object for `group`+`name`, or ``None``(RJR�(R�R@R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRK�
sc
C@s�|p|j}|sdSt|�}tjj|�}g|D]}|rVt|�pY|^q>}x�t|�D]�\}}||kr�|r�PqdSqo||kro|jtkro|r�|||kr�dS|tjkr�|j	�n|j
||�|j
||�PqoqoW|tjkr.|j	�n|rG|j
d|�n
|j|�dSxMtr�y|j
||d�}	Wntk
r�Pq[X||	=||	=|	}q[WdS(s�Ensure self.location is on path

        If replace=False (default):
            - If location is already in path anywhere, do nothing.
            - Else:
              - If it's an egg and its parent directory is on path,
                insert just ahead of the parent.
              - Else: add to the end of path.
        If replace=True:
            - If location is already on path anywhere (not eggs)
              or higher priority than its parent (eggs)
              do nothing.
            - Else:
              - If it's an egg and its parent directory is on path,
                insert just ahead of the parent,
                removing any lower-priority entries.
              - Else: add it to the front of path.
        Nii(R�RR�R�R}t	enumerateR!RrR<tcheck_version_conflictR�R�R�R:RA(
R�R�tlocR�tnloctbdirRDtnpathR�tnp((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��
sB+


	

cC@s�|jdkrdStj|jd��}t|j�}x�|jd�D]�}|tjksJ||ksJ|tkr}qJn|dkr�qJnt	tj|dd�}|r�t|�j|�sJ|j|j�r�qJntd|||jf�qJWdS(	Nt
setuptoolssnamespace_packages.txts
top_level.txtt
pkg_resourcestsiteR|sIModule %s was already imported from %s, but %s is being added to sys.path(R�R�R�(
R.RRR�RqR�R<R�R-R�R3R�t
issue_warning(R�tnspR�tmodnametfn((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��
s"cC@s8y|jWn&tk
r3tdt|��tSXtS(NsUnbuilt egg for (RRAR�R�R�R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR<�
s
cK@sYd}x0|j�D]"}|j|t||d��qW|jd|j�|j|�S(s@Copy this distribution, substituting in any changed keyword argss<project_name version py_version platform location precedenceR�N(RR�R�R3R|R�(R�R RXRc((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytclone�
s
 cC@s g|jD]}|r
|^q
S(N(R�(R�tdep((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRsN((.RRRR�R3RFRrR�R(R�R�R�R:R�R�R�R�R�R�R�R.R�R�RR�RnR�R�R�R�R�R�R�R�R�R�R�RRIRJRKR�R�R<R�R(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR]�	sR		
																			D			tEggInfoDistributioncB@seZd�ZRS(cC@s.t|j|j��}|r*||_n|S(s�
        Packages installed by distutils (e.g. numpy or scipy),
        which uses an old safe_version, and so
        their version numbers can get mangled when
        converted to filenames (e.g., 1.11.0.dev0+2329eae to
        1.11.0.dev0_2329eae). These distributions will not be
        parsed properly
        downstream by Distribution and safe_version, so
        take an extra step and try to get the version number from
        the metadata file itself instead of the filename.
        (RyR�R�R{(R�t
md_version((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�s(RRR�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�stDistInfoDistributioncB@sJeZdZdZejd�Zed��Zed��Z	d�Z
RS(sV
    Wrap an actual or potential sys.path entry
    w/metadata, .dist-info style.
    tMETADATAs([\(,])\s*(\d.*?)\s*([,\)])cC@sTy|jSWnBtk
rO|j|j�}tjj�j|�|_|jSXdS(sParse and cache metadataN(t	_pkg_infoR�R�R�temailtparsertParsertparsestr(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_parsed_pkg_info!s
cC@s6y|jSWn$tk
r1|j�|_|jSXdS(N(t_DistInfoDistribution__dep_mapR�t_compute_dependencies(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�+s

c@s�igd6}|_g�x3|jjd�p2gD]}�jt|��q3W�fd�}t|d��}|dj|�xR|jjd�p�gD]8}t|j��}t	t||��|�||<q�W|S(s+Recompute this distribution's dependencies.s
Requires-Distc3@s@x9�D]1}|js0|jji|d6�r|VqqWdS(NR)(R*R+(R)R�(R�(s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pytreqs_for_extra<s
#sProvides-ExtraN(
R3R�R�tget_allRRet	frozensetRlR#R(R�R�R�R�tcommonR)ts_extra((R�s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�3s$(RRRR�RsR�tEQEQR�R�R�R�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�s
s.eggs	.egg-infos
.dist-infocO@snd}t�}y-x&tj|�j|kr:|d7}qWWntk
rOnXtjd|d||�dS(NiR[(RR<R�R�RARcRd(R4R R_R%((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�Rs	
tRequirementParseErrorcB@seZd�ZRS(cC@sdj|j�S(NR�(R>R4(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�`s(RRR�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�_scc@s�tt|��}x�|D]~}d|krA||jd� }n|jd�r�|d j�}y|t|�7}Wq�tk
r�dSXnt|�VqWdS(s�Yield ``Requirement`` objects for each specification in `strs`

    `strs` must be a string, or a (possibly-nested) iterable thereof.
    s #s\i����N(RRjR�R�R#R't
StopIterationR^(RRRlR$((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyReds

cB@sMeZd�Zd�Zd�Zd�Zd�Zd�Zed��Z	RS(cC@sytt|�j|�Wn+tjjk
rG}tt|���nX|j|_	t
|j�}||j�|_|_
g|jD]}|j|jf^q�|_ttt|j��|_|j
|jt|j�|jr�t|j�ndf|_t|j�|_dS(s>DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!N(tsuperR^R�RRtInvalidRequirementR�R�R�tunsafe_nameRfR7R
R.t	specifierR=RRjRWRRlRR�R*R3thashCmpR�t_Requirement__hash(R�trequirement_stringRxR
R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR�{s+$cC@st|t�o|j|jkS(N(R�R^R�(R�RA((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@s||kS(N((R�RA((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@sGt|t�r1|j|jkr%tS|j}n|jj|dt�S(Ntprereleases(R�R]R.R�RR�tcontainsR�(R�R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s
cC@s|jS(N(R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@sdt|�S(NsRequirement.parse(%r)(R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��scC@st|�\}|S(N(Re(RSR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s(
RRR�R�R�R�R�R�RnR�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR^zs						cC@st|kr|tfS|S(sJ
    Ensure object appears in the mro even
    for old-style classes.
    (tobject(tclasses((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_always_object�scC@sPttjt|dt|����}x"|D]}||kr.||Sq.WdS(s2Return an adapter factory for `ob` from `registry`R�N(R�tinspecttgetmroR�R�(tregistryR/R1tt((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s'
cC@s)tjj|�}tj|dt�dS(s1Ensure that the parent directory of `path` existstexist_okN(R�R�R}R
tmakedirsR�(R�R}((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRp�scC@s^tstd��nt|�\}}|rZ|rZt|�rZt|�t|d�ndS(s/Sandbox-bypassing version of ensure_directory()s*"os.mkdir" not supported on this platform.i�N(R�R�RRRTR(R�R}Rk((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRT�s
cc@s�d}g}x�t|�D]y}|jd�r�|jd�rs|sI|rW||fVn|dd!j�}g}q�td|��q|j|�qW||fVdS(ssSplit a string or iterable thereof into (section, content) pairs

    Each ``section`` is a stripped version of the section header ("[section]")
    and each ``content`` is a list of stripped lines excluding blank lines and
    comment-only lines.  If there are any such lines before the first section
    header, they're returned in a first ``section`` of ``None``.
    t[t]ii����sInvalid section headingN(R3RjR�R�R#RAR�(RStsectiontcontentR$((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyRk�s	cO@s7tj}ztt_tj||�SWd|t_XdS(N(R�R
tos_openttempfiletmkstemp(R4R told_open((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR��s
		tignoretcategoryR�cO@s|||�|S(N((R�R4R]((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_call_aside�s
c@s:t���|d<|j�fd�t��D��dS(s=Set up global resource manager (deliberately not state-saved)t_managerc3@s3|])}|jd�s|t�|�fVqdS(R�N(R�R�(R,R�(R�(s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pys	<genexpr>
sN(R\RR�(R%((R�s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_initializes
	
cC@s�tj�}tdd|�|j}|j}|j}|j}|}td�|D��|d�dt�g|_	t
t|jt
j��t�jt��dS(sE
    Prepare the master working set and make the ``require()``
    API available.

    This function has explicit effects on the global state
    of pkg_resources. It is intended to be invoked once at
    the initialization of this module.

    Invocation by other packages is unsupported and done
    at their own risk.
    R�RTcs@s!|]}|jdt�VqdS(R�N(R�R�(R,R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pys	<genexpr>+scS@s|jdt�S(NR�(R�R�(R�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyR5/R6R%N(R[R�R!RERLR&RFRWR�R�RRR�R<R�RRR�(RTRERLRURFR�((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt_initialize_master_working_sets 
						(�Rt
__future__RR<R�R�R�RsR1R�R�RcR_R`tpkgutilR=R=RR�temail.parserR�RR�RKR�R�RRER�timptpkg_resources.externRtpkg_resources.extern.six.movesRRRRRRR	R�R�R�R
R�tos.pathRRtimportlib.machineryt	machineryR�RR3R6R
RRR�tversion_infotRuntimeErrorRRRRERTRUtresources_streamRXtresource_dirRNRWRRRMRLRPRORQR�R,R-tRuntimeWarningRRRR!R'R)R,R0R1R2t
_sget_nonet
_sset_noneRDt__all__RUR`RaR�RbRcR�RRFRrRsRtRuRvR�RGR?R�R9R�R:R�RhRiRFR�RHRIRJRKRwRxR�R[RRRZR�RdR\RYRfRgRlRmRnRoR~RR�R�R|R}R�R�R�R�RyRzR{R�RVR�R�RRRRR	RR%RtImpImporterR�R+R�R8R5RSR�RJRKRqRR�RR3RjR;RUtVERBOSEt
IGNORECASER�R_RuRyR]R�R�RR�RAR�ReRR^R�R�RpRTRkR�tfilterwarningsR�RR�R�(((s:/usr/lib/python2.7/site-packages/pkg_resources/__init__.pyt<module>s�









+										
											 

	
	
			.	
			����							d

	�'	

	 								!	!	
	
			
			�			
�}2
	
	6	
			
			

?>