3

Q'ícœã@sdZddlmZddlZddlZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZddlmZddlmZmZmZmZmZdd	lmZdd
lmZddlm Z ddl!m"Z"m#Z#m$Z$m%Z%dd
l&m'Z'm(Z(m)Z)m*Z*ddl+m,Z,m-Z-ddl.m/Z/ddl0m1Z1m2Z2m3Z3ddl4mZ5ddl6m7Z7ddl8m9Z9ddl:m;Z;m<Z<ddl=m>Z>dddgZ?d3d4d5d6d7d8gZ@ejAeBƒZCGdd „d eDƒZEGd!d„deDƒZFe
jGd"e
jHƒfd#d$„ZIGd%d&„d&eDƒZJGd'd(„d(eDƒZKedd)ƒZLd*d„ZMd+d,„ZNd-d.„ZOd/d0„ZPed1d2ƒZQdS)9z!Routines related to PyPI, indexesé)Úabsolute_importN)Ú
namedtuple)Úparse)Úrequest)Ú	ipaddress)Úcached_propertyÚsplitextÚnormalize_pathÚARCHIVE_EXTENSIONSÚSUPPORTED_EXTENSIONS)ÚRemovedInPip10Warning)Ú
indent_log)Úcheck_requires_python)ÚDistributionNotFoundÚBestVersionAlreadyInstalledÚInvalidWheelFilenameÚUnsupportedWheel)ÚHAS_TLSÚis_urlÚpath_to_urlÚurl_to_path)ÚWheelÚ	wheel_ext)Ú
get_supported)Úhtml5libÚrequestsÚsix)Úcanonicalize_name)Ú
specifiers)Ú	HTTPErrorÚSSLError)ÚunescapeÚ
FormatControlÚfmt_ctl_handle_mutual_excludeÚ
PackageFinderÚhttpsÚ*Ú	localhostú127.0.0.0/8ú::1/128ÚfileÚsshc@s\eZdZdd„Zdd„Zdd„Zdd„Zd	d
„Zdd„Zd
d„Z	dd„Z
dd„Zdd„ZdS)ÚInstallationCandidatecCs,||_t|ƒ|_||_|j|j|jf|_dS)N)ÚprojectÚ
parse_versionÚversionÚlocationÚ_key)Úselfr-r/r0©r3ú(/tmp/pip-build-l_bcah40/pip/pip/index.pyÚ__init__>s
zInstallationCandidate.__init__cCsdj|j|j|jƒS)Nz,<InstallationCandidate({0!r}, {1!r}, {2!r})>)Úformatr-r/r0)r2r3r3r4Ú__repr__DszInstallationCandidate.__repr__cCs
t|jƒS)N)Úhashr1)r2r3r3r4Ú__hash__IszInstallationCandidate.__hash__cCs|j|dd„ƒS)NcSs||kS)Nr3)ÚsÚor3r3r4Ú<lambda>Msz.InstallationCandidate.__lt__.<locals>.<lambda>)Ú_compare)r2Úotherr3r3r4Ú__lt__LszInstallationCandidate.__lt__cCs|j|dd„ƒS)NcSs||kS)Nr3)r:r;r3r3r4r<Psz.InstallationCandidate.__le__.<locals>.<lambda>)r=)r2r>r3r3r4Ú__le__OszInstallationCandidate.__le__cCs|j|dd„ƒS)NcSs||kS)Nr3)r:r;r3r3r4r<Ssz.InstallationCandidate.__eq__.<locals>.<lambda>)r=)r2r>r3r3r4Ú__eq__RszInstallationCandidate.__eq__cCs|j|dd„ƒS)NcSs||kS)Nr3)r:r;r3r3r4r<Vsz.InstallationCandidate.__ge__.<locals>.<lambda>)r=)r2r>r3r3r4Ú__ge__UszInstallationCandidate.__ge__cCs|j|dd„ƒS)NcSs||kS)Nr3)r:r;r3r3r4r<Ysz.InstallationCandidate.__gt__.<locals>.<lambda>)r=)r2r>r3r3r4Ú__gt__XszInstallationCandidate.__gt__cCs|j|dd„ƒS)NcSs||kS)Nr3)r:r;r3r3r4r<\sz.InstallationCandidate.__ne__.<locals>.<lambda>)r=)r2r>r3r3r4Ú__ne__[szInstallationCandidate.__ne__cCst|tƒstS||j|jƒS)N)Ú
isinstancer,ÚNotImplementedr1)r2r>Úmethodr3r3r4r=^s
zInstallationCandidate._compareN)
Ú__name__Ú
__module__Ú__qualname__r5r7r9r?r@rArBrCrDr=r3r3r3r4r,<sr,c	@s’eZdZdZd!dd„Zdd„Zed"dd	„ƒZd
d„Zdd
„Z	dd„Z
dd„Zdd„Zdd„Z
ejdƒZdd„Zdd„Zdd„Zdd„Zdd „ZdS)#r$z This finds packages.

    This is meant to match easy_install's technique for looking for
    packages, by reading pages and looking for appropriate links.
    FNcCsø|dkrtdƒ‚g|_x:|D]2}|jdƒrBt|ƒ}
