ok

Mini Shell

Direktori : /proc/thread-self/root/usr/lib/python2.7/site-packages/pip/_vendor/distlib/
Upload File :
Current File : //proc/thread-self/root/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyc

�
��abc@s&ddlZddlmZddlZddlZddlZddlZddlZyddlZWne	k
r�ddl
ZnXddlZddlm
Z
ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlm Z m!Z!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.dd	l/m0Z0m1Z1dd
l2m3Z3m4Z4ej5e6�Z7ej8d�Z9ej8dej:�Z;ej8d
�Z<dZ=e>d�Z?defd��YZ@deAfd��YZBdeBfd��YZCdeBfd��YZDdeAfd��YZEdeBfd��YZFdeBfd��YZGdeBfd��YZHd eBfd!��YZId"eBfd#��YZJeJeH�eFd$d%d&�d'd(�ZKeKjLZLej8d)�ZMd*eAfd+��YZNdS(,i����N(tBytesIOi(tDistlibException(turljointurlparset
urlunparseturl2pathnametpathname2urltqueuetquotetunescapetstring_typestbuild_openertHTTPRedirectHandlert	text_typetRequestt	HTTPErrortURLError(tDistributiontDistributionPatht	make_dist(tMetadata(	tcached_propertytparse_credentialstensure_slashtsplit_filenametget_project_datatparse_requirementtparse_name_and_versiontServerProxytnormalize_name(t
get_schemetUnsupportedVersionError(tWheelt
is_compatibles^(\w+)=([a-f0-9]+)s;\s*charset\s*=\s*(.*)\s*$stext/html|application/x(ht)?mlshttps://pypi.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((s@/usr/lib/python2.7/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((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR2=s


(t__name__t
__module__t__doc__R2thttp_error_301thttp_error_303thttp_error_307(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR)4s	tLocatorcBs�eZdZdZdZdZdZed Zdd�Z	d
�Z
d�Zd�Zd�Z
d�Zee
e�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.pdftdefaultcCs@i|_||_tt��|_d|_tj�|_	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#tmatcherRtQueueterrors(R3R.((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt__init__cs
			cCsmg}x`|jj�shy#|jjt�}|j|�Wn|jjk
rWq	nX|jj�q	W|S(s8
        Return any errors which have occurred.
        (RHtemptytgettFalsetappendtEmptyt	task_done(R3tresultte((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt
get_errorsvscCs|j�dS(s>
        Clear any errors which may have been logged.
        N(RR(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytclear_errors�scCs|jj�dS(N(RDtclear(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytclear_cache�scCs|jS(N(t_scheme(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_get_scheme�scCs
||_dS(N(RV(R3tvalue((s@/usr/lib/python2.7/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(R3tname((s@/usr/lib/python2.7/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(RZ(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytget_distribution_names�scCsj|jdkr!|j|�}nE||jkr@|j|}n&|j�|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(RDR#R\RS(R3R[RP((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytget_project�s

cCsyt|�}tj|j�}t}|jd�}|rTtt|�|j�}n|j	dkd|j
k|||fS(su
        Give an url a score which can be used to choose preferred URLs
        for a given project release.
        s.whlthttpsspypi.python.org(Rt	posixpathtbasenametpathtTruetendswithR!R t
wheel_tagsR.tnetloc(R3R&ttRat
compatibletis_wheel((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt	score_url�scCs{|}|rw|j|�}|j|�}||kr?|}n||kratjd||�qwtjd||�n|S(s{
        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 implementation favours https:// URLs over http://, archives
        from PyPI over those from other locations, wheel compatibility (if a
        wheel) and then the archive name.
        sNot replacing %r with %rsReplacing %r with %r(Rjtloggertdebug(R3turl1turl2RPts1ts2((s@/usr/lib/python2.7/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(R3tfilenametproject_name((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR�sc	Cs�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.
        cSst|�t|�kS(N(R(tname1tname2((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytsame_project�ssegg=s %s: version hint in fragment: %ri����t/s.whlR[tversionRrR,R&s, t.ispython-versionsinvalid path for wheel: %ss No match for project/version: %ss	%s_digestN(NN(R#Rtlowert
startswithRkRltHASHER_HASHtmatchtgroupsRdR R!ReRcR[RxRrRtjointpyvertlistt	Exceptiontwarningtdownloadable_extensionsR`RatlenR(R3R&RsRvRPR.RfRbtparamstquerytfragtmtalgotdigesttorigpathtwheeltincludetvRQRrtextRgR[RxR�((s@/usr/lib/python2.7/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#(R3tinfoRPR�R:((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_get_digest)s

c	Cs�|jd�}|jd�}||kr@||}|j}n!t||d|j�}|j}|j|�|_}|d}||d|<|j|dkr�|j|j|�|_|dj|t	��j
|�n||_|||<dS(s�
        Update a result dictionary (the final result from _get_project) with a
        dictionary for a specific version, which typically holds information
        gleaned from a filename or URL for an archive for the distribution.
        R[RxR.R&tdigeststurlsN(tpoptmetadataRR.R�R�t
source_urlRqt
setdefaulttsettaddtlocator(	R3RPR�R[RxtdisttmdR�R&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_update_version_data9s
	
#	cCsUd
}t|�}|d
kr1td|��nt|j�}|j|j�|_}tjd|t	|�j
�|j|j�}t
|�dkr�g}|j}	x�|D]�}
|
dkr�q�nye|j|
�s�tjd||
�n<|s|	|
�jr|j|
�ntjd|
|j�Wq�tk
rRtjd||
�q�Xq�Wt
|�d	kr�t|d
|j�}n|r�tjd|�|d}||}q�n|rH|jr�|j|_n|jdi�j|t��|_i}|jdi�}
x.|jD]#}||
kr|
|||<qqW||_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)iR�R�s%s did not match %rs%skipping pre-release version %s of %sserror matching %s with %riR:ssorted list: %si����N(R�R�(R#RRRR.RFtrequirementRkRlttypeR<R^R[R�t
version_classR}t
is_prereleaseRMR�R�tsortedR:textrasRKR�t
download_urlsR�(R3R�tprereleasesRPtrR.RFtversionstslisttvclstkRxtdtsdR&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytlocatePsT
	
	

	$	(s.tar.gzs.tar.bz2s.tars.zips.tgzs.tbz(s.eggs.exes.whl(s.pdfN(s.whl(R<R=R>tsource_extensionstbinary_extensionstexcluded_extensionsR#ReR�RIRRRSRURWRYtpropertyR.R\R]R^RjRqRR�R�R�RLR�(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRBSs.
												F		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�RItbase_urlRR'(R3R&tkwargs((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRI�s	cCst|jj��S(sJ
        Return all the distribution names known to this locator.
        (R�R'R%(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]�scCsviid6id6}|jj|t�}xF|D]>}|jj||�}|jj||�}td|j�}|d|_|d|_|j	d�|_
|j	dg�|_|j	d�|_t
|�}|r0|d	}	|	d
|_|j|	�|_||_|||<xX|D]M}	|	d
}
|j|	�}|dj|t��j|
�||d|
<qWq0q0W|S(NR�R�R.R[RxtlicensetkeywordstsummaryiR&(R'tpackage_releasesRctrelease_urlstrelease_dataRR.R[RxRKR�R�R�RR�R�R�R�R�R�R�(R3R[RPR�R�R�tdataR�R�R�R&R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\�s0




	


 (R<R=R>RIR]R\(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR��s		tPyPIJSONLocatorcBs)eZdZd�Zd�Zd�ZRS(sw
    This locator uses PyPI's JSON interface. It's very limited in functionality
    and probably not worth using.
    cKs)tt|�j|�t|�|_dS(N(R�R�RIRR�(R3R&R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRI�scCstd��dS(sJ
        Return all the distribution names known to this locator.
        sNot available from this locatorN(RZ(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]�scCs�iid6id6}t|jdt|��}yE|jj|�}|j�j�}tj|�}t	d|j
�}|d}|d|_|d|_|j
d�|_|j
d	g�|_|j
d
�|_t|�}||_|d}	|||j<x||dD]p}
|
d}|jj|�|j|
�|j|<|dj|jt��j|�|j|
�|d|<qWx�|dj�D]�\}}||jkr�q�nt	d|j
�}
|j|
_||
_t|
�}||_|||<xu|D]m}
|
d}|jj|�|j|
�|j|<|dj|t��j|�|j|
�|d|<q�Wq�WWn9tk
r�}|jjt|��tjd
|�nX|S(NR�R�s%s/jsonR.R�R[RxR�R�R�R&treleasessJSON fetch failed: %s( RR�RREtopentreadtdecodetjsontloadsRR.R[RxRKR�R�R�RR�R�R�R�R�R�R�titemsR�RHtputR
Rkt	exception(R3R[RPR&trespR�R�R�R�R�R�RxtinfostomdtodistRQ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\�sT


	


#		


 #	(R<R=R>RIR]R\(((s@/usr/lib/python2.7/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(R3R�R&R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIs
	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.RfRbR�R�R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytclean%sR,trel1trel2trel3trel4trel5trel6RmRnturl3cSsdt|jd��S(Ns%%%2xi(tordR�(R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt<lambda>3R,R:cSs|dS(Ni((Rg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR�7R,treverse(
R�t_hreftfinditerR�t	groupdictRR�R	t	_clean_retsubR�R�Rc(R3R�RPR}R�trelR&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytlinkss		(R<R=R>tretcompiletItStXR�R�RIR�RR�(((s@/usr/lib/python2.7/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((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR�ER,R�cCs|S(N((R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR�FR,tnonei
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�RIRR�R"t_page_cacheR�t_seenRRGt	_to_fetcht
_bad_hostsRLtskip_externalstnum_workerst	threadingtRLockt_lockt_gplock(R3R&R"R�R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIIs
				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	setDaemonRctstartRM(R3tiRg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_prepare_threadscs	

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�R�R#R(R3Rg((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt
_wait_threadsps
c	Cs�iid6id6}|j��||_||_t|jdt|��}|jj�|jj�|j	�z1t
jd|�|jj
|�|jj�Wd|j�X|`WdQX|S(NR�R�s%s/sQueueing %s(R�RPRsRR�RR�RTR�RRkRlR�R�RR(R3R[RPR&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\}s
		


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�(R3R&((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_is_platform_dependent�scCsp|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(	RR#R�RsRkRlR�R�RP(R3R&R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt_process_download�s
	
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.
        thomepagetdownloadthttpR_tftpt:iit	localhosts#should_queue: %s (%s) from %s -> %s(RR	(R
R_R(RRdR�R�R�RLR�R{R�RtsplitRzRcRkRl(
R3tlinktreferrerR�R.RfRbt_RPthost((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt
_should_queue�s*
							
cCs xtr|jj�}z�y�|r�|j|�}|dkrEwnx�|jD]y\}}||jkrO|jj|�|j|�r�|j	|||�r�t
jd||�|jj|�q�qOqOWnWn)t
k
r�}|jjt|��nXWd|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(RcR�RKtget_pageR#R�R�R�RRRkRlR�R�RHR
RO(R3R&tpageRR�RQ((s@/usr/lib/python2.7/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 %sR8tidentitysAccept-encodingsFetching %sR"s
Fetched %ssContent-TypeR,sContent-Encodingsutf-8slatin-1i�sFetch failed: %s: %sN(%RtosRbtisdirRRRR�RkRlRR#R�RRER�R"R�RKtHTML_CONTENT_TYPER}tgeturlR�tdecoderstCHARSETR�R�R�tUnicodeErrorR�RR6R�RR�R�R�(R3R&R.RfRbRRPRR4R�R8tcontent_typet	final_urlR�tencodingtdecoderR�RQ((s@/usr/lib/python2.7/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�(R3RPRR}((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]$s	N(R<R=R>tzlibt
decompressRR#RIRRR\R�R�R�RRRRR�RR#R](((s@/usr/lib/python2.7/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�RcR'R�R&RIRRbtabspathRRtbase_dir(R3RbR�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRI5s
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.
        (RdR�(R3Rrtparent((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytshould_includeFsc		Cs�iid6id6}x�tj|j�D]�\}}}x�|D]�}|j||�r=tjj||�}tddttjj|��dddf�}|j	||�}|r�|j
||�q�q=q=W|js'Pq'q'W|S(NR�R�RR,(RtwalkR)R+RbRRRR(R�R�R'(	R3R[RPtroottdirstfilestfnR&R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\Ns"
		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,R[N(R�RR,R)R+RbRRRR(R�R#R�R'(R3RPR-R.R/R0R&R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]^s	"
		(R<R=R>RIR+R\R](((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR&0s
			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(RZ(R3((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]xscCsBiid6id6}t|�}|r>x|jdg�D]�}|ddks9|ddkreq9nt|d|d	d
|jd
d�d|j�}|j}|d
|_d|kr�|dr�d|df|_n|jdi�|_|jdi�|_|||j	<|dj
|j	t��j|d
�q9Wn|S(NR�R�R/tptypetsdistt	pyversiontsourceR[RxR�sPlaceholder for summaryR.R&R�R�trequirementstexports(
RRKRR.R�R�R�tdependenciesR7RxR�R�R�(R3R[RPR�R�R�R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\~s& 			

.(R<R=R>R]R\(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR1qs	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�R9RIt
isinstanceRtAssertionErrortdistpath(R3R<R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRI�scCs�|jj|�}|dkr5iid6id6}nGi||j6it|jg�|j6d6itdg�|j6d6}|S(NR�R�(R<tget_distributionR#RxR�R�(R3R[R�RP((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\�s
(R<R=R>RIR\(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR9�s	
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�RLR?tlocatorsR�R>RI(R3R@R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRI�s	cCs5tt|�j�x|jD]}|j�qWdS(N(R�R>RUR@(R3R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRU�scCs*||_x|jD]}||_qWdS(N(RVR@R.(R3RXR�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRY�s	cCs]i}xP|jD]E}|j|�}|r|jr�|jdi�}|jdi�}|j|�|jd�}|r�|r�xF|j�D]5\}}	||kr�||c|	O<q�|	||<q�Wn|jd�}
|rR|
rR|
j|�qRqU|jdkrt}n3t	}x*|D]"}|jj
|�rt}PqqW|rU|}PqUqqW|S(NR�R�(R@R^R?RKtupdateR�RFR#RcRLR}(R3R[RPR�R�R/R�tdfR�R�tddtfound((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR\�s8	
	
cCsIt�}x9|jD].}y||j�O}Wqtk
r@qXqW|S(sJ
        Return all the distribution names known to this locator.
        (R�R@R]RZ(R3RPR�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR]�s	
(R<R=R>RIRURYR�RBR.tfgetR\R](((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyR>�s				,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.(R3R�((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRIscCs�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(RkRlR:t
dists_by_nametdistsRxtprovidesRtprovidedR�R�R�(R3R�R[tpRx((s@/usr/lib/python2.7/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(
RkRlR:RIRJRxRKRRLtremove(R3R�R[RMRxts((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytremove_distribution5s	

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.RFRR(R3treqtRFR[((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytget_matcherGs
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.
        (RSR:R�RLR}RRLR�(	R3RRRFR[RPRLRxtproviderR}((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytfind_providersWs			


c	Cs�|j|}t�}x?|D]7}|j|�}|j|j�s|j|�qqW|r�|jd||t|�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�RSR}RxR�t	frozensetRLRQR�RNRc(	R3RTtothertproblemstrlistt	unmatchedRPRFRP((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyttry_to_replaceos"
	
	


#
cCsi|_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(R^R_R`(RLRJRIRWR�ROR:RRkRlR�R�R#RRct	requestedR�R:RNR]trun_requirest
meta_requirestbuild_requirestgetattrRUR�Rxtname_and_versionR�tvaluestbuild_time_dependency(R3R�tmeta_extrasR�R�R�RZttodot
install_distsR[RYtireqtstsreqtstereqtsR:RQt	all_reqtsR�t	providersRTtnR�RMRJ((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pytfind�s�				


				
		

!


	
	"
"
		N(R<R=R>R#RIRNRQRSRUR]RLRs(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyRGs					((OR�tioRR�tloggingRR`R�R�tImportErrortdummy_threadingR$R,RtcompatRRRRRRRR	R
RRR1R
RRRtdatabaseRRRR�RtutilRRRRRRRRRRxRRR�R R!t	getLoggerR<RkR�R|R�RRR$R#R(R)tobjectRBR�R�R�R�R&R1R9R>RHR�tNAME_VERSION_RERG(((s@/usr/lib/python2.7/site-packages/pip/_vendor/distlib/locators.pyt<module>sV
d@�:0E:�A&[				

Zerion Mini Shell 1.0