HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/python38/lib/python3.8/site-packages/setuptools/__pycache__/package_index.cpython-38.pyc
U

�i�_!��@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
ddlmZmZmZmZddlZddlmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!ddlm"Z"ddl#m$Z$dd	l%m&Z&dd
l'm(Z(ddl)m*Z*ddl+m,Z,dd
l-m.Z.e/Z0e�1d�Z2e�1dej3�Z4e�1d�Z5e�1dej3�j6Z7d�8�Z9ddddgZ:dZ;dZ<e<j=dj=ej>�ed�Z?dd�Z@dd�ZAdd�ZBdGd d�ZCdHd!d"�ZDdId#d$�ZEdedfd%d�ZFdJd&d'�ZGd(d)�ZHe�1d*ej3�ZIeHd+d,��ZJGd-d.�d.�ZKGd/d0�d0eK�ZLGd1d�de�ZMe�1d2�jNZOd3d4�ZPd5d6�ZQdKd7d8�ZRd9d:�ZSGd;d<�d<�ZTGd=d>�d>ejU�ZVejWjXfd?d@�ZYdAdB�ZZeRe;�eY�ZYdCdD�Z[dEdF�Z\dS)Lz#PyPI and direct package downloading�N��wraps)�six)�urllib�http_client�configparser�map)
�
CHECKOUT_DIST�Distribution�BINARY_DIST�normalize_path�SOURCE_DIST�Environment�find_distributions�	safe_name�safe_version�to_filename�Requirement�DEVELOP_DIST�EGG_DIST)�ssl_support)�log)�DistutilsError)�	translate)�get_all_headers)�unescape)�Wheelz^egg=([-A-Za-z0-9_.+!]+)$zhref\s*=\s*['"]?([^'"> ]+)z�<a href="([^"#]+)">([^<]+)</a>\n\s+\(<a (?:title="MD5 hash"\n\s+)href="[^?]+\?:action=show_md5&amp;digest=([0-9a-f]{32})">md5</a>\)z([-+.a-z0-9]{2,}):z.tar.gz .tar.bz2 .tar .zip .tgz�PackageIndex�distros_for_url�parse_bdist_wininst�interpret_distro_name�z<setuptools/{setuptools.__version__} Python-urllib/{py_major}z{}.{})Zpy_major�
setuptoolscCs4zt�|�WStk
r.td|f��YnXdS)Nz1Not a URL, existing file, or requirement spec: %r)r�parse�
ValueErrorr)�spec�r&�</tmp/pip-unpacked-wheel-tlqm5ymo/setuptools/package_index.py�parse_requirement_arg5s�r(cCs�|��}d\}}}|�d�r�|�d�r8|dd�}d}nn|�dd�rb|d	d
�}|dd�}d}nD|�d�r~|dd�}d
}n(|�dd�r�|d	d
�}|dd�}d
}|||fS)z=Return (base,pyversion) or (None,None) for possible .exe name)NNN�.exez
.win32.exeNi�����win32z	.win32-pyi�i�������z.win-amd64.exei�z	win-amd64z
.win-amd64-pyi��)�lower�endswith�
startswith)�namer,�base�py_ver�platr&r&r'r>s$



c	Csxtj�|�}|\}}}}}}tj�|�d�d�}|dkrX|dkrXtj�|�d�d�}d|krp|�dd�\}}||fS)N�/���zsourceforge.net�download����#�)rr#�urlparse�unquote�split)	�url�parts�scheme�server�path�
parameters�query�fragmentr0r&r&r'�egg_info_for_urlVsrDccs\t|�\}}t|||�D]
}|Vq|rXt�|�}|rXt||�d�|td�D]
}|VqLdS)zEYield egg or source distribution objects that might be found at a URLr8)�
precedenceN)rD�distros_for_location�EGG_FRAGMENT�matchr �groupr	)r<�metadatar0rC�distrHr&r&r'ras
�
cCs�|�d�r|dd�}|�d�r8d|kr8t�|||�gS|�d�rxd|krxt|�}|��s^gSt||j|jtdd�gS|�d	�r�t|�\}}}|dk	r�t	||||t
|�StD]0}|�|�r�|dt|��}t	|||�Sq�gS)
z:Yield egg or source distribution objects based on basename�.egg.zipNr+z.egg�-z.whlr8)�location�project_name�versionrEr))
r-r
�
from_locationr�
is_compatiblerOrPrrr r�
EXTENSIONS�len)rN�basenamerJ�wheelZwin_baser1�platform�extr&r&r'rFos<
�
�
rFcCstt|�tj�|�|�S)zEYield possible egg or source distribution objects based on a filename)rFr�osr@rU)�filenamerJr&r&r'�distros_for_filename�s

