3 �PfW��@sdZddlmZddlZddlZddlmZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZddlmZddlmZmZmZmZmZdd lmZdd lmZdd lm 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;ddld3d4d5d6d7d8gZ?ej@eA�ZBGdd �d eC�ZDGd!d�deC�ZEe jFd"e jG�fd#d$�ZHGd%d&�d&eC�ZIGd'd(�d(eC�ZJedd)�ZKd*d�ZLd+d,�ZMd-d.�ZNd/d0�ZOed1d2�ZPdS)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)�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 �Zd d �Zd d�Z dd�Z dd�Z dd�Z dS)�InstallationCandidatecCs,||_t|�|_||_|j|j|jf|_dS)N)�project� parse_version�version�location�_key)�selfr,r.r/�r2�/usr/lib/python3.6/index.py�__init__>s zInstallationCandidate.__init__cCsdj|j|j|j�S)Nz,)�formatr,r.r/)r1r2r2r3�__repr__DszInstallationCandidate.__repr__cCs t|j�S)N)�hashr0)r1r2r2r3�__hash__IszInstallationCandidate.__hash__cCs|j|dd��S)NcSs||kS)Nr2)�s�or2r2r3�Msz.InstallationCandidate.__lt__..)�_compare)r1�otherr2r2r3�__lt__LszInstallationCandidate.__lt__cCs|j|dd��S)NcSs||kS)Nr2)r9r:r2r2r3r;Psz.InstallationCandidate.__le__..)r<)r1r=r2r2r3�__le__OszInstallationCandidate.__le__cCs|j|dd��S)NcSs||kS)Nr2)r9r:r2r2r3r;Ssz.InstallationCandidate.__eq__..)r<)r1r=r2r2r3�__eq__RszInstallationCandidate.__eq__cCs|j|dd��S)NcSs||kS)Nr2)r9r:r2r2r3r;Vsz.InstallationCandidate.__ge__..)r<)r1r=r2r2r3�__ge__UszInstallationCandidate.__ge__cCs|j|dd��S)NcSs||kS)Nr2)r9r:r2r2r3r;Ysz.InstallationCandidate.__gt__..)r<)r1r=r2r2r3�__gt__XszInstallationCandidate.__gt__cCs|j|dd��S)NcSs||kS)Nr2)r9r:r2r2r3r;\sz.InstallationCandidate.__ne__..)r<)r1r=r2r2r3�__ne__[szInstallationCandidate.__ne__cCst|t�stS||j|j�S)N)� isinstancer+�NotImplementedr0)r1r=�methodr2r2r3r<^s zInstallationCandidate._compareN) �__name__� __module__� __qualname__r4r6r8r>r?r@rArBrCr<r2r2r2r3r+<sr+c @s�eZdZdZd!dd�Zdd�Zed"dd ��Zd d �Zd d �Z dd�Z dd�Z dd�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%r2)�.0�hostr2r2r3� �sz*PackageFinder.__init__..)�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)r1rSrYr_Z trusted_hostsr`rar]rOrNrP�implementation�linkZnew_link�parsedr2r2r3r4ls>       zPackageFinder.__init__cCs"|jrtjdt�|jj|�dS)NzXDependency Links processing has been deprecated and will be removed in a future release.)r`�warnings�warnr rZ�extend)r1�linksr2r2r3�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�t j d|�qt |�r܈j |�qt j 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� mimetypesZ guess_typerX)rV�url)�files�urlsr2r3� sort_path�s z0PackageFinder._sort_locations..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.)rUrVrWrTr�isdir�realpath�listdir�joinrX�isfilerhrir)� locations� expand_dirrwrtZ is_local_pathZ is_file_urlrV�itemr2)rurvr3�_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.) �lenrbr/�is_wheelr�filename� supportedrZsupport_index_minr.)r1� candidateZ support_num�wheelZprir2r2r3�_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�����)rerf�strrgZhostnameZport�rsplit�SECURE_ORIGINSr^rZ ip_addressrDrZ text_type�decodeZ ip_network� ValueError�lowerri) r1rhr/rl�originZprotocolZ secure_originZaddrZnetworkr2r2r3�_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�/)� posixpathr{reZquoter�endswith)rt�loc)� project_namer2r3�mkurl_pypi_urlhs  z?PackageFinder._get_index_urls_locations..mkurl_pypi_urlcsg|] }�|��qSr2r2)rKrt)r�r2r3rMusz;PackageFinder._get_index_urls_locations..)rY)r1r�r2)r�r�r3�_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)rKrtr2r2r3� �sz4PackageFinder.find_all_candidates..csg|]}�jt|�r|�qSr2)r�rh)rKrk)r1r2r3rM�sz5PackageFinder.find_all_candidates..css|]}t|�VqdS)N)r�)rKrtr2r2r3r��scss|]}t|�VqdS)N)r�)rKrtr2r2r3r��scss|]}t|�VqdS)N)r�)rKrtr2r2r3r��sz,%d location(s) to search for versions of %s:z* %scss|]}t|d�VqdS)z-fN)r�)rKrtr2r2r3r��szAnalyzing links from page %sNcss|]}t|�VqdS)N)r�)rKrtr2r2r3r��szdependency_links found: %sz, cSsg|] }|jj�qSr2)r/rt)rKr.r2r2r3rM�s)�reversezLocal files found: %scSsg|]}t|jj��qSr2)rr/rt)rKr�r2r2r3rM�s)r�r�rSrZrcrdrh�debugr�r�fmt_ctl_formatsr]�Search�_package_versions� _get_pagesrtr rorpr{�sort)r1r�Zindex_locationsZindex_file_locZ index_url_locZ fl_file_locZ fl_url_locZ dep_file_locZ dep_url_locZfile_locationsZ url_locationsr/�canonical_name�formats�searchZfind_links_versionsZ page_versions�pageZdependency_versionsZ file_versionsr2)r1r3�find_all_candidateswsX             z!PackageFinder.find_all_candidatesc s�|j|j�}t|jjdd�|D�|jr,|jndd����fdd�|D�}|r�t||jd�}t|j dd�r�d d�|D�}t|�r�t||jd�}q�d j |j |j |j �}|j j r�|d j |j j �7}tj|�nd}|jdk r�t|jj �}nd}|dko�|dk�r0tjd |d jttdd�|D��td���td|��d} |�rT|dk�sP|j |k�rTd} | �r�|dk �r�| �rztjd|�ntjd||j �dS| �r�tjd|d jt�td���p�d�t�tjd|j d jt�td���|j S)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��qSr2)r�r.)rK�cr2r2r3rM�sz2PackageFinder.find_requirement..N)Z prereleasescsg|]}t|j��kr|�qSr2)r�r.)rKr�)�compatible_versionsr2r3rM�s)�key�yankedFcSsg|]}t|jdd�s|�qS)r�F)�getattrr/)rKr�r2r2r3rM�sznWARNING: The candidate selected for download or install is a yanked version: '{}' candidate (version {} at {})z Reason for being yanked: {}zNCould not find a version that satisfies the requirement %s (from versions: %s)z, css|]}t|j�VqdS)N)r�r.)rKr�r2r2r3r�sz1PackageFinder.find_requirement..z%No matching distribution found for %sTzLExisting 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)Znonez)Using version %s (newest of versions: %s))r��namer[Z specifier�filterr_�maxr�r�r/r5r,r.� yanked_reasonrhriZ satisfied_byr-Zcriticalr{�sortedrr�r) r1ZreqZupgradeZall_candidatesZapplicable_candidatesZbest_candidateZnonyanked_candidatesZwarning_messageZinstalled_versionZbest_installedr2)r�r3�find_requirement�sx          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)r1r}r��seenr/r�r2r2r3r�Bs   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_fragmentrX)r1rpZeggsZno_eggsr�rkr2r2r3� _sort_linksUs    zPackageFinder._sort_linkscCs:g}x0|j|�D]"}|j||�}|dk r|j|�qW|S)N)r��_link_package_versionsrX)r1rpr��resultrk�vr2r2r3r�es  zPackageFinder._package_versionscCs(||jkr$tjd||�|jj|�dS)NzSkipping link %s; %s)r\rhr�r�)r1rk�reasonr2r2r3�_log_skipped_linkms 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 t k 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 %sZmacosx10z.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�r r�rZsuppliedrVrr�rrr�Z canonicalr�rbr.�egg_info_matches�_py_version_rer��start�group�sysr�requires_pythonrZInvalidSpecifierrhr�r+) r1rkr�r.�egg_infor�r��match� py_versionZsupport_this_pythonr2r2r3r�rs�             z$PackageFinder._link_package_versionscCstj||jd�S)N)ra)�HTMLPage�get_pagera)r1rkr2r2r3r��szPackageFinder._get_page) FNFNNNNNN)F)rGrHrI�__doc__r4rq� staticmethodr�r�r�r�r�r�r��re�compiler�r�r�r�r�r�r2r2r2r3r#es( Q  1GSx 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�rhr�r��indexr��replacerTr�)r�Z search_namerkZ _egg_info_rer�Z full_matchr�Zlook_forr2r2r3r��s      r�c@sxeZdZdZddd�Zdd�Zeddd ��Zedd d ��Z ed d ��Z e dd��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)Ztransport_encodingZnamespaceHTMLElements)�cgiZ parse_header�contentrrrlrt�headers)r1r�rtr��encoding� content_type�paramsr2r2r3r4�s  zHTMLPage.__init__cCs|jS)N)rt)r1r2r2r3�__str__�szHTMLPage.__str__TcCsl|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�tjk �r�}z|j|||�WYdd}~Xn�tk �r}z"d|}|j|||t jd�WYdd}~Xn`tj k �r>}z|j|d||�WYdd}~Xn*tj!k �rb|j|d|�YnX|SdS)Nz9get_page() missing 1 required keyword argument: 'session'�#r�r)� VcsSupportz+:zCannot look at %s URL %s)raz text/htmlz,Skipping page %s because of Content-Type: %szGetting page %sr)r�z index.htmlz# file: URL is directory, getting %sz max-age=600)ZAcceptz Cache-Control)r�z Content-Type�unknownz6There was a problem confirming the ssl certificate: %s)�methzconnection error: %sz timed out)"rRrt�split�pip.vcsr�Zschemesr�rTr�rhr�r�r r��_get_content_typererfrUrVrx�urllib_requestZ url2pathname�urljoin�get�raise_for_statusr�r�rZ HTTPError� _handle_failr�info�ConnectionErrorZTimeout)�clsrkZ skip_archivesrartr�rgr�Zbad_extr��netlocrVr��query�fragment�respZinst�excr�r2r2r3r��sp           $"zHTMLPage.get_pagecCs|dkrtj}|d||�dS)Nz%Could not fetch URL %s: %s - skipping)rhr�)rkr�rtr�r2r2r3r�NszHTMLPage._handle_failcCsDtj|�\}}}}}|dkr dS|j|dd�}|j�|jjdd�S)z;Get the Content-Type of the given url, using a HEAD request�httpr$�T)Zallow_redirectsz Content-Type)r�r$)re�urlsplit�headr�r�r�)rtrargr�rVr�r�r�r2r2r3r�Us zHTMLPage._get_content_typecCs@dd�|jjd�D�}|r6|djd�r6|djd�S|jSdS)NcSsg|]}|jd�dk r|�qS)�hrefN)r�)rK�xr2r2r3rMfsz%HTMLPage.base_url..z.//baserr�)rl�findallr�rt)r1�basesr2r2r3�base_urlcszHTMLPage.base_urlccs�x�|jjd�D]v}|jd�r|jd�}|jtj|j|��}|jd�}|rPt|�nd}|jddd�}|dk rrt|�}t||||d�VqWdS)zYields all links in the pagez.//ar�zdata-requires-pythonNz data-yanked)�default)r�r�) rlr�r�� clean_linkrer�r�r r�)r1Zanchorr�rtZ pyrequirer�r2r2r3rpns   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�r2r2r3r;�sz%HTMLPage.clean_link..)� _clean_re�sub)r1rtr2r2r3r��szHTMLPage.clean_link)N)TN)N)rGrHrIr�r4r�� classmethodr�r�r�r�rr��propertyrpr�r��Ir�r�r2r2r2r3r��s  U   r�c@s eZdZd5dd�Zdd�Zdd�Zdd �Zd d �Zd d �Zdd�Z dd�Z dd�Z dd�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�NcCs@|jd�rt|�}||_||_|r&|nd|_||_|dk |_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)rTrrt� comes_fromr�r�r�)r1rtrr�r�r2r2r3r4�s z Link.__init__cCs<|jrd|j}nd}|jr.d|j|j|fSt|j�SdS)Nz (requires-python:%s)r�z%s (from %s)%s)r�rrtr�)r1Zrpr2r2r3r��s  z Link.__str__cCsd|S)Nz r2)r1r2r2r3r6�sz Link.__repr__cCst|t�stS|j|jkS)N)rDr�rErt)r1r=r2r2r3r@�s z Link.__eq__cCst|t�stS|j|jkS)N)rDr�rErt)r1r=r2r2r3rC�s z Link.__ne__cCst|t�stS|j|jkS)N)rDr�rErt)r1r=r2r2r3r>�s z Link.__lt__cCst|t�stS|j|jkS)N)rDr�rErt)r1r=r2r2r3r?�s z Link.__le__cCst|t�stS|j|jkS)N)rDr�rErt)r1r=r2r2r3rB�s z Link.__gt__cCst|t�stS|j|jkS)N)rDr�rErt)r1r=r2r2r3rA�s z Link.__ge__cCs t|j�S)N)r7rt)r1r2r2r3r8�sz Link.__hash__cCsJtj|j�\}}}}}tj|jd��p(|}tj|�}|sFtd|j��|S)Nr�zURL %r produced no filename)rer�rtr��basename�rstrip�unquote�AssertionError)r1r�r�rVr�r2r2r3r��s  z Link.filenamecCstj|j�dS)Nr)rer�rt)r1r2r2r3rg�sz Link.schemecCstj|j�dS)Nr�)rer�rt)r1r2r2r3r��sz Link.netloccCstjtj|j�d�S)Nr�)rerr�rt)r1r2r2r3rV�sz Link.pathcCsttj|jjd���S)Nr�)rr�rrVr)r1r2r2r3r�sz Link.splitextcCs |j�dS)Nr�)r)r1r2r2r3r��szLink.extcCs*tj|j�\}}}}}tj||||df�S)N)rer�rtZ urlunsplit)r1rgr�rVr�r�r2r2r3�url_without_fragment�szLink.url_without_fragmentz[#&]egg=([^&]*)cCs |jj|j�}|sdS|jd�S)Nr�)�_egg_fragment_rer�rtr�)r1r�r2r2r3r��szLink.egg_fragmentz[#&]subdirectory=([^&]*)cCs |jj|j�}|sdS|jd�S)Nr�)�_subdirectory_fragment_rer�rtr�)r1r�r2r2r3�subdirectory_fragment�szLink.subdirectory_fragmentz2(sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)cCs |jj|j�}|r|jd�SdS)Nr�)�_hash_rer�rtr�)r1r�r2r2r3r7s z Link.hashcCs |jj|j�}|r|jd�SdS)Nr�)r r�rtr�)r1r�r2r2r3� hash_names zLink.hash_namecCs$tj|jjdd�djdd�d�S)Nr�r�r�?)r�rrtr�)r1r2r2r3�show_urlsz Link.show_urlcCs |jtkS)N)r�r)r1r2r2r3r�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)r�rrgZ all_schemes)r1rr2r2r3� is_artifacts  zLink.is_artifact)NNN)!rGrHrIr4r�r6r@rCr>r?rBrAr8rr�rgr�rVrr�rr�r�r r�r r r r7r rr�rr2r2r2r3r��s8                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�r�r�discard)�value�targetr=�newr�r2r2r3r"5s     cCsjtddg�}||jkr"|jd�n@||jkr8|jd�n*d|jkrN|jd�nd|jkrb|jd�t|�S)Nr�r�z:all:)r[� only_binaryr� no_binary� frozenset)�fmt_ctlr�r�r2r2r3r�Hs         r�cCstd|j|j�dS)Nz:all:)r"rr)rr2r2r3�fmt_ctl_no_binaryUsrcCst|�tjdtdd�dS)Nzf--no-use-wheel is deprecated and will be removed in the future. Please use --no-binary :all: instead.r�)� stacklevel)rrmrnr )rr2r2r3�fmt_ctl_no_use_wheelZs rr�zsupplied canonical formats)r$r%r%)r%r&r%)r%r'r%)r%r(r%)r)r%N)r*r%r%)Qr�Z __future__rZloggingr�� collectionsrrcr�rUr�rsr�rmZpip._vendor.six.moves.urllibrrerr�Z pip.compatrZ pip.utilsrrr r r Zpip.utils.deprecationr Zpip.utils.loggingr Zpip.utils.packagingrZpip.exceptionsrrrrZ pip.downloadrrrrZ pip.wheelrrZpip.pep425tagsrZ pip._vendorrrrZpip._vendor.packaging.versionr-Zpip._vendor.packaging.utilsrZpip._vendor.packagingrZpip._vendor.requests.exceptionsrZpip._vendor.distlib.compatr �__all__r�Z getLoggerrGrh�objectr+r#r�rr�r�r�r!r"r�rrr�r2r2r2r3�sl                )d*#