tjj|
ƒrB|
}|jj|ƒqW||_g|_	t
ƒ|_|pvtt
ƒt
ƒƒ|_
dd„|rˆ|ngDƒ|_||_||_||_t|	||
|d|_tsôx8tj|j|jƒD]$}tj|ƒ}|jdkrÌtjdƒPqÌWdS)	a¯Create a PackageFinder.

        :param format_control: A FormatControl object or None. Used to control
            the selection of source packages / binary packages when consulting
            the index and links.
        :param platform: A string or None. If None, searches for packages
            that are supported by the current system. Otherwise, will find
            packages that can be built on the platform passed in. These
            packages will only be downloaded for distribution: they will
            not be built locally.
        :param versions: A list of strings or None. This is passed directly
            to pep425tags.py in the get_supported() method.
        :param abi: A string or None. This is passed directly
            to pep425tags.py in the get_supported() method.
        :param implementation: A string or None. This is passed directly
            to pep425tags.py in the get_supported() method.
        Nz>PackageFinder() missing 1 required keyword argument: 'session'ú~cSsg|]}d|df‘qS)r&r3)Ú.0Úhostr3r3r4ú
<listcomp>žsz*PackageFinder.__init__.<locals>.<listcomp>)ÚversionsÚplatformÚabiÚimplr%zipip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.)Ú	TypeErrorÚ
find_linksÚ
startswithr	ÚosÚpathÚexistsÚappendÚ
index_urlsÚdependency_linksÚsetÚlogged_linksr"Úformat_controlÚsecure_originsÚallow_all_prereleasesÚprocess_dependency_linksÚsessionrÚ
valid_tagsrÚ	itertoolsÚchainÚurllib_parseÚurlparseÚschemeÚloggerÚwarning)r2rTrZr`Ú
trusted_hostsrarbr^rPrOrQÚimplementationÚlinkÚnew_linkÚparsedr3r3r4r5ls>	




zPackageFinder.__init__cCs"|jrtjdtƒ|jj|ƒdS)NzXDependency Links processing has been deprecated and will be removed in a future release.)raÚwarningsÚwarnrr[Úextend)r2Úlinksr3r3r4Úadd_dependency_linksÀs
z"PackageFinder.add_dependency_linkscsôg‰g‰‡‡fdd„}xÔ|D]Ì}tjj|ƒ}|jdƒ}|s>|rÈ|rH|}nt|ƒ}tjj|ƒr¤|r”tjj|ƒ}x4tj|ƒD]}|tjj||ƒƒqxWqÆ|rƈj	|ƒqètjj
|ƒrº||ƒqètjd|ƒqt
|ƒr܈j	|ƒqtjd|ƒqWˆˆfS)zt
        Sort locations into "files" (archives) and "urls", and return
        a pair of lists (files,urls)
        cs8t|ƒ}tj|ddddkr*ˆj|ƒn
ˆj|ƒdS)NF)Ústrictrz	text/html)rÚ	mimetypesÚ
guess_typerY)rWÚurl)ÚfilesÚurlsr3r4Ú	sort_path×sz0PackageFinder._sort_locations.<locals>.sort_pathzfile:z:Url '%s' is ignored: it is neither a file nor a directory.zQUrl '%s' is ignored. It is either a non-existing path or lacks a specific scheme.)rVrWrXrUrÚisdirÚrealpathÚlistdirÚjoinrYÚisfilerirjr)Ú	locationsÚ
expand_dirr{rxÚ
is_local_pathÚis_file_urlrWÚitemr3)ryrzr4Ú_sort_locationsÍs8



zPackageFinder._sort_locationscCsXt|jƒ}|jjrHt|jjƒ}|j|jƒs8td|jƒ‚|j|jƒ}n|}|j	|fS)a[
        Function used to generate link sort key for link tuples.
        The greater the return value, the more preferred it is.
        If not finding wheels, then sorted by version only.
        If finding wheels, then the sort order is by version, then:
          1. existing installs
          2. wheels ordered via Wheel.support_index_min(self.valid_tags)
          3. source archives
        Note: it was considered to embed this logic into the Link
              comparison operators, but then different sdist links
              with the same version, would have to be considered equal
        zB%s is not a supported wheel for this platform. It can't be sorted.)
Úlenrcr0Úis_wheelrÚfilenameÚ	supportedrÚsupport_index_minr/)r2Ú	candidateÚsupport_numÚwheelÚprir3r3r4Ú_candidate_sort_keyÿs

z!PackageFinder._candidate_sort_keyc	Csltjt|ƒƒ}|j|j|jf}|djddƒd
}x t|jD]}||dkr`|ddkr`q@yht	j
t|dtj
ƒs‚|ddkrŠ|dn|djdƒƒ}t	jt|dtj
ƒr¶|dn|djdƒƒ}WnJtk
r|dr|djƒ|djƒkr|ddkrw@YnX||kr q@|d|dkrP|ddkrP|ddk	rPq@dSW|jd|j|jƒd	S)Nrú+ér&Úutf8éTzúThe repository located at %s is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host %s'.Féÿÿÿÿ)rfrgÚstrrhÚhostnameÚportÚrsplitÚSECURE_ORIGINSr_rÚ
ip_addressrErÚ	text_typeÚdecodeÚ
ip_networkÚ
ValueErrorÚlowerrj)	r2rir0roÚoriginÚprotocolÚ
secure_originÚaddrÚnetworkr3r3r4Ú_validate_secure_origins>

z%PackageFinder._validate_secure_origincs ‡fdd„‰‡fdd„|jDƒS)z²Returns the locations found via self.index_urls

        Checks the url_name on the main (first in the list) index and
        use this url_name to produce all locations
        cs,tj|tjtˆƒƒƒ}|jdƒs(|d}|S)Nú/)Ú	posixpathrrfÚquoterÚendswith)rxÚloc)Úproject_namer3r4Úmkurl_pypi_urlhs
z?PackageFinder._get_index_urls_locations.<locals>.mkurl_pypi_urlcsg|]}ˆ|ƒ‘qSr3r3)rLrx)r­r3r4rNusz;PackageFinder._get_index_urls_locations.<locals>.<listcomp>)rZ)r2r¬r3)r­r¬r4Ú_get_index_urls_locationsas
z'PackageFinder._get_index_urls_locationscsƈj|ƒ}ˆj|ƒ\}}ˆjˆjdd\}}ˆjˆjƒ\}}dd„tj|||ƒDƒ}	‡fdd„tjdd„|Dƒdd„|Dƒd	d„|DƒƒDƒ}
tjd
t|
ƒ|ƒx|
D]}tjd|ƒq¦Wt	|ƒ}t
ˆj|ƒ}
t|||
ƒ}ˆj
dd„ˆjDƒ|ƒ}g}xJˆj|
|ƒD]:}tjd
|jƒtƒ|jˆj
|j|ƒƒWdQRXqWˆj
dd„ˆjDƒ|ƒ}|r|tjddjdd„|Dƒƒƒˆj
|	|ƒ}|r¶|jddtjddjdd„|Dƒƒƒ||||S)aFind all available InstallationCandidate for project_name

        This checks index_urls, find_links and dependency_links.
        All versions found are returned as an InstallationCandidate list.

        See _link_package_versions for details on which files are accepted
        T)r‚css|]}t|ƒVqdS)N)ÚLink)rLrxr3r3r4ú	<genexpr>†sz4PackageFinder.find_all_candidates.<locals>.<genexpr>csg|]}ˆjt|ƒr|‘qSr3)r¦ri)rLrm)r2r3r4rNsz5PackageFinder.find_all_candidates.<locals>.<listcomp>css|]}t|ƒVqdS)N)r¯)rLrxr3r3r4r°scss|]}t|ƒVqdS)N)r¯)rLrxr3r3r4r°‘scss|]}t|ƒVqdS)N)r¯)rLrxr3r3r4r°’sz,%d location(s) to search for versions of %s:z* %scss|]}t|dƒVqdS)z-fN)r¯)rLrxr3r3r4r°¢szAnalyzing links from page %sNcss|]}t|ƒVqdS)N)r¯)rLrxr3r3r4r°¯szdependency_links found: %sz, cSsg|]}|jj‘qSr3)r0rx)rLr/r3r3r4rNµs)ÚreversezLocal files found: %scSsg|]}t|jjƒ‘qSr3)rr0rx)rLrŒr3r3r4rN¿s)r®r†rTr[rdreriÚdebugr‡rÚfmt_ctl_formatsr^ÚSearchÚ_package_versionsÚ
_get_pagesrxr
rrrsrÚsort)r2r¬Úindex_locationsÚindex_file_locÚ
index_url_locÚfl_file_locÚ
fl_url_locÚdep_file_locÚdep_url_locÚfile_locationsÚ
url_locationsr0Úcanonical_nameÚformatsÚsearchÚfind_links_versionsÚ
page_versionsÚpageÚdependency_versionsÚ
file_versionsr3)r2r4Úfind_all_candidateswsX


 
z!PackageFinder.find_all_candidatescsh|j|jƒ}t|jjdd„|Dƒ|jr,|jnddƒ‰‡fdd„|Dƒ}|r\t||jd}nd}|jdk	rxt	|jj
ƒ}nd}|dkrÂ|dkrÂtjd|dj
ttd	d
„|Dƒƒt	dƒƒtd|ƒ‚d}|rà|dksÜ|j
|kràd
}|oì|dk	r|rtjd|ƒntjd||j
ƒdS|rDtjd|dj
tˆt	dƒp<dƒt‚tjd|j
dj
tˆt	dƒƒ|jS)zÙTry to find a Link matching req

        Expects req, an InstallRequirement and upgrade, a boolean
        Returns a Link if found,
        Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise
        cSsg|]}t|jƒ‘qSr3)r–r/)rLÚcr3r3r4rNÝsz2PackageFinder.find_requirement.<locals>.<listcomp>N)Úprereleasescsg|]}t|jƒˆkr|‘qSr3)r–r/)rLrÊ)Úcompatible_versionsr3r4rNæs)ÚkeyzNCould not find a version that satisfies the requirement %s (from versions: %s)z, css|]}t|jƒVqdS)N)r–r/)rLrÊr3r3r4r°ûsz1PackageFinder.find_requirement.<locals>.<genexpr>z%No matching distribution found for %sFTzLExisting installed version (%s) is most up-to-date and satisfies requirementzUExisting installed version (%s) satisfies requirement (most up-to-date version is %s)z=Installed version (%s) is most up-to-date (past versions: %s)Únonez)Using version %s (newest of versions: %s))rÉÚnamer\Ú	specifierÚfilterr`ÚmaxrÚsatisfied_byr.r/riÚcriticalrÚsortedrr²rr0)r2ÚreqÚupgradeÚall_candidatesÚapplicable_candidatesÚbest_candidateÚinstalled_versionÚbest_installedr3)rÌr4Úfind_requirementÊsd