�r[c
cs||�d�}|s,tdd�|dd�D��r,dStdt|�d�D]8}t||d�|d|��d�||d��|||d�Vq>dS)z�Generate alternative interpretations of a source distro name

    Note: if `location` is a filesystem filename, you should call
    ``pkg_resources.normalize_path()`` on it before passing it to this
    routine!
    rMcss|]}t�d|�VqdS)z	py\d\.\d$N)�rerH)�.0�pr&r&r'�	<genexpr>�sz(interpret_distro_name.<locals>.<genexpr>�Nr8)�
py_versionrErW)r;�any�rangerTr
�join)rNrUrJrarErWr=r^r&r&r'r �s
�ccsft�}|j}|dkr:tj�|j|�D]}||�|Vq$n(|D]"}||�}||kr>||�|Vq>dS)zHList unique elements, preserving order. Remember all elements ever seen.N)�set�addr�moves�filterfalse�__contains__)�iterable�key�seenZseen_add�element�kr&r&r'�unique_everseen�s
rocst���fdd��}|S)zs
    Wrap a function returning an iterable such that the resulting iterable
    only ever yields unique items.
    cst�||��S�N)ro)�args�kwargs��funcr&r'�wrapper�szunique_values.<locals>.wrapperr)rtrur&rsr'�
unique_values�srvz(<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>c	cs�t�|�D]d}|��\}}tttj|���d���}d|ksDd|kr
t	�|�D]}t
j�|t
|�d���VqNq
dD]@}|�|�}|dkrtt	�||�}|rtt
j�|t
|�d���VqtdS)zEFind rel="homepage" and rel="download" links in `page`, yielding URLs�,Zhomepager5r8)z
<th>Home Pagez<th>Download URLr4N)�REL�finditer�groupsrer�str�stripr,r;�HREFrr#�urljoin�
htmldecoderI�find�search)r<�pagerH�tag�relZrels�posr&r&r'�find_external_links�s
r�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�ContentCheckerzP
    A null content checker that defines the interface for checking content
    cCsdS)z3
        Feed a block of data to the hash.
        Nr&��self�blockr&r&r'�feed�szContentChecker.feedcCsdS)zC
        Check the hash. Return False if validation fails.
        Tr&�r�r&r&r'�is_valid�szContentChecker.is_validcCsdS)zu
        Call reporter with information about the checker (hash name)
        substituted into the template.
        Nr&)r��reporter�templater&r&r'�reportszContentChecker.reportN)�__name__�
__module__�__qualname__�__doc__r�r�r�r&r&r&r'r��sr�c@sBeZdZe�d�Zdd�Zedd��Zdd�Z	dd	�Z
d
d�ZdS)
�HashCheckerzK(?P<hash_name>sha1|sha224|sha384|sha256|sha512|md5)=(?P<expected>[a-f0-9]+)cCs||_t�|�|_||_dSrp)�	hash_name�hashlib�new�hash�expected)r�r�r�r&r&r'�__init__szHashChecker.__init__cCs>tj�|�d}|st�S|j�|�}|s0t�S|f|���S)z5Construct a (possibly null) ContentChecker from a URLr4)rr#r9r��patternr��	groupdict)�clsr<rCrHr&r&r'�from_urlszHashChecker.from_urlcCs|j�|�dSrp)r��updater�r&r&r'r� szHashChecker.feedcCs|j��|jkSrp)r��	hexdigestr�r�r&r&r'r�#szHashChecker.is_validcCs||j}||�Srp)r�)r�r�r��msgr&r&r'r�&s
zHashChecker.reportN)r�r�r�r\�compiler�r��classmethodr�r�r�r�r&r&r&r'r�
s�

