ok

Mini Shell

Direktori : /opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyc

�
�2{Yc@sddlZddlmZddlZddlZddlZddlZddlZyddlZWne	k
r�ddl
ZnXddlZddlm
Z
ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlmZm Z m!Z!ddl"m#Z#ddl$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,dd	l-m.Z.m/Z/dd
l0m1Z1m2Z2ej3e4�Z5ej6d�Z7ej6dej8�Z9ej6d
�Z:dZ;e<d�Z=defd��YZ>de?fd��YZ@de@fd��YZAde@fd��YZBde?fd��YZCde@fd��YZDde@fd��YZEde@fd��YZFd e@fd!��YZGd"e@fd#��YZHeHeF�eDd$d%d&�d'd(�ZIeIjJZJej6d)�ZKd*e?fd+��YZLdS(,i����N(tBytesIOi(tDistlibException(turljointurlparset
urlunparseturl2pathnametpathname2urltqueuetquotetunescapetstring_typestbuild_openertHTTPRedirectHandlertRequestt	HTTPErrortURLError(tDistributiontDistributionPatht	make_dist(tMetadata(tcached_propertytparse_credentialstensure_slashtsplit_filenametget_project_datatparse_requirementtparse_name_and_versiontServerProxy(t
get_schemetUnsupportedVersionError(tWheelt
is_compatibles^(\w+)=([a-f0-9]+)s;\s*charset\s*=\s*(.*)\s*$stext/html|application/x(ht)?mlshttp://python.org/pypicCs1|dkrt}nt|dd�}|j�S(s�
    Return all distribution names known by an index.
    :param url: The URL of the index.
    :return: A list of all known distribution names.
    ttimeoutg@N(tNonet
DEFAULT_INDEXRt
list_packages(turltclient((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytget_all_distribution_names)s	tRedirectHandlercBs%eZdZd�ZeZZZRS(sE
    A class to work around a bug in some Python 3.2.x releases.
    c	Cs�d}x(dD] }||kr
||}Pq
q
W|dkrAdSt|�}|jdkr�t|j�|�}t|d�r�|j||�q�|||<ntj||||||�S(Ntlocationturittreplace_header(R(R)(	R!RtschemeRtget_full_urlthasattrR+tBaseRedirectHandlerthttp_error_302(	tselftreqtfptcodetmsgtheaderstnewurltkeyturlparts((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR0=s


(t__name__t
__module__t__doc__R0thttp_error_301thttp_error_303thttp_error_307(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR'4s	tLocatorcBs�eZdZdZdZdZdZedZdd�Z	d
�Z
d�Zd�Ze
ee�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed�ZRS(sG
    A base class for locators - things that locate distributions.
    s.tar.gzs.tar.bz2s.tars.zips.tgzs.tbzs.eggs.exes.whls.pdftdefaultcCs1i|_||_tt��|_d|_dS(s^
        Initialise an instance.
        :param scheme: Because locators look for most recent versions, they
                       need to know the version scheme to use. This specifies
                       the current PEP-recommended scheme - use ``'legacy'``
                       if you need to support existing distributions on PyPI.
        N(t_cacheR,RR'topenerR!tmatcher(R1R,((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt__init__cs		cCs|jj�dS(N(RBtclear(R1((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytclear_cacheuscCs|jS(N(t_scheme(R1((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt_get_schemexscCs
||_dS(N(RH(R1tvalue((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt_set_scheme{scCstd��dS(s=
        For a given project, get a dictionary mapping available versions to Distribution
        instances.

        This should be implemented in subclasses.

        If called from a locate() request, self.matcher will be set to a
        matcher for the requirement to satisfy, otherwise it will be None.
        s Please implement in the subclassN(tNotImplementedError(R1tname((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt_get_project�s
cCstd��dS(sJ
        Return all the distribution names known to this locator.
        s Please implement in the subclassN(RL(R1((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytget_distribution_names�scCs`|jdkr!|j|�}n;||jkr@|j|}n|j|�}||j|<|S(s�
        For a given project, get a dictionary mapping available versions to Distribution
        instances.

        This calls _get_project to do all the work, and just implements a caching layer on top.
        N(RBR!RN(R1RMtresult((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytget_project�s
cCs7t|�}|jdkd|jktj|j�fS(su
        Give an url a score which can be used to choose preferred URLs
        for a given project release.
        thttpsspypi.python.org(RR,tnetloct	posixpathtbasenametpath(R1R$tt((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt	score_url�scCs{|}|rw|j|�}|j|�}||kr?|}n||kratjd||�qwtjd||�n|S(sL
        Choose one of two URLs where both are candidates for distribution
        archives for the same version of a distribution (for example,
        .tar.gz vs. zip).

        The current implement favours http:// URLs over https://, archives
        from PyPI over those from other locations and then the archive name.
        sNot replacing %r with %rsReplacing %r with %r(RXtloggertdebug(R1turl1turl2RPts1ts2((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt
prefer_url�s		cCs
t||�S(sZ
        Attempt to split a filename in project name, version and Python version.
        (R(R1tfilenametproject_name((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR�scCs�d�}d}t|�\}}}}}	}
|
j�jd�rXtjd||
�ntj|
�}|r�|j�\}}
nd\}}
|}|r�|ddkr�|d }n|j	d�r�y�t
|�}t||j�r�|dkr�t
}n||j|�}|r�i|jd6|jd6|jd	6t|||||	d
f�d6djg|jD]}d
jt|d��^qd�d6}q�nWq�tk
r�}tjd|�q�Xn|j	|j�r�tj|�}}x�|jD]�}|j	|�r�|t|� }|j||�}|s@tjd|�nu|\}}}|se|||�r�i|d6|d6|d	6t|||||	d
f�d6}|r�||d<q�nPq�q�Wn|r�|r�|
|d|<n|S(s
        See if a URL is a candidate for a download URL for a project (the URL
        has typically been scraped from an HTML page).

        If it is, a dictionary is returned with keys "name", "version",
        "filename" and "url"; otherwise, None is returned.
        cSsV|j�|j�}}||kr.t}n$|jdd�|jdd�k}|S(Nt_t-(tlowertTruetreplace(tname1tname2RP((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytsame_project�s
	$segg=s %s: version hint in fragment: %ri����t/s.whlRMtversionR`R*R$s, t.ispython-versionsinvalid path for wheel: %ss No match for project/version: %ss	%s_digestN(NN(R!RRdt
startswithRYRZtHASHER_HASHtmatchtgroupstendswithRRt
wheel_tagsReRMRkR`Rtjointpyvertlistt	Exceptiontwarningtdownloadable_extensionsRTRUtlenR(R1R$RaRiRPR,RSRVtparamstquerytfragtmtalgotdigesttorigpathtwheeltincludetvteR`textRWRMRkRt((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytconvert_url_to_download_info�sj	
	

	


@cCsEd}x8dD]0}d|}||kr
|||f}Pq
q
W|S(s�
        Get a digest from a dictionary by looking at keys of the form
        'algo_digest'.

        Returns a 2-tuple (algo, digest) if found, else None. Currently
        looks only for SHA256, then MD5.
        tsha256tmd5s	%s_digestN(R�R�(R!(R1tinfoRPR~R8((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt_get_digests

cCs�|jd�}|jd�}||kr@||}|j}n!t||d|j�}|j}|j|�|_|j|dkr�|j|j|d�|_n||_|||<dS(s�
        Update a result dictionary (the final result from _get_project) with a dictionary for a
        specific version, whih typically holds information gleaned from a filename or URL for an
        archive for the distribution.
        RMRkR,R$N(	tpoptmetadataRR,R�Rt
source_urlR_tlocator(R1RPR�RMRktdisttmd((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt_update_version_data#s
		cCs�d
}t|�}|d
kr1td|��nt|j�}|j|j�|_}tjd|t	|�j
�|j|j�}|r�g}|j
}	x�|D]�}
ye|j|
�s�tjd||
�n<|s�|	|
�jr�|j|
�ntjd|
|j�Wq�tk
r4tjd||
�q�Xq�Wt|�dkrct|d|j�}n|r�tjd|�||d	}q�n|r�|jr�|j|_nd
|_|S(s
        Find the most recent distribution which matches the given
        requirement.

        :param requirement: A requirement of the form 'foo (1.0)' or perhaps
                            'foo (>= 1.0, < 2.0, != 1.3)'
        :param prereleases: If ``True``, allow pre-release versions
                            to be located. Otherwise, pre-release versions
                            are not returned.
        :return: A :class:`Distribution` instance, or ``None`` if no such
                 distribution could be located.
        sNot a valid requirement: %rsmatcher: %s (%s)s%s did not match %rs%skipping pre-release version %s of %sserror matching %s with %riR8ssorted list: %si����N(R!RRRR,RDtrequirementRYRZttypeR:RQRMt
version_classRot
is_prereleasetappendRvRwRytsortedR8textras(R1R�tprereleasesRPtrR,RDtversionstslisttvclstk((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytlocate7s>
	
	
	(s.tar.gzs.tar.bz2s.tars.zips.tgzs.tbz(s.eggs.exes.whl(s.pdfN(s.whl(R:R;R<tsource_extensionstbinary_extensionstexcluded_extensionsR!RrRxRERGRIRKtpropertyR,RNRORQRXR_RR�R�R�tFalseR�(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR@Ss*
											M		tPyPIRPCLocatorcBs)eZdZd�Zd�Zd�ZRS(s�
    This locator uses XML-RPC to locate distributions. It therefore
    cannot be used with simple mirrors (that only mirror file content).
    cKs8tt|�j|�||_t|dd�|_dS(s�
        Initialise an instance.

        :param url: The URL to use for XML-RPC.
        :param kwargs: Passed to the superclass constructor.
        R g@N(tsuperR�REtbase_urlRR%(R1R$tkwargs((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyREms	cCst|jj��S(sJ
        Return all the distribution names known to this locator.
        (tsetR%R#(R1((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyROxsc
Csi}|jj|t�}x�|D]�}|jj||�}|jj||�}td|j�}|d|_|d|_|j	d�|_
|j	dg�|_|j	d�|_t
|�}|r"|d}	|	d|_|j|	�|_||_|||<q"q"W|S(	NR,RMRktlicensetkeywordstsummaryiR$(R%tpackage_releasesRetrelease_urlstrelease_dataRR,RMRktgetR�R�R�RR�R�RR�(
R1RMRPR�R�turlstdataR�R�R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRN~s&




	(R:R;R<RERORN(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR�hs		tPyPIJSONLocatorcBs)eZdZd�Zd�Zd�ZRS(sw
    This locator uses PyPI's JSON interface. It's very limited in functionality
    nad probably not worth using.
    cKs)tt|�j|�t|�|_dS(N(R�R�RERR�(R1R$R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRE�scCstd��dS(sJ
        Return all the distribution names known to this locator.
        sNot available from this locatorN(RL(R1((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRO�scCsPi}t|jdt|��}y|jj|�}|j�j�}tj|�}t	d|j
�}|d}|d|_|d|_|j
d�|_|j
dg�|_|j
d�|_t|�}|d	}	|	r%|	d
}
|
d|_|j|
�|_||_|||j<nWn#tk
rK}tjd|�nX|S(
Ns%s/jsonR,R�RMRkR�R�R�R�iR$sJSON fetch failed: %s(RR�RRCtopentreadtdecodetjsontloadsRR,RMRkR�R�R�R�RR�R�RR�RvRYt	exception(R1RMRPR$trespR�tdR�R�R�R�R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRN�s0





	(R:R;R<RERORN(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR��s		tPagecBszeZdZejdejejBejB�ZejdejejB�Z	d�Z
ejdej�Zed��Z
RS(s4
    This class represents a scraped HTML page.
    s�
(rel\s*=\s*(?:"(?P<rel1>[^"]*)"|'(?P<rel2>[^']*)'|(?P<rel3>[^>\s
]*))\s+)?
href\s*=\s*(?:"(?P<url1>[^"]*)"|'(?P<url2>[^']*)'|(?P<url3>[^>\s
]*))
(\s+rel\s*=\s*(?:"(?P<rel4>[^"]*)"|'(?P<rel5>[^']*)'|(?P<rel6>[^>\s
]*)))?
s!<base\s+href\s*=\s*['"]?([^'">]+)cCsM||_||_|_|jj|j�}|rI|jd�|_ndS(sk
        Initialise an instance with the Unicode page contents and the URL they
        came from.
        iN(R�R�R$t_basetsearchtgroup(R1R�R$R}((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRE�s
	s[^a-z0-9$&+,/:;=?@.#%_\\|-]cCsd�}t�}x�|jj|j�D]�}|jd�}|dpv|dpv|dpv|dpv|dpv|d}|d	p�|d
p�|d}t|j|�}t|�}|jj	d�|�}|j
||f�q(Wt|d
d�dt�}|S(s�
        Return the URLs of all the links on a page together with information
        about their "rel" attribute, for determining which ones to treat as
        downloads and which ones to queue for further scraping.
        cSs@t|�\}}}}}}t||t|�|||f�S(sTidy up an URL.(RRR(R$R,RSRVRzR{R|((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytclean�sR*trel1trel2trel3trel4trel5trel6R[R\turl3cSsdt|jd��S(Ns%%%2xi(tordR�(R}((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt<lambda>�sR8cSs|dS(Ni((RW((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR��streverse(
R�t_hreftfinditerR�t	groupdictRR�R	t	_clean_retsubtaddR�Re(R1R�RPRoR�trelR$((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytlinks�s		(R:R;R<tretcompiletItStXR�R�RER�RR�(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR��s	tSimpleScrapingLocatorcBs�eZdZiejd6d�d6d�d6Zddd�Zd�Zd	�Z	d
�Z
ejdej
�Zd�Zd
�Zd�Zd�Zd�Zejd�Zd�ZRS(s�
    A locator which scrapes HTML pages to locate downloads for a distribution.
    This runs multiple threads to do the I/O; performance is at least as good
    as pip's PackageFinder, which works in an analogous fashion.
    tdeflatecCstjdtt��j�S(Ntfileobj(tgziptGzipFileRR�R�(tb((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR�sR�cCs|S(N((R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR�stnonei
cKs�tt|�j|�t|�|_||_i|_t�|_t	j
�|_t�|_t
|_||_tj�|_tj�|_dS(s�
        Initialise an instance.
        :param url: The root URL to use for scraping.
        :param timeout: The timeout, in seconds, to be applied to requests.
                        This defaults to ``None`` (no timeout specified).
        :param num_workers: The number of worker threads you want to do I/O,
                            This defaults to 10.
        :param kwargs: Passed to the superclass.
        N(R�R�RERR�R t_page_cacheR�t_seenRtQueuet	_to_fetcht
_bad_hostsR�tskip_externalstnum_workerst	threadingtRLockt_lockt_gplock(R1R$R R�R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyREs
				cCscg|_xSt|j�D]B}tjd|j�}|jt�|j�|jj	|�qWdS(s�
        Threads are created only when get_project is called, and terminate
        before it returns. They are there primarily to parallelise I/O (i.e.
        fetching web pages).
        ttargetN(
t_threadstrangeR�R�tThreadt_fetcht	setDaemonRetstartR�(R1tiRW((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt_prepare_threadss	

cCsOx!|jD]}|jjd�q
Wx|jD]}|j�q.Wg|_dS(su
        Tell all the threads to terminate (by sending a sentinel value) and
        wait for them to do so.
        N(R�R�tputR!Rs(R1RW((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt
_wait_threads,s
c	Cs�i}|j��||_||_t|jdt|��}|jj�|jj�|j	�z1t
jd|�|jj
|�|jj�Wd|j�X|`WdQX|S(Ns%s/sQueueing %s(R�RPRaRR�RR�RFR�R�RYRZR�R�RsR�(R1RMRPR$((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRN9s
		


s<\b(linux-(i\d86|x86_64|arm\w+)|win(32|-amd64)|macosx-?\d+)\bcCs|jj|�S(sD
        Does an URL refer to a platform-specific download?
        (tplatform_dependentR�(R1R$((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt_is_platform_dependentNscCsp|j|�rd}n|j||j�}tjd||�|rl|j�|j|j|�WdQXn|S(s%
        See if an URL is a suitable download for a project.

        If it is, register information in the result dictionary (for
        _get_project) about the specific version it's for.

        Note that the return value isn't actually used other than as a boolean
        value.
        sprocess_download: %s -> %sN(	R�R!R�RaRYRZR�R�RP(R1R$R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt_process_downloadTs
	
c
Cst|�\}}}}}}|j|j|j|j�rGt}n�|jrl|j|j�rlt}n�|j|j�s�t}ny|dkr�t}nd|dkr�t}nO|j	|�r�t}n7|j
dd�d}	|	j�d	kr�t}nt}t
jd
||||�|S(
s�
        Determine whether a link URL from a referring page and with a
        particular "rel" attribute should be queued for scraping.
        thomepagetdownloadthttpRRtftpt:iit	localhosts#should_queue: %s (%s) from %s -> %s(R�R�(R�shttpsR�(RRqR�R�R�R�R�RmR�R�tsplitRdReRYRZ(
R1tlinktreferrerR�R,RSRVRbRPthost((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt
_should_queuehs*
							
cCs�x�tr�|jj�}z�|r�|j|�}|dkrBwnx�|jD]y\}}||jkrL|jj|�|j|�r�|j	|||�r�t
jd||�|jj|�q�qLqLWnWd|jj
�X|sPqqWdS(s�
        Get a URL to fetch from the work queue, get the HTML page, examine its
        links for download candidates and candidates for further scraping.

        This is a handy method to run in a thread.
        sQueueing %s from %sN(ReR�R�tget_pageR!R�R�R�R�RRYRZR�t	task_done(R1R$tpageR�R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR��s"	!cCs�t|�\}}}}}}|dkrZtjjt|��rZtt|�d�}n||jkr�|j|}tj	d||�nK|j
dd�d}d}||jkr�tj	d||�n
t
|did	d
6�}z�y7tj	d|�|jj|d|j�}	tj	d
|�|	j�}
|
jdd�}tj|�r|	j�}|	j�}
|
jd�}|r�|j|}||
�}
nd}tj|�}|r�|jd�}ny|
j|�}
Wn tk
r�|
jd�}
nXt|
|�}||j|<nWn�tk
rZ}|jdkr�tj d||�q�nkt!k
r�}tj d||�|j"�|jj#|�WdQXn&t$k
r�}tj d||�nXWd||j|<X|S(s
        Get the HTML for an URL, possibly from an in-memory cache.

        XXX TODO Note: this cache is never actually cleared. It's assumed that
        the data won't get stale over the lifetime of a locator instance (not
        necessarily true for the default_locator).
        tfiles
index.htmlsReturning %s from cache: %sR�iisSkipping %s due to bad host %sR6tidentitysAccept-encodingsFetching %sR s
Fetched %ssContent-TypeR*sContent-Encodingsutf-8slatin-1i�sFetch failed: %s: %sN(%RtosRVtisdirRRRR�RYRZR�R!R�R
RCR�R R�R�tHTML_CONTENT_TYPERotgeturlR�tdecoderstCHARSETR�R�R�tUnicodeErrorR�RR4R�RR�R�Rv(R1R$R,RSRVRbRPRR2R�R6tcontent_typet	final_urlR�tencodingtdecoderR}R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR�s\	$



s<a href=[^>]*>([^<]+)<cCsqt�}|j|j�}|s7td|j��nx3|jj|j�D]}|j|jd��qMW|S(sJ
        Return all the distribution names known to this locator.
        sUnable to get %si(	R�RR�Rt_distname_reR�R�R�R�(R1RPRRo((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRO�s	N(R:R;R<tzlibt
decompressRR!RER�R�RNR�R�R�R�R�R�RR�RRRO(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR��s$


	
	
							;tDirectoryLocatorcBs2eZdZd�Zd�Zd�Zd�ZRS(s?
    This class locates distributions in a directory tree.
    cKso|jdt�|_tt|�j|�tjj|�}tjj	|�sbt
d|��n||_dS(s�
        Initialise an instance.
        :param path: The root of the directory tree to search.
        :param kwargs: Passed to the superclass constructor,
                       except for:
                       * recursive - if True (the default), subdirectories are
                         recursed into. If False, only the top-level directory
                         is searched,
        t	recursivesNot a directory: %rN(R�ReRR�RRERRVtabspathR	Rtbase_dir(R1RVR�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRE�s
cCs|j|j�S(s�
        Should a filename be considered as a candidate for a distribution
        archive? As well as the filename, the directory which contains it
        is provided, though not used by the current implementation.
        (RqRx(R1R`tparent((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytshould_includesc		Cs�i}x�tj|j�D]�\}}}x�|D]�}|j||�r/tjj||�}tddttjj|��dddf�}|j	||�}|r�|j
||�q�q/q/W|jsPqqW|S(NRR*(RtwalkRRRVRsRRRR�R�R(	R1RMRPtroottdirstfilestfnR$R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRNs"
		c	Cs�t�}x�tj|j�D]�\}}}x�|D]�}|j||�r2tjj||�}tddttjj	|��dddf�}|j
|d�}|r�|j|d�q�q2q2W|j
sPqqW|S(sJ
        Return all the distribution names known to this locator.
        RR*RMN(R�RRRRRVRsRRRR�R!R�R(R1RPRRRR R$R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyROs	"
		(R:R;R<RERRNRO(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR�s
			tJSONLocatorcBs eZdZd�Zd�ZRS(s
    This locator uses special extended metadata (not available on PyPI) and is
    the basis of performant dependency resolution in distlib. Other locators
    require archive downloads before dependencies can be determined! As you
    might imagine, that can be slow.
    cCstd��dS(sJ
        Return all the distribution names known to this locator.
        sNot available from this locatorN(RL(R1((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRO2sc	Cs
i}t|�}|r	x�|jdg�D]�}|ddks+|ddkrWq+nt|d|dd|jdd	�d
|j�}|j}|d|_d|kr�|dr�d
|df|_n|jdi�|_|jdi�|_|||j	<q+Wn|S(NRtptypetsdistt	pyversiontsourceRMRkR�sPlaceholder for summaryR,R$RR�trequirementstexports(
RR�RR,R�R�RtdependenciesR'Rk(R1RMRPR�R�R�R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRN8s$ 			
(R:R;R<RORN(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR!+s	tDistPathLocatorcBs eZdZd�Zd�ZRS(s�
    This locator finds installed distributions in a path. It can be useful for
    adding to an :class:`AggregatingLocator`.
    cKs8tt|�j|�t|t�s+t�||_dS(ss
        Initialise an instance.

        :param distpath: A :class:`DistributionPath` instance to search.
        N(R�R)REt
isinstanceRtAssertionErrortdistpath(R1R,R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyREUscCs;|jj|�}|dkr'i}ni||j6}|S(N(R,tget_distributionR!Rk(R1RMR�RP((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRN_s
	(R:R;R<RERN(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR)Ps	
tAggregatingLocatorcBsPeZdZd�Zd�Zd�Zeejj	e�Zd�Z
d�ZRS(sI
    This class allows you to chain and/or merge a list of locators.
    cOs8|jdt�|_||_tt|�j|�dS(s�
        Initialise an instance.

        :param locators: The list of locators to search.
        :param kwargs: Passed to the superclass constructor,
                       except for:
                       * merge - if False (the default), the first successful
                         search from any of the locators is returned. If True,
                         the results from all locators are merged (this can be
                         slow).
        tmergeN(R�R�R/tlocatorsR�R.RE(R1R0R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyREls	cCs5tt|�j�x|jD]}|j�qWdS(N(R�R.RGR0(R1R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRG|scCs*||_x|jD]}||_qWdS(N(RHR0R,(R1RJR�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRK�s	cCs�i}x�|jD]�}|j|�}|r|jrD|j|�q�|jdkr\t}n3t}x*|D]"}|jj|�rit}PqiqiW|r�|}Pq�qqW|S(N(	R0RQR/tupdateRDR!ReR�Ro(R1RMRPR�R�tfoundR�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRN�s"		
cCsIt�}x9|jD].}y||j�O}Wqtk
r@qXqW|S(sJ
        Return all the distribution names known to this locator.
        (R�R0RORL(R1RPR�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRO�s	
(R:R;R<RERGRKR�R@R,tfgetRNRO(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR.hs				shttps://pypi.python.org/simple/R g@R,tlegacys1(?P<name>[\w-]+)\s*\(\s*(==\s*)?(?P<ver>[^)]+)\)$tDependencyFindercBsVeZdZdd�Zd�Zd�Zd�Zd�Zd�Z	de
d�ZRS(	s0
    Locate dependencies for distributions.
    cCs(|p	t|_t|jj�|_dS(sf
        Initialise an instance, using the specified locator
        to locate distributions.
        N(tdefault_locatorR�RR,(R1R�((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyRE�scCs�tjd|�|j}||j|<||j||jf<x^|jD]S}t|�\}}tjd|||�|jj	|t
��j||f�qFWdS(s�
        Add a distribution to the finder. This will update internal information
        about who provides what.
        :param dist: The distribution to add.
        sadding distribution %ssAdd to provided: %s, %s, %sN(RYRZR8t
dists_by_nametdistsRktprovidesRtprovidedt
setdefaultR�R�(R1R�RMtpRk((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytadd_distribution�s	
cCs�tjd|�|j}|j|=|j||jf=xl|jD]a}t|�\}}tjd|||�|j|}|j	||f�|s@|j|=q@q@WdS(s�
        Remove a distribution from the finder. This will update internal
        information about who provides what.
        :param dist: The distribution to remove.
        sremoving distribution %ss Remove from provided: %s, %s, %sN(
RYRZR8R7R8RkR9RR:tremove(R1R�RMR<Rkts((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytremove_distribution�s	

cCsPy|jj|�}Wn3tk
rK|j�d}|jj|�}nX|S(s�
        Get a version matcher for a requirement.
        :param reqt: The requirement
        :type reqt: str
        :return: A version matcher (an instance of
                 :class:`distlib.version.Matcher`).
        i(R,RDRR�(R1treqtRDRM((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytget_matcher�s
c	Cs�|j|�}|j}t�}|j}||kr�x_||D]P\}}y|j|�}Wntk
ryt}nX|rA|j|�PqAqAWn|S(s�
        Find the distributions which can fulfill a requirement.

        :param reqt: The requirement.
         :type reqt: str
        :return: A set of distribution which can fulfill the requirement.
        (RBR8R�R:RoRR�R�(	R1RARDRMRPR:RktproviderRo((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytfind_providers�s			


c	Cs�|j|}t�}x?|D]7}|j|�}|j|j�s|j|�qqW|r�|jd|||f�t}nZ|j|�|j|=x-|D]%}|jj|t��j|�q�W|j	|�t
}|S(s�
        Attempt to replace one provider with another. This is typically used
        when resolving dependencies from multiple sources, e.g. A requires
        (B >= 1.0) while C requires (B >= 1.1).

        For successful replacement, ``provider`` must meet all the requirements
        which ``other`` fulfills.

        :param provider: The provider we are trying to replace with.
        :param other: The provider we're trying to replace.
        :param problems: If False is returned, this will contain what
                         problems prevented replacement. This is currently
                         a tuple of the literal string 'cantreplace',
                         ``provider``, ``other``  and the set of requirements
                         that ``provider`` couldn't fulfill.
        :return: True if we can replace ``other`` with ``provider``, else
                 False.
        tcantreplace(treqtsR�RBRoRkR�R�R@R;R=Re(	R1RCtothertproblemstrlistt	unmatchedR?RDRP((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyttry_to_replaces 
	
	


#
c	Csi|_i|_i|_i|_t|p0g�}d|krk|jd�|tdddg�O}nt|t�r�|}}tj	d|�nK|j
j|d|�}}|dkr�t
d|��ntj	d|�t|_t�}t|g�}t|g�}x�|r�|j�}|j}	|	|jkrO|j|�n/|j|	}
|
|kr~|j||
|�n|j|jB}|j}t�}
||kr�xAdD]6}d|}||kr�|
t|d
|�O}
q�q�Wn||B|
B}x�|D]�}|j|�}|s+tj	d|�|j
j|d|�}|dkrv|rv|j
j|dt�}n|dkr�tj	d|�|jd|f�q+|j|j}}||f|jkr�|j|�n|j|�||kr+||kr+|j|�tj	d|j�q+nxw|D]o}|j}	|	|jkrr|jj|t��j|�q2|j|	}
|
|kr2|j||
|�q2q2WqWqWt|jj��}x<|D]4}||k|_|jr�tj	d|j�q�q�Wtj	d|�||fS(s�
        Find a distribution and all distributions it depends on.

        :param requirement: The requirement specifying the distribution to
                            find, or a Distribution instance.
        :param meta_extras: A list of meta extras such as :test:, :build: and
                            so on.
        :param prereleases: If ``True``, allow pre-release versions to be
                            returned - otherwise, don't return prereleases
                            unless they're all that's available.

        Return a set of :class:`Distribution` instances and a set of
        problems.

        The distributions returned should be such that they have the
        :attr:`required` attribute set to ``True`` if they were
        from the ``requirement`` passed to ``find()``, and they have the
        :attr:`build_time_dependency` attribute set to ``True`` unless they
        are post-installation dependencies of the ``requirement``.

        The problems should be a tuple consisting of the string
        ``'unsatisfied'`` and the requirement which couldn't be satisfied
        by any distribution known to the locator.
        s:*:s:test:s:build:s:dev:spassed %s as requirementR�sUnable to locate %rs
located %sttesttbuildtdevs:%s:s%s_requiressNo providers found for %rsCannot satisfy %rtunsatisfiedsAdding %s to install_distss#%s is a build-time dependency only.sfind done for %sN(RLsbuildRN(R:R8R7RFR�R>R*RRYRZR�R�R!RRet	requestedR�R8R=RKtrun_requirest
meta_requirestbuild_requirestgetattrRDR�Rktname_and_versionR;tvaluestbuild_time_dependency(R1R�tmeta_extrasR�R�todistRHttodot
install_distsRMRGtireqtstsreqtstereqtsR8R�t	all_reqtsR�t	providersRCtnR�R<R8((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pytfind>s�				


				
		

!


	
	"
"
		N(R:R;R<R!RER=R@RBRDRKR�Rb(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyR5�s					'(MR�tioRR�tloggingRRTR�R�tImportErrortdummy_threadingRR*RtcompatRRRRRRRR	R
RRR/R
RRtdatabaseRRRR�RtutilRRRRRRRRRkRRR�RRt	getLoggerR:RYR�RnR�R
R
R"R!R&R'tobjectR@R�R�R�R�RR!R)R.R6R�tNAME_VERSION_RER5(((sM/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/locators.pyt<module>sV
^:�+*:�A%N				

Zerion Mini Shell 1.0