zPackageFinder.find_requirementccsFtƒ}x:|D]2}||krq|j|ƒ|j|ƒ}|dkr8q|VqWdS)zp
        Yields (page, page_url) from the given locations, skipping
        locations that have errors.
        N)r\ÚaddÚ	_get_page)r2rr¬Úseenr0rÆr3r3r4r¶-s


zPackageFinder._get_pagesz-py([123]\.?[0-9]?)$cCsTgg}}tƒ}x:|D]2}||kr|j|ƒ|jr>|j|ƒq|j|ƒqW||S)z
        Returns elements of links in order, non-egg links first, egg links
        second, while eliminating duplicates
        )r\rÞÚegg_fragmentrY)r2rsÚeggsÚno_eggsràrmr3r3r4Ú_sort_links@s


zPackageFinder._sort_linkscCs:g}x0|j|ƒD]"}|j||ƒ}|dk	r|j|ƒqW|S)N)räÚ_link_package_versionsrY)r2rsrÃÚresultrmÚvr3r3r4rµPszPackageFinder._package_versionscCs(||jkr$tjd||ƒ|jj|ƒdS)NzSkipping link %s; %s)r]rir²rÞ)r2rmÚreasonr3r3r4Ú_log_skipped_linkXs
zPackageFinder._log_skipped_linkc
CsJd}|jr|j}|j}n|jƒ\}}|s:|j|dƒdS|tkrV|j|d|ƒdSd|jkr~|tkr~|j|d|jƒdSd|jkr |dkr |j|dƒdS|tkr&yt	|j
ƒ}Wn tk
rØ|j|d	ƒdSXt|j
ƒ|jkr|j|d
|jƒdS|j|jƒs |j|dƒdS|j}d|jkrR|tkrR|j|d
|jƒdS|sft||j|ƒ}|dkr†|j|d
|jƒdS|jj|ƒ}|rÖ|d|jƒ…}|jdƒ}|tjdd…krÖ|j|dƒdSyt|jƒ}	Wn.tjk
rtjd|j
|jƒd}	YnX|	s.tjd||jƒdStjd||ƒt|j||ƒS)z'Return an InstallationCandidate or NoneNz
not a filezunsupported archive format: %sÚbinaryzNo binaries permitted for %sÚmacosx10z.zipzmacosx10 onezinvalid wheel filenamezwrong project name (not %s)z%it is not compatible with this PythonÚsourcezNo sources permitted for %sr’ézPython version is incorrectz3Package %s has an invalid Requires-Python entry: %sTz_The package %s is incompatible with the pythonversion in use. Acceptable python versions are:%szFound link %s, version: %s)ráÚextrrérrÂrÚsuppliedrWrr‰rrrÏÚ	canonicalrŠrcr/Úegg_info_matchesÚ_py_version_rerÃÚstartÚgroupÚsysrÚrequires_pythonrÚInvalidSpecifierrir²r,)
r2rmrÃr/Úegg_inforîrŽÚmatchÚ
py_versionÚsupport_this_pythonr3r3r4rå]s€





z$PackageFinder._link_package_versionscCstj||jdS)N)rb)ÚHTMLPageÚget_pagerb)r2rmr3r3r4rߪszPackageFinder._get_page)	FNFNNNNNN)F)rHrIrJÚ__doc__r5rtÚstaticmethodr†rr¦r®rÉrÝr¶ÚreÚcompileròrärµrérårßr3r3r3r4r$es(
Q
1GSc
Mz([a-z0-9_.]+)-([a-z0-9_.!+-]+)cCs|j|ƒ}|stjd|ƒdS|dkrB|jdƒ}||jdƒd…S|jdƒjƒ}|jddƒ}|jƒd}|j|ƒrˆ|jdƒt|ƒd…SdSdS)axPull the version part out of a string.

    :param egg_info: The string to parse. E.g. foo-2.1
    :param search_name: The name of the package this belongs to. None to
        infer the name. Note that this cannot unambiguously parse strings
        like foo-2-2 which might be foo, 2-2 or foo-2, 2.
    :param link: The link the string came from, for logging on failure.
    z%Could not parse version from link: %sNrú-Ú_)	rÃrir²rôÚindexr ÚreplacerUr‡)røÚsearch_namermÚ_egg_info_rerùÚ
full_matchrÏÚlook_forr3r3r4rñ®s