r�cs<eZdZdZdJdd�ZdKd	d
�ZdLdd�ZdMd
d�Zdd�Zdd�Z	dd�Z
dd�ZdNdd�Zdd�Z
dO�fdd�	Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdPd'd(�ZdQd)d*�Zd+d,�Zd-Zd.d/�Zd0d1�ZdRd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Ze dSd>d?��Z!d@dA�Z"dBdC�Z#dDdE�Z$dFdG�Z%dHdI�Z&�Z'S)Trz;A distribution index that scans web pages for download URLs�https://pypi.org/simple/��*NTcOs�tj|f|�|�|dd|�d��|_i|_i|_i|_t�d�	t
t|���j|_
g|_|ortjor|prt��}|r�t�|�|_n
tjj|_dS)Nr3�|)rr�r-�	index_url�scanned_urls�fetched_urls�
package_pagesr\r�rdrrrH�allows�to_scanrZis_availableZfind_ca_bundleZ
opener_for�openerr�request�urlopen)r�r��hostsZ	ca_bundleZ
verify_sslrq�kwZuse_sslr&r&r'r�.s�
�zPackageIndex.__init__FcCs�||jkr|sdSd|j|<t|�s2|�|�dStt|��}|r\|�|�sPdS|�d|�|sn|rn||jkr�tt|j	|��dS|�|�s�d|j|<dS|�
d|�d|j|<d}|�|||�}|dkr�dSt|t
jj�r�|jdkr�|�
d|j�d|j|j<d|j�d	d
���k�r(|��dS|j}|��}t|t��svt|t
jj��rXd}n|j�d��phd}|�|d
�}|��t�|�D](}	t
j�|t|	� d���}
|�!|
��q�|�"|j#��r�t$|dd�dk�r�|�%||�}dS)z<Evaluate a URL as a possible download, and maybe retrieve itNTzFound link: %sz
Reading %sz<Download error on %s: %%s -- Some packages may not be found!i�zAuthentication error: %s�html�content-type�zlatin-1�charset�ignorer8�code�)&r��
URL_SCHEME�process_filename�listr�url_ok�debugr�rrf�info�open_url�
isinstancer�error�	HTTPErrorr�r�r<�headers�getr,�close�readr{�	get_param�decoder}ryr#r~rrI�process_urlr.r��getattr�
process_index)r�r<�retrieve�dists�tmpl�fr0r�r�rH�linkr&r&r'r�CsT





 zPackageIndex.process_urlcCs�tj�|�s|�d|�dStj�|�r^|s^tj�|�}t�|�D]}|�tj�||�d�qBt	|�}|r�|�
d|�tt|j
|��dS)Nz
Not found: %sTz	Found: %s)rYr@�exists�warn�isdir�realpath�listdirr�rdr[r�r�rrf)r��fn�nestedr@�itemr�r&r&r'r�xszPackageIndex.process_filenamecCsbt|�}|o|�d���dk}|s8|�tj�|�d�r<dSd}|rRt||��n|�||�dS)Nr8�fileTzN
Note: Bypassing %s (disallowed host; see http://bit.ly/2hrImnY for details).
)	r�rIr,r�rr#r9rr�)r�r<�fatal�s�is_filer�r&r&r'r��s�zPackageIndex.url_okcCs2ttjj|�}dd�|D�}tt�|j|��dS)Ncss0|](}t�|�D]}|�d�r||fVqqdS)z	.egg-linkN)rYr�r-)r]r@�entryr&r&r'r_�s

�z.PackageIndex.scan_egg_links.<locals>.<genexpr>)�filterrYr@r�r��	itertools�starmap�
scan_egg_link)r��search_path�dirsZ	egg_linksr&r&r'�scan_egg_links�s
�zPackageIndex.scan_egg_linksc	Cs�ttj�||���}ttdttj|���}W5QRXt	|�dkrDdS|\}}t
tj�||��D](}tjj|f|��|_t|_
|�|�q^dS)Nr`)�openrYr@rdr�r�rr{r|rTrrNr
rErf)r�r@r�Z	raw_lines�linesZegg_pathZ
setup_pathrKr&r&r'r��s zPackageIndex.scan_egg_linkc
	s��fdd�}t�|�D]:}z |tj�|t|�d����Wqtk
rNYqXq||�\}}|r�t||�D]H}t	|�\}}	|�
d�r�|	s�|r�|d||f7}n
��|���|�qlt
�dd�|�SdSd	S)
z#Process the contents of a PyPI pagecs�|��j�r�tttjj|t�j�d��d���}t|�dkr�d|dkr�t	|d�}t
|d�}d�j�|�
�i�|<t|�t|�fSdS)Nr3r`r7r8rT)NN)r.r�r�rrr#r:rTr;rrr��
setdefaultr,r)r�r=�pkg�verr�r&r'�scan�s�z(PackageIndex.process_index.<locals>.scanr8�.pyz
#egg=%s-%scSsd|�ddd�S)Nz<a href="%s#md5=%s">%s</a>r8�r`)rI)�mr&r&r'�<lambda>��z,PackageIndex.process_index.<locals>.<lambda>r�N)r}ryrr#r~rrIr$r�rDr-�need_version_info�scan_url�PYPI_MD5�sub)
r�r<r�r�rHr�r��new_urlr0�fragr&r�r'r��s( 
�zPackageIndex.process_indexcCs|�d|�dS)NzPPage at %s links to .py file(s) without version info; an index scan is required.)�scan_all�r�r<r&r&r'r��s�zPackageIndex.need_version_infocGs:|j|jkr*|r |j|f|��|�d�|�|j�dS)Nz6Scanning index of all packages (this may take a while))r�r�r�r�r��r�r�rqr&r&r'r��s�zPackageIndex.scan_allcCsz|�|j|jd�|j�|j�s:|�|j|jd�|j�|j�sR|�|�t|j�|jd��D]}|�|�qfdS)Nr3r&)	r�r��unsafe_namer�r�rkrO�not_found_in_indexr�)r��requirementr<r&r&r'�
find_packages�s
zPackageIndex.find_packagescsR|��|�|�||jD]"}||kr0|S|�d||�qtt|��||�S)Nz%s does not match %s)�prescanr�rkr��superr�obtain)r�r��	installerrK��	__class__r&r'r�s
zPackageIndex.obtaincCsL|�|jd|�|��sH|��t�|�td|jjtj	�
|�f��dS)z-
        checker is a ContentChecker
        zValidating %%s checksum for %sz7%s validation failed for %s; possible download problem?N)r�r�r�r�rY�unlinkrr�r/r@rU)r��checkerrZ�tfpr&r&r'�
check_hashs�
��zPackageIndex.check_hashcCsN|D]D}|jdks0t|�r0|�d�s0tt|��r<|�|�q|j�|�qdS)z;Add `urls` to the list that will be prescanned for searchesN�file:)r�r�r.r�rr��append)r��urlsr<r&r&r'�add_find_linkss���
�zPackageIndex.add_find_linkscCs"|jrtt|j|j��d|_dS)z7Scan urls scheduled for prescanning (e.g. --find-links)N)r�r�rr�r�r&r&r'r� szPackageIndex.prescancCs<||jr|jd}}n|jd}}|||j�|��dS)Nz#Couldn't retrieve index page for %rz3Couldn't find index page for %r (maybe misspelled?))rkr�r�r�r�)r�r��methr�r&r&r'r�&s
�zPackageIndex.not_found_in_indexcCs~t|t�sjt|�}|rR|�|�d�||�}t|�\}}|�d�rN|�|||�}|Stj	�
|�rb|St|�}t|�
||�dd�S)aLocate and/or download `spec` to `tmpdir`, returning a local path

        `spec` may be a ``Requirement`` object, or a string containing a URL,
        an existing local filename, or a project/version requirement spec
        (i.e. the string form of a ``Requirement`` object).  If it is the URL
        of a .py file with an unambiguous ``#egg=name-version`` tag (i.e., one
        that escapes ``-`` as ``_`` throughout), a trivial ``setup.py`` is
        automatically created alongside the downloaded file.

        If `spec` is a ``Requirement`` object or a string containing a
        project/version requirement spec, this method returns the location of
        a matching distribution (possibly after downloading it to `tmpdir`).
        If `spec` is a locally existing file or directory name, it is simply
        returned unchanged.  If `spec` is a URL, it is downloaded to a subpath
        of `tmpdir`, and the local filename is returned.  Various errors may be
        raised if a problem occurs during downloading.
        r8r�rNN)r�rr��
_download_urlrIrDr-�	gen_setuprYr@r�r(r��fetch_distribution)r�r%�tmpdirr>�foundr0rCr&r&r'r50s

zPackageIndex.downloadc	s���d|�i�d}d
�����fdd�	}|rH�����|�||�}|s^|dk	r^|||�}|dkr��jdk	rx���||�}|dkr�|s���|�||�}|dkr���d�r�dp�d|�n��d|�|j|jd	�SdS)a|Obtain a distribution suitable for fulfilling `requirement`

        `requirement` must be a ``pkg_resources.Requirement`` instance.
        If necessary, or if the `force_scan` flag is set, the requirement is
        searched for in the (online) package index as well as the locally
        installed packages.  If a distribution matching `requirement` is found,
        the returned distribution's ``location`` is the value you would have
        gotten from calling the ``download()`` method with the matching
        distribution's URL or filename.  If no matching distribution is found,
        ``None`` is returned.

        If the `source` flag is set, only source distributions and source
        checkout links will be considered.  Unless the `develop_ok` flag is
        set, development and system eggs (i.e., those using the ``.egg-info``
        format) will be ignored.
        zSearching for %sNcs�|dkr�}||jD]v}|jtkrF�sF|�kr��d|�d�|<q||ko\|jtkp\�}|r��|j��}||_tj	�
|j�r|SqdS)Nz&Skipping development or system egg: %sr8)rkrErr�r
r5rN�download_locationrYr@r�)�req�envrK�test�loc��
develop_okr��skipped�sourcerr&r'r�js&��z-PackageIndex.fetch_distribution.<locals>.findz:No local packages or working download links found for %s%sza source distribution of r�zBest match: %s)rN)N)r�r�r�r�r��cloner)	r�r�r�
force_scanrrZlocal_indexrKr�r&rr'rRs2




�zPackageIndex.fetch_distributioncCs"|�||||�}|dk	r|jSdS)a3Obtain a file suitable for fulfilling `requirement`

        DEPRECATED; use the ``fetch_distribution()`` method now instead.  For
        backward compatibility, this routine is identical but returns the
        ``location`` of the downloaded distribution instead of a distribution
        object.
        N)rrN)r�r�rrrrKr&r&r'�fetch�szPackageIndex.fetchc
	Cs�t�|�}|r*dd�t||�d�d�D�p,g}t|�dkr�tj�|�}tj�|�|kr�tj�	||�}ddl
m}|||�s�t�
||�|}ttj�	|d�d��2}	|	�d|dj|djtj�|�df�W5QRX|S|r�td	||f��ntd
��dS)NcSsg|]}|jr|�qSr&)rP)r]�dr&r&r'�
<listcomp>�s�z*PackageIndex.gen_setup.<locals>.<listcomp>r8r)�samefilezsetup.py�wzIfrom setuptools import setup
setup(name=%r, version=%r, py_modules=[%r])
z�Can't unambiguously interpret project/version identifier %r; any dashes in the name or version should be escaped using underscores. %rzpCan't process plain .py files without an '#egg=name-version' suffix to enable automatic setup script generation.)rGrHr rIrTrYr@rU�dirnamerdZsetuptools.command.easy_installr!�shutil�copy2r��writerOrP�splitextr)
r�rZrCrrHr�rU�dstr!r�r&r&r'r�sB

��
������zPackageIndex.gen_setupi c	Cs|�d|�d}z�t�|�}|�|�}t|tjj�rJt	d||j
|jf��|��}d}|j}d}d|kr�t
|d�}	ttt|	��}|�|||||�t|d��V}
|�|�}|r�|�|�|
�|�|d7}|�|||||�q�q�q�|�|||
�W5QRX|W�S|�r|��XdS)	NzDownloading %szCan't download %s: %s %srr4zcontent-lengthzContent-Length�wbr8)r�r�r�r�r�r�rr�r�rr�r��dl_blocksizer�maxr�int�
reporthookr�r�r�r&r)r�r<rZ�fprr��blocknum�bs�size�sizesrr�r&r&r'�_download_to�s:

�



zPackageIndex._download_tocCsdSrpr&)r�r<rZr/Zblksizer1r&r&r'r-�szPackageIndex.reporthookc
Cs�|�d�rt|�Szt||j�WSttjfk
r�}z<d�dd�|jD��}|r`|�	||�nt
d||f��W5d}~XY�ntjj
k
r�}z|WY�Sd}~XYn�tjjk
�r�}z*|r�|�	||j�nt
d||jf��W5d}~XYn�tjk
�rF}z,|�r$|�	||j�nt
d||jf��W5d}~XYnPtjtjfk
�r�}z(|�rt|�	||�nt
d||f��W5d}~XYnXdS)Nr	� cSsg|]}t|��qSr&)r{)r]�argr&r&r'r sz)PackageIndex.open_url.<locals>.<listcomp>z%s %szDownload error for %s: %sz;%s returned a bad status line. The server might be down, %s)r.�
local_open�open_with_authr�r$r�
InvalidURLrdrqr�rrr�r��URLError�reason�
BadStatusLine�line�
HTTPException�socket)r�r<�warning�vr�r&r&r'r��s>
"����zPackageIndex.open_urlcCs�t|�\}}|r0d|kr4|�dd��dd�}qnd}|�d�rJ|dd�}tj�||�}|dksj|�d	�rv|�||�S|d
ks�|�d�r�|�||�S|�d�r�|�	||�S|d
kr�t
j�t
j
�|�d�S|�|d�|�||�SdS)Nz..�.�\�_Z__downloaded__rLr+�svnzsvn+�gitzgit+zhg+r�r`T)rD�replacer-rYr@rdr.�
_download_svn�
_download_git�_download_hgrr��url2pathnamer#r9r��_attempt_download)r�r>r<rr/rCrZr&r&r'r s$

zPackageIndex._download_urlcCs|�|d�dS)NT)r�r�r&r&r'r�=szPackageIndex.scan_urlcCs6|�||�}d|�dd���kr.|�|||�S|SdS)Nr�r�r�)r3r�r,�_download_html)r�r<rZr�r&r&r'rK@szPackageIndex._attempt_downloadcCsnt|�}|D]>}|��rt�d|�rF|��t�|�|�||�SqLq|��t�|�td|��dS)Nz <title>([^- ]+ - )?Revision \d+:zUnexpected HTML page found at )	r�r|r\r�r�rYrrGr)r�r<r�rZr�r<r&r&r'rLGs

zPackageIndex._download_htmlcCst�dt�|�dd�d}d}|���d�r�d|kr�tj�|�\}}}}}}	|s�|�d�r�d	|d
d�kr�|d
d��d	d�\}}t	|�\}
}|
r�d|
kr�|
�dd�\}}
d||
f}nd
|
}|}||||||	f}tj�
|�}|�d||�t�
d|||f�|S)Nz"SVN download support is deprecatedr7r8rr�zsvn:�@z//r3r`�:z --username=%s --password=%sz --username=z'Doing subversion checkout from %s to %szsvn checkout%s -q %s %s)�warningsr��UserWarningr;r,r.rr#r9�
_splituser�
urlunparser�rY�system)r�r<rZ�credsr>�netlocr@r^�qr��auth�host�user�pwr=r&r&r'rGVs&zPackageIndex._download_svncCsptj�|�\}}}}}|�dd�d}|�dd�d}d}d|krR|�dd�\}}tj�||||df�}||fS)N�+r8r4r7rrMr�)rr#�urlsplitr;�rsplit�
urlunsplit)r<�
pop_prefixr>rUr@rBr��revr&r&r'�_vcs_split_rev_from_urllsz$PackageIndex._vcs_split_rev_from_urlcCsl|�dd�d}|j|dd�\}}|�d||�t�d||f�|dk	rh|�d|�t�d	||f�|S)
Nr7r8rT�r_zDoing git clone from %s to %szgit clone --quiet %s %szChecking out %szgit -C %s checkout --quiet %s�r;rar�rYrS�r�r<rZr`r&r&r'rH~s�zPackageIndex._download_gitcCsl|�dd�d}|j|dd�\}}|�d||�t�d||f�|dk	rh|�d|�t�d	||f�|S)
Nr7r8rTrbzDoing hg clone from %s to %szhg clone --quiet %s %szUpdating to %szhg --cwd %s up -C -r %s -qrcrdr&r&r'rI�s�zPackageIndex._download_hgcGstj|f|��dSrp)rr�r�r&r&r'r��szPackageIndex.debugcGstj|f|��dSrp)rr�r�r&r&r'r��szPackageIndex.infocGstj|f|��dSrp)rr�r�r&r&r'r��szPackageIndex.warn)r�r�NT)F)F)F)N)N)FFFN)FF)N)F)(r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�r�r5rrrr*r3r-r�rr�rKrLrG�staticmethodrarHrIr�r�r��
__classcell__r&r&rr'r+sX�

5



+
		
#�
L

)$
#z!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?cCs|�d�}t|�S)Nr)rIr)rH�whatr&r&r'�
decode_entity�s
rhcCs
tt|�S)a
    Decode HTML entities in the given text.

    >>> htmldecode(
    ...     'https://../package_name-0.1.2.tar.gz'
    ...     '?tokena=A&amp;tokenb=B">package_name-0.1.2.tar.gz')
    'https://../package_name-0.1.2.tar.gz?tokena=A&tokenb=B">package_name-0.1.2.tar.gz'
    )�
entity_subrh)�textr&r&r'r�s	rcs�fdd�}|S)Ncs��fdd�}|S)Nc	s2t��}t���z�||�W�St�|�XdSrp)r>�getdefaulttimeout�setdefaulttimeout)rqrrZold_timeout)rt�timeoutr&r'�_socket_timeout�s

z@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeoutr&)rtrn�rmrsr'rn�sz'socket_timeout.<locals>._socket_timeoutr&)rmrnr&ror'�socket_timeout�srpcCs2tj�|�}|��}t�|�}|��}|�dd�S)aq
    A function compatible with Python 2.3-3.3 that will encode
    auth from a URL suitable for an HTTP header.
    >>> str(_encode_auth('username%3Apassword'))
    'dXNlcm5hbWU6cGFzc3dvcmQ='

    Long auth strings should not cause a newline to be inserted.
    >>> long_auth = 'username:' + 'password'*10
    >>> chr(10) in str(_encode_auth(long_auth))
    False
    �
r�)rr#r:�encode�base64�	b64encoder�rF)rWZauth_sZ
auth_bytesZ
encoded_bytes�encodedr&r&r'�_encode_auth�s

rvc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
Credentialz:
    A username/password pair. Use like a namedtuple.
    cCs||_||_dSrp��username�password)r�ryrzr&r&r'r��szCredential.__init__ccs|jV|jVdSrprxr�r&r&r'�__iter__�szCredential.__iter__cCsdt|�S)Nz%(username)s:%(password)s)�varsr�r&r&r'�__str__�szCredential.__str__N)r�r�r�r�r�r{r}r&r&r&r'rw�srwc@s0eZdZdd�Zedd��Zdd�Zdd�Zd	S)
�
PyPIConfigcCsPt�dddgd�}tj�||�tj�tj�d�d�}tj�	|�rL|�
|�dS)z%
        Load from ~/.pypirc
        ryrz�
repositoryr��~z.pypircN)�dict�fromkeysr�RawConfigParserr�rYr@rd�
expanduserr�r�)r��defaults�rcr&r&r'r��s
zPyPIConfig.__init__cs&�fdd����D�}tt�j|��S)Ncs g|]}��|d���r|�qS)r)r�r|)r]�sectionr�r&r'r s�z2PyPIConfig.creds_by_repository.<locals>.<listcomp>)�sectionsr�r�_get_repo_cred)r�Zsections_with_repositoriesr&r�r'�creds_by_repositorys
�zPyPIConfig.creds_by_repositorycCs6|�|d���}|t|�|d���|�|d����fS)Nrryrz)r�r|rw)r�r��repor&r&r'r�	s
�zPyPIConfig._get_repo_credcCs*|j��D]\}}|�|�r
|Sq
dS)z�
        If the URL indicated appears to be a repository defined in this
        config, return the credential for that repository.
        N)r��itemsr.)r�r<r�credr&r&r'�find_credentials
zPyPIConfig.find_credentialN)r�r�r�r��propertyr�r�r�r&r&r&r'r~�s

r~cCs:tj�|�}|\}}}}}}|�d�r0t�d��|dkrFt|�\}	}
nd}	|	s~t��|�}|r~t	|�}	|j
|f}tjd	|��|	r�dt
|	�}	||
||||f}
tj�|
�}tj�|�}|�d|	�ntj�|�}|�dt�||�}|	�r6tj�|j�\}}}}}}||k�r6||
k�r6||||||f}
tj�|
�|_|S)
z4Open a urllib2 request, handling HTTP authenticationrNznonnumeric port: '')�http�httpsN�*Authenticating as %s for %s (from .pypirc)zBasic �
Authorizationz
User-Agent)r�)rr#r9r-rr8rQr~r�r{ryrr�rvrRr��Request�
add_header�
user_agentr<)r<r��parsedr>rUr@�paramsrBr�rW�addressr�r�r=r�r�r.�s2�h2�path2Zparam2Zquery2Zfrag2r&r&r'r7s8


r7cCs |�d�\}}}|r|nd|fS)zNsplituser('user[:passwd]@host[:port]')
    --> 'user[:passwd]', 'host[:port]'.rMN)�
rpartition)rXrY�delimr&r&r'rQIsrQcCs|Srpr&)r<r&r&r'�
fix_sf_urlTsr�c
Cstj�|�\}}}}}}tj�|�}tj�|�r<tj�|�S|�	d�r�tj�
|�r�g}t�|�D]d}	tj�||	�}
|	dkr�t
|
d��}|��}W5QRXq�ntj�
|
�r�|	d7}	|�dj|	d��q`d}
|
j|d�|�d�}d	\}}n
d
\}}}ddi}t�|�}tj�|||||�S)
z7Read a local path, with special support for directoriesr3z
index.html�rz<a href="{name}">{name}</a>)r/zB<html><head><title>{url}</title></head><body>{files}</body></html>rq)r<�files)���OK)r�zPath not foundz	Not foundr�z	text/html)rr#r9r�rJrYr@�isfiler�r-r�r�rdr�r�r
�formatr�StringIOr�r�)r<r>r?r@�paramrBr�rZr�r��filepathr.�bodyr��status�messager�Zbody_streamr&r&r'r6Xs.�


r6)N)N)N)N)r!)]r��sysrYr\r$r>rsr�r�rO�	functoolsrZsetuptools.externrZsetuptools.extern.six.movesrrrrr"�
pkg_resourcesr	r
rrr
rrrrrrrrr�	distutilsr�distutils.errorsr�fnmatchrZsetuptools.py27compatrZsetuptools.py33compatrZsetuptools.wheelr�type�
__metaclass__r�rG�Ir}r�rHr�r;rS�__all__Z_SOCKET_TIMEOUTZ_tmplr��version_infor�r(rrDrrFr[r rorvrxr�r�r�rr�rirhrrprvrwr�r~r�r�r7rQr�r6r&r&r&r'�<module>s�<
��
�	

!
�
$


!
&/