rñc@sxeZdZdZddd„Zdd„Zeddd	„ƒZedd
d„ƒZ	edd
„ƒZ
edd„ƒZe
dd„ƒZejdejƒZdd„ZdS)rüz'Represents one page, along with its URLNcCs\d}|r2d|kr2tj|dƒ\}}d|kr2|d}||_tj|j|dd|_||_||_dS)NzContent-TypeÚcharsetF)Útransport_encodingÚnamespaceHTMLElements)ÚcgiÚparse_headerÚcontentrrrorxÚheaders)r2rrxrÚencodingÚcontent_typeÚparamsr3r3r4r5Îs
zHTMLPage.__init__cCs|jS)N)rx)r2r3r3r4Ú__str__àszHTMLPage.__str__TcCsj|dkrtdƒ‚|j}|jddƒd}ddlm}x>|jD]4}|jƒj|ƒr:|t|ƒdkr:t	j
d||ƒdSq:Wy"|rÊ|j}xHtD]@}|j
|ƒr†|j||d}	|	jƒjd	ƒr´Pq†t	j
d
||	ƒdSq†Wt	j
d|ƒtj|ƒ\}}
}}}
}|dkr6tjjtj|ƒƒr6|j
d
ƒs|d
7}tj|dƒ}t	j
d|ƒ|j|d	ddœd}|jƒ|jjddƒ}	|	jƒjd	ƒs‚t	j
d
||	ƒdS||j|j|jƒ}WnÊtk
rÈ}z|j|||ƒWYdd}~Xnžtk
r}z"d|}|j|||t	jdWYdd}~Xn`tj k
r<}z|j|d||ƒWYdd}~Xn*tj!k
r`|j|d|ƒYnX|SdS)Nz9get_page() missing 1 required keyword argument: 'session'ú#r’r)Ú
VcsSupportz+:zCannot look at %s URL %s)rbz	text/htmlz,Skipping page %s because of Content-Type: %szGetting page %sr*r§z
index.htmlz# file: URL is directory, getting %szmax-age=600)ÚAcceptz
Cache-Control)rzContent-TypeÚunknownz6There was a problem confirming the ssl certificate: %s)Úmethzconnection error: %sz	timed out)"rSrxÚsplitÚpip.vcsrÚschemesr rUr‡rir²r‰r
rªÚ_get_content_typerfrgrVrWr|Úurllib_requestÚurl2pathnameÚurljoinÚgetÚraise_for_statusrrrÚ_handle_failr ÚinforÚConnectionErrorÚTimeout)ÚclsrmÚ
skip_archivesrbrxrrhr‰Úbad_extrÚnetlocrWrÚqueryÚfragmentÚrespÚinstÚexcrèr3r3r4rýãsp



$"zHTMLPage.get_pagecCs|dkrtj}|d||ƒdS)Nz%Could not fetch URL %s: %s - skipping)rir²)rmrèrxrr3r3r4r#9szHTMLPage._handle_failcCsDtj|ƒ\}}}}}|dkr dS|j|dd}|jƒ|jjddƒS)z;Get the Content-Type of the given url, using a HEAD requestÚhttpr%ÚT)Úallow_redirectszContent-Type)r0r%)rfÚurlsplitÚheadr"rr!)rxrbrhr*rWr+r,r-r3r3r4r@szHTMLPage._get_content_typecCs@dd„|jjdƒDƒ}|r6|djdƒr6|djdƒS|jSdS)NcSsg|]}|jdƒdk	r|‘qS)ÚhrefN)r!)rLÚxr3r3r4rNQsz%HTMLPage.base_url.<locals>.<listcomp>z.//baserr5)roÚfindallr!rx)r2Úbasesr3r3r4Úbase_urlNszHTMLPage.base_urlccslxf|jjdƒD]V}|jdƒr|jdƒ}|jtj|j|ƒƒ}|jdƒ}|rPt|ƒnd}t|||dVqWdS)zYields all links in the pagez.//ar5zdata-requires-pythonN)rö)	ror7r!Ú
clean_linkrfr r9r!r¯)r2Úanchorr5rxÚ	pyrequirer3r3r4rsYs


zHTMLPage.linksz[^a-z0-9$&+,/:;=?@.#%_\\|-]cCs|jjdd„|ƒS)z¨Makes sure a link is fully encoded.  That is, if a ' ' shows up in
        the link, it will be rewritten to %20 (while not over-quoting
        % or other characters).cSsdt|jdƒƒS)Nz%%%2xr)Úordrô)rùr3r3r4r<msz%HTMLPage.clean_link.<locals>.<lambda>)Ú	_clean_reÚsub)r2rxr3r3r4r:hszHTMLPage.clean_link)N)TN)N)rHrIrJrþr5rÚclassmethodrýrÿr#rrr9ÚpropertyrsrrÚIr>r:r3r3r3r4rüËs
U
rüc@s eZdZd5dd„Zdd„Zdd„Zdd	„Zd
d„Zdd
„Zdd„Z	dd„Z
dd„Zdd„Ze
dd„ƒZe
dd„ƒZe
dd„ƒZe
dd„ƒZdd„Ze
d d!„ƒZe
d"d#„ƒZejd$ƒZe
d%d&„ƒZejd'ƒZe
d(d)„ƒZejd*ƒZe
d+d,„ƒZe
d-d.„ƒZe
d/d0„ƒZe
d1d2„ƒZe
d3d4„ƒZ dS)6r¯NcCs0|jdƒrt|ƒ}||_||_|r&|nd|_dS)aó
        Object representing a parsed link from https://pypi.python.org/simple/*

        url:
            url of the resource pointed to (href of the link)
        comes_from:
            instance of HTMLPage where the link was found, or string.
        requires_python:
            String containing the `Requires-Python` metadata field, specified
            in PEP 345. This may be specified by a data-requires-python
            attribute in the HTML link tag, as described in PEP 503.
        z\\N)rUrrxÚ
comes_fromrö)r2rxrCrör3r3r4r5rs

z
Link.__init__cCs<|jrd|j}nd}|jr.d|j|j|fSt|jƒSdS)Nz (requires-python:%s)r1z%s (from %s)%s)rörCrxr–)r2Úrpr3r3r4rˆszLink.__str__cCsd|S)Nz	<Link %s>r3)r2r3r3r4r7’sz
Link.__repr__cCst|tƒstS|j|jkS)N)rEr¯rFrx)r2r>r3r3r4rA•s
zLink.__eq__cCst|tƒstS|j|jkS)N)rEr¯rFrx)r2r>r3r3r4rDšs
zLink.__ne__cCst|tƒstS|j|jkS)N)rEr¯rFrx)r2r>r3r3r4r?Ÿs
zLink.__lt__cCst|tƒstS|j|jkS)N)rEr¯rFrx)r2r>r3r3r4r@¤s
zLink.__le__cCst|tƒstS|j|jkS)N)rEr¯rFrx)r2r>r3r3r4rC©s
zLink.__gt__cCst|tƒstS|j|jkS)N)rEr¯rFrx)r2r>r3r3r4rB®s
zLink.__ge__cCs
t|jƒS)N)r8rx)r2r3r3r4r9³sz
Link.__hash__cCsJtj|jƒ\}}}}}tj|jdƒƒp(|}tj|ƒ}|sFtd|jƒ‚|S)Nr§zURL %r produced no filename)rfr3rxr¨ÚbasenameÚrstripÚunquoteÚAssertionError)r2rr*rWrÏr3r3r4r‰¶s

z
Link.filenamecCstj|jƒdS)Nr)rfr3rx)r2r3r3r4rh¾szLink.schemecCstj|jƒdS)Nr’)rfr3rx)r2r3r3r4r*ÂszLink.netloccCstjtj|jƒdƒS)Nr”)rfrGr3rx)r2r3r3r4rWÆsz	Link.pathcCsttj|jjdƒƒƒS)Nr§)rr¨rErWrF)r2r3r3r4rÊsz
Link.splitextcCs|jƒdS)Nr’)r)r2r3r3r4rîÍszLink.extcCs*tj|jƒ\}}}}}tj||||dfƒS)N)rfr3rxÚ
urlunsplit)r2rhr*rWr+r,r3r3r4Úurl_without_fragmentÑszLink.url_without_fragmentz[#&]egg=([^&]*)cCs |jj|jƒ}|sdS|jdƒS)Nr’)Ú_egg_fragment_rerÃrxrô)r2rùr3r3r4ráØszLink.egg_fragmentz[#&]subdirectory=([^&]*)cCs |jj|jƒ}|sdS|jdƒS)Nr’)Ú_subdirectory_fragment_rerÃrxrô)r2rùr3r3r4Úsubdirectory_fragmentászLink.subdirectory_fragmentz2(sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)cCs |jj|jƒ}|r|jdƒSdS)Nr”)Ú_hash_rerÃrxrô)r2rùr3r3r4r8ìs
z	Link.hashcCs |jj|jƒ}|r|jdƒSdS)Nr’)rNrÃrxrô)r2rùr3r3r4Ú	hash_nameós
zLink.hash_namecCs$tj|jjddƒdjddƒdƒS)Nrr’rú?)r¨rErxr)r2r3r3r4Úshow_urlúsz
Link.show_urlcCs
|jtkS)N)rîr)r2r3r3r4rˆþsz
Link.is_wheelcCs ddlm}|j|jkrdSdS)z 
        Determines if this points to an actual artifact (e.g. a tarball) or if
        it points to an "abstract" thing like a path or a VCS location.
        r)ÚvcsFT)rrRrhÚall_schemes)r2rRr3r3r4Úis_artifactszLink.is_artifact)NN)!rHrIrJr5rr7rArDr?r@rCrBr9rAr‰rhr*rWrrîrJrrrKrárLrMrNr8rOrQrˆrTr3r3r3r4r¯ps8



r¯zno_binary only_binarycCs’|jdƒ}xFd|krP|jƒ|jƒ|jdƒ|d|jdƒd…=d|krdSqWx:|D]2}|dkrn|jƒqXt|ƒ}|j|ƒ|j|ƒqXWdS)Nú,z:all:r’z:none:)rÚclearrÞrrÚdiscard)ÚvalueÚtargetr>ÚnewrÏr3r3r4r#s




cCsjtddgƒ}||jkr"|jdƒn@||jkr8|jdƒn*d|jkrN|jdƒnd|jkrb|jdƒt|ƒS)Nrêrìz:all:)r\Úonly_binaryrWÚ	no_binaryÚ	frozenset)Úfmt_ctlrÁrær3r3r4r³-s




r³cCstd|j|jƒdS)Nz:all:)r#r\r[)r^r3r3r4Úfmt_ctl_no_binary:sr_cCst|ƒtjdtdddS)Nzf--no-use-wheel is deprecated and will be removed in the future.  Please use --no-binary :all: instead.r”)Ú
stacklevel)r_rprqr)r^r3r3r4Úfmt_ctl_no_use_wheel?s
rar´zsupplied canonical formats)r%r&r&)r&r'r&)r&r(r&)r&r)r&)r*r&N)r+r&r&)RrþÚ
__future__rÚloggingr
ÚcollectionsrrdrõrVrrvr¨rpZpip._vendor.six.moves.urllibrrfrrÚ
pip.compatrÚ	pip.utilsrrr	r
rZpip.utils.deprecationrÚpip.utils.loggingr
Úpip.utils.packagingrÚpip.exceptionsrrrrÚpip.downloadrrrrÚ	pip.wheelrrZpip.pep425tagsrÚpip._vendorrrrZpip._vendor.packaging.versionr.Úpip._vendor.packaging.utilsrZpip._vendor.packagingrZpip._vendor.requests.exceptionsrr Zpip._vendor.distlib.compatr!Ú__all__ršÚ	getLoggerrHriÚobjectr,r$rrBrñrür¯r"r#r³r_rar´r3r3r3r4Ú<module>sl

)O&!