HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //opt/osm/venv/lib64/python3.10/site-packages/setuptools/__pycache__/package_index.cpython-310.pyc
o

0iT��@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
ZddlZddlZddlZddlmZddlZddlmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,dd	l-m.Z.e�/d
�Z0e�/dej1�Z2e�/d�Z3e�/d
ej1�j4Z5d�6�Z7gd�Z8dZ9dZ:e:j;dj;ej<�ed�Z=dd�Z>dd�Z?dd�Z@dBdd�ZAdBdd�ZBdBdd�ZCdedfd d!�ZDd"d#�ZEe�/d$ej1�ZFeEd%d&��ZGGd'd(�d(�ZHGd)d*�d*eH�ZIGd+d,�d,e�ZJe�/d-�jKZLd.d/�ZMd0d1�ZNdCd2d3�ZOd4d5�ZPGd6d7�d7�ZQGd8d9�d9ejR�ZSejTjUfd:d;�ZVd<d=�ZWeOe9�eV�ZVd>d?�ZXd@dA�ZYdS)Dz#PyPI and direct package downloading�N��wraps)�
CHECKOUT_DIST�Distribution�BINARY_DIST�normalize_path�SOURCE_DIST�Environment�find_distributions�	safe_name�safe_version�to_filename�Requirement�DEVELOP_DIST�EGG_DIST�
parse_version)�log)�DistutilsError)�	translate)�Wheel��unique_everseenz^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�
setuptoolsc
Cs6zt�|�WSty}ztd|f�|�d}~ww)Nz1Not a URL, existing file, or requirement spec: %r)r�parse�
ValueErrorr)�spec�e�r"�F/opt/osm/venv/lib/python3.10/site-packages/setuptools/package_index.py�parse_requirement_arg6s����r$cCs�|��}d\}}}|�d�rS|�d�r|dd�}d}n7|�dd�r1|d	d
�}|dd�}d}n"|�d�r?|dd�}d
}n|�dd�rS|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$




rc	Csxtj�|�}|\}}}}}}tj�|�d�d�}|dkr,|dkr,tj�|�d�d�}d|vr8|�dd�\}}||fS)N�/���zsourceforge.net�download����#�)�urllibr�urlparse�unquote�split)	�url�parts�scheme�server�path�
parameters�query�fragmentr,r"r"r#�egg_info_for_urlWsrAccsf�t|�\}}t|||�D]}|Vq
|r-t�|�}|r/t||�d�|td�D]	}|Vq'dSdSdS)zEYield egg or source distribution objects that might be found at a URLr4)�
precedenceN)rA�distros_for_location�EGG_FRAGMENT�matchr�groupr)r9�metadatar,r@�distrEr"r"r#rbs�

��rcCs�|�d�r|dd�}|�d�rd|vrt�|||�gS|�d�r<d|vr<t|�}|��s/gSt||j|jtdd�gS|�d	�rUt|�\}}}|durUt	||||t
|�StD]}|�|�ro|dt|��}t	|||�SqWgS)
z:Yield egg or source distribution objects based on basename�.egg.zipNr'z.egg�-z.whlr4)�location�project_name�versionrBr%)
r)r�
from_locationr�
is_compatiblerLrMrrrr�
EXTENSIONS�len)rK�basenamerG�wheelZwin_baser-�platform�extr"r"r#rCps4
�
�
�rCcCstt|�tj�|�|�S)zEYield possible egg or source distribution objects based on a filename)rCr�osr=rR)�filenamerGr"r"r#�distros_for_filename�s�rXc
cs~�|�d�}|stdd�|dd�D��rdStdt|�d�D]}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!
    rJcss�|]	}t�d|�VqdS)z	py\d\.\d$N)�rerE)�.0�pr"r"r#�	<genexpr>�s�z(interpret_distro_name.<locals>.<genexpr>�Nr4)�
py_versionrBrT)r8�any�rangerQr�join)rKrRrGr^rBrTr:r[r"r"r#r�s�
$
��rcst���fdd��}|S)zs
    Wrap a function returning an iterable such that the resulting iterable
    only ever yields unique items.
    cst�|i|���S�Nr)�args�kwargs��funcr"r#�wrapper�szunique_values.<locals>.wrapperr)rfrgr"rer#�
unique_values�srhz(<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>c	cs��t�|�D]2}|��\}}tttj|���d���}d|vs#d|vr8t	�|�D]}t
j�|t
|�d���Vq(qdD] }|�|�}|dkr[t	�||�}|r[t
j�|t
|�d���Vq;dS)zEFind rel="homepage" and rel="download" links in `page`, yielding URLs�,Zhomepager1r4)z
<th>Home Pagez<th>Download URLr0N)�REL�finditer�groups�set�map�str�stripr(r8�HREFr5r�urljoin�
htmldecoderF�find�search)r9�pagerE�tag�relZrels�posr"r"r#�find_external_links�s ��
��rzc@�(eZdZdZdd�Zdd�Zdd�ZdS)	�ContentCheckerzP
    A null content checker that defines the interface for checking content
    cC�dS)z3
        Feed a block of data to the hash.
        Nr"��self�blockr"r"r#�feed��zContentChecker.feedcCr})zC
        Check the hash. Return False if validation fails.
        Tr"�rr"r"r#�is_valid�r�zContentChecker.is_validcCr})zu
        Call reporter with information about the checker (hash name)
        substituted into the template.
        Nr")r�reporter�templater"r"r#�report�szContentChecker.reportN)�__name__�
__module__�__qualname__�__doc__r�r�r�r"r"r"r#r|�s
r|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�|�|_||_dSrb)�	hash_name�hashlib�new�hash�expected)rr�r�r"r"r#�__init__�s
zHashChecker.__init__cCsBtj�|�d}|s
t�S|j�|�}|st�S|di|����S)z5Construct a (possibly null) ContentChecker from a URLr0Nr")r5rr6r|�patternru�	groupdict)�clsr9r@rEr"r"r#�from_urlszHashChecker.from_urlcCs|j�|�dSrb)r��updater~r"r"r#r��zHashChecker.feedcCs|j��|jkSrb)r��	hexdigestr�r�r"r"r#r�r�zHashChecker.is_validcCs||j}||�Srb)r�)rr�r��msgr"r"r#r�s
zHashChecker.reportN)r�r�r�rY�compiler�r��classmethodr�r�r�r�r"r"r"r#r��s�

r�cs\eZdZdZ		dN�fdd�	Z�fdd	�ZdOdd�ZdOd
d�ZdOdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dPdd�Zdd�ZdP�fdd �	Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Z	
	dQd+d,�ZdRd-d.�Zd/d0�Zd1Zd2d3�Zd4d5�ZdPd6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Z d@dA�Z!e"dOdBdC��Z#dDdE�Z$dFdG�Z%dHdI�Z&dJdK�Z'dLdM�Z(�Z)S)Srz;A distribution index that scans web pages for download URLs�https://pypi.org/simple/��*NTcslt�j|i|��|dd|�d��|_i|_i|_i|_t�d�	t
t|���j|_
g|_tjj|_dS)Nr/�|)�superr�r)�	index_url�scanned_urls�fetched_urls�
package_pagesrYr�rarnrrE�allows�to_scanr5�request�urlopen�opener)rr��hostsZ	ca_bundleZ
verify_sslrc�kw��	__class__r"r#r�szPackageIndex.__init__cs0zt|j�Wn
tyYdSwt��|�Srb)rrM�	Exceptionr��add)rrHr�r"r#r�)s�zPackageIndex.addFcCs�||jvr	|s	dSd|j|<t|�s|�|�dStt|��}|r.|�|�s(dS|�d|�|s7|r7||jvrAtt|j	|��dS|�|�sMd|j|<dS|�
d|�d|j|<d}|�|||�}|durhdSt|t
jj�r||jdkr||�
d|j�d|j|j<d|j�d	d
���vr�|��dS|j}|��}t|t�s�t|t
jj�r�d}n|j�d�p�d}|�|d
�}|��t�|�D]}	t
j�|t|	� d���}
|�!|
�q�|�"|j#�r�t$|dd�dkr�|�%||�}dSdSdS)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�ignorer4�code�)&r��
URL_SCHEME�process_filename�listr�url_ok�debugr�rnr��info�open_url�
isinstancer5�error�	HTTPErrorr�r�r9�headers�getr(�close�readro�	get_param�decoderqrkrrrrsrF�process_urlr*r��getattr�
process_index)rr9�retrieve�dists�tmpl�fr,rvr�rE�linkr"r"r#r�2sV






�zPackageIndex.process_urlcCs�tj�|�s|�d|�dStj�|�r/|s/tj�|�}t�|�D]
}|�tj�||�d�q!t	|�}|rE|�
d|�tt|j
|��dSdS)Nz
Not found: %sTz	Found: %s)rVr=�exists�warn�isdir�realpath�listdirr�rarXr�r�rnr�)r�fn�nestedr=�itemr�r"r"r#r�gs�zPackageIndex.process_filenamecCs`t|�}|o|�d���dk}|s|�tj�|�d�rdSd}|r(t||��|�||�dS)Nr4�fileTzN
Note: Bypassing %s (disallowed host; see http://bit.ly/2hrImnY for details).
)	r�rFr(r�r5rr6rr�)rr9�fatal�s�is_filer�r"r"r#r�ws�zPackageIndex.url_okcCs2ttjj|�}dd�|D�}tt�|j|��dS)Ncss2�|]}t�|�D]}|�d�r	||fVq	qdS)z	.egg-linkN)rVr�r))rZr=�entryr"r"r#r\�s����z.PackageIndex.scan_egg_links.<locals>.<genexpr>)�filterrVr=r�r��	itertools�starmap�
scan_egg_link)r�search_path�dirsZ	egg_linksr"r"r#�scan_egg_links�s
�zPackageIndex.scan_egg_linkscCs�ttj�||���}ttdttj|���}Wd�n1swYt	|�dkr,dS|\}}t
tj�||��D]}tjj|g|�R�|_t|_
|�|�q9dS)Nr])�openrVr=rar�r�rnrorprQr
rKrrBr�)rr=r�Z	raw_lines�linesZegg_pathZ
setup_pathrHr"r"r#r��s��zPackageIndex.scan_egg_linkcCs�d}|�|j�s
|Stttjj|t|j�d��d���}t|�dks)d|dvr+|St	|d�}t
|d�}d|j�|�
�i�|<t|�t|�fS)N)NNr/r]r3r4rT)r*r�r�rnr5rr7rQr8rrr��
setdefaultr(r
)rr�ZNO_MATCH_SENTINELr:�pkg�verr"r"r#�_scan�s�zPackageIndex._scanc	
Cs�t�|�D]}z|�tj�|t|�d����Wqty!Yqw|�|�\}}|s-dSt	||�D]$}t
|�\}}|�d�rQ|sQ|rL|d||f7}n|�|�|�
|�q2t�dd�|�S)z#Process the contents of a PyPI pager4r��.pyz
#egg=%s-%scSsd|�ddd�S)Nz<a href="%s#md5=%s">%s</a>r4�r])rF)�mr"r"r#�<lambda>�sz,PackageIndex.process_index.<locals>.<lambda>)rqrkr�r5rrrrsrFrrzrAr)�need_version_info�scan_url�PYPI_MD5�sub)	rr9rvrEr�r��new_urlr,�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�rr9r"r"r#r��s�zPackageIndex.need_version_infocGs<|j|jvr|r|j|g|�R�|�d�|�|j�dS)Nz6Scanning index of all packages (this may take a while))r�r�r�r�r��rr�rcr"r"r#r��s�zPackageIndex.scan_allcCsz|�|j|jd�|j�|j�s|�|j|jd�|j�|j�s)|�|�t|j�|jd��D]}|�|�q3dS)Nr/r")	r�r��unsafe_namer�r��keyrL�not_found_in_indexr�)r�requirementr9r"r"r#�
find_packages�s
�zPackageIndex.find_packagescsR|��|�|�||jD]}||vr|S|�d||�qtt|��||�S)Nz%s does not match %s)�prescanr�r�r�r�r�obtain)rr��	installerrHr�r"r#r��s
zPackageIndex.obtaincCsL|�|jd|�|��s$|��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�rV�unlinkrr�r+r=rR)r�checkerrW�tfpr"r"r#�
check_hash�s�
���zPackageIndex.check_hashcCsN|D]"}|jdust|�r|�d�stt|��r|�|�q|j�|�qdS)z;Add `urls` to the list that will be prescanned for searchesN�file:)r�r�r*r�rr��append)r�urlsr9r"r"r#�add_find_linkss
��
��zPackageIndex.add_find_linkscCs"|jrtt|j|j��d|_dS)z7Scan urls scheduled for prescanning (e.g. --find-links)N)r�r�rnr�r�r"r"r#r�s
zPackageIndex.prescancCs<||jr|jd}}n|jd}}|||j�|��dS)Nz#Couldn't retrieve index page for %rz3Couldn't find index page for %r (maybe misspelled?))r�r�r�r�r�)rr��methr�r"r"r#r�s
�zPackageIndex.not_found_in_indexcCs~t|t�s5t|�}|r)|�|�d�||�}t|�\}}|�d�r'|�|||�}|Stj	�
|�r1|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.
        r4r�rKN)r�rr��
_download_urlrFrAr)�	gen_setuprVr=r�r$r��fetch_distribution)rr �tmpdirr;�foundr,r@r"r"r#r1#s

zPackageIndex.downloadc	s���d|�i�d}d
�����fdd�	}|r$�����|�||�}|s/|dur/|||�}|dur@�jdur<���||�}|durO|sO��|�||�}|dur`��d�rZdp[d|�dS��d|�|j|jd	�S)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�|dur�}||jD];}|jtkr#�s#|�vr"��d|�d�|<q||vo.|jtkp.�}|rF��|j��}||_tj	�
|j�rF|SqdS)Nz&Skipping development or system egg: %sr4)r�rBrr�rr1rK�download_locationrVr=r�)�req�envrH�test�loc��
develop_okrZskipped�sourcerr"r#rt]s(����z-PackageIndex.fetch_distribution.<locals>.findz:No local packages or working download links found for %s%sza source distribution of r�zBest match: %s)rKrb)r�r�r�r�r��cloner
)	rr�r�
force_scanrrZlocal_indexrHrtr"rr#r
Es2




�zPackageIndex.fetch_distributioncCs"|�||||�}|dur|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)r
rK)rr�rrrrHr"r"r#�fetch�szPackageIndex.fetchc		Cst�|�}|rdd�t||�d�d�D�pg}t|�dkrztj�|�}tj�|�|krGtj�	||�}tj�
|�r?tj�||�sGt�
||�|}ttj�	|d�d��}|�d|dj|djtj�|�df�Wd�|S1sswY|S|r�td||f��td	��)
NcSsg|]}|jr|�qSr")rM)rZ�dr"r"r#�
<listcomp>�s��z*PackageIndex.gen_setup.<locals>.<listcomp>r4zsetup.py�wzIfrom setuptools import setup
setup(name=%r, version=%r, py_modules=[%r])
rz�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.)rDrErrFrQrVr=rR�dirnamerar��samefile�shutil�copy2r��writerLrM�splitextr)	rrWr@rrEr�rR�dstr�r"r"r#r	�sD

�����
�	�	���zPackageIndex.gen_setupi cCs2|�d|�d}z�t�|�}|�|�}t|tjj�r%td||j	|j
f��|��}d}|j}d}d|vrI|�d�}	t
tt|	��}|�|||||�t|d��1}
	|�|�}|ro|�|�|
�|�|d	7}|�|||||�nnqP|�|||
�Wd�n1s�wY|W|r�|��SS|r�|��ww)
NzDownloading %szCan't download %s: %s %srr0zcontent-lengthzContent-Length�wbTr4)r�r�r�r�r�r5r�r�rr�r��dl_blocksize�get_all�maxrn�int�
reporthookr�r�r�rrr�)rr9rW�fprr��blocknum�bs�size�sizesrr�r"r"r#�_download_to�sF

�



�	�
�
�zPackageIndex._download_tocCsdSrbr")rr9rWr)Zblksizer+r"r"r#r'��zPackageIndex.reporthookc
Cs�|�d�r	t|�Szt||j�WSttjjfyD}z$d�dd�|j	D��}|r0|�
||�n	td||f�|�WYd}~dSd}~wtj
jyY}z|WYd}~Sd}~wtj
jy�}z|rl|�
||j�n
td||jf�|�WYd}~dSd}~wtjjy�}z|r�|�
||j�n
td||jf�|�WYd}~dSd}~wtjjtj
fy�}z|r�|�
||�n	td||f�|�WYd}~dSd}~ww)Nr� cSsg|]}t|��qSr")ro)rZ�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�http�client�
InvalidURLrarcr�rr5r�r��URLError�reason�
BadStatusLine�line�
HTTPException�socket)rr9�warning�vr�r"r"r#r��s^
�����������������zPackageIndex.open_urlcCs�t|�\}}|rd|vr|�dd��dd�}d|vsnd}|�d�r(|dd�}tj�||�}|dks8|�d	�r>|�||�S|d
ksG|�d�rM|�||�S|�d�rX|�	||�S|d
krht
j�t
j
�|�d�S|�|d�|�||�S)Nz..�.�\�_Z__downloaded__rIr'�svnzsvn+�gitzgit+zhg+r�r]T)rA�replacer)rVr=rar*�
_download_svn�
_download_git�_download_hgr5r��url2pathnamerr6r��_attempt_download)rr;r9rr+r@rWr"r"r#rs(��

zPackageIndex._download_urlcCs|�|d�dS)NT)r�r�r"r"r#r�0r�zPackageIndex.scan_urlcCs2|�||�}d|�dd���vr|�|||�S|S)Nr�r�r�)r-r�r(�_download_html)rr9rWr�r"r"r#rH3szPackageIndex._attempt_downloadcCsjt|�}|D]}|��r%t�d|�r#|��t�|�|�||�Snq|��t�|�td|��)Nz <title>([^- ]+ - )?Revision \d+:zUnexpected HTML page found at )	r�rprYrur�rVr�rDr)rr9r�rWr�r9r"r"r#rI:s
�
zPackageIndex._download_htmlcCst�dt�|�dd�d}d}|���d�rqd|vrqtj�|�\}}}}}}	|sq|�d�rqd	|d
d�vrq|d
d��d	d�\}}t	|�\}
}|
rqd|
vr]|
�dd�\}}
d||
f}nd
|
}|}||||||	f}tj�
|�}|�d||�t�
d|||f�|S)Nz"SVN download support is deprecatedr3r4rr�zsvn:�@z//r/r]�:z --username=%s --password=%sz --username=z'Doing subversion checkout from %s to %szsvn checkout%s -q %s %s)�warningsr��UserWarningr8r(r*r5rr6�
_splituser�
urlunparser�rV�system)rr9rW�credsr;�netlocr=r[�qr��auth�host�user�pwr:r"r"r#rDIs&zPackageIndex._download_svncCsptj�|�\}}}}}|�dd�d}|�dd�d}d}d|vr)|�dd�\}}tj�||||df�}||fS)N�+r4r0r3rrJr�)r5r�urlsplitr8�rsplit�
urlunsplit)r9�
pop_prefixr;rRr=r?r��revr"r"r#�_vcs_split_rev_from_url_sz$PackageIndex._vcs_split_rev_from_urlcC�l|�dd�d}|j|dd�\}}|�d||�t�d||f�|dur4|�d|�t�d	||f�|S)
Nr3r4rT�r\zDoing git clone from %s to %szgit clone --quiet %s %szChecking out %szgit -C %s checkout --quiet %s�r8r^r�rVrP�rr9rWr]r"r"r#rEq��zPackageIndex._download_gitcCr_)
Nr3r4rTr`zDoing hg clone from %s to %szhg clone --quiet %s %szUpdating to %szhg --cwd %s up -C -r %s -qrarbr"r"r#rF�rczPackageIndex._download_hgcG�tj|g|�R�dSrb)rr�r�r"r"r#r���zPackageIndex.debugcGrdrb)rr�r�r"r"r#r��rezPackageIndex.infocGrdrb)rr�r�r"r"r#r��rezPackageIndex.warn)r�r�NT)Frb)FFFN)FF)*r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�r�r1r
rr	r#r-r'r�rr�rHrIrD�staticmethodr^rErFr�r�r��
__classcell__r"r"r�r#rsV�
	
5



		
#
�
L
($
#rz!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?cCs|�d�}t�|�S)Nr)rFr��unescape)rE�whatr"r"r#�
decode_entity�s

rjcCs
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_subrj)�textr"r"r#rs�s
	rscs�fdd�}|S)Ncs��fdd�}|S)Nc	s:t��}t���z
�|i|��Wt�|�St�|�wrb)r;�getdefaulttimeout�setdefaulttimeout)rcrdZold_timeout)rf�timeoutr"r#�_socket_timeout�s

z@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeoutr")rfrp�rorer#rp�sz'socket_timeout.<locals>._socket_timeoutr")rorpr"rqr#�socket_timeout�srrcCs2tj�|�}|��}t�|�}|��}|�dd�S)a9
    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�)r5rr7�encode�base64�	b64encoder�rC)rTZauth_sZ
auth_bytesZ
encoded_bytes�encodedr"r"r#�_encode_auth�s

rxc@r{)	�
Credentialz:
    A username/password pair. Use like a namedtuple.
    cCs||_||_dSrb��username�password)rr{r|r"r"r#r��s
zCredential.__init__ccs�|jV|jVdSrbrzr�r"r"r#�__iter__�s�zCredential.__iter__cCsdt|�S)Nz%(username)s:%(password)s)�varsr�r"r"r#�__str__�szCredential.__str__N)r�r�r�r�r�r}rr"r"r"r#ry�s
rycs8eZdZ�fdd�Zedd��Zdd�Zdd�Z�ZS)	�
PyPIConfigcsPt�gd�d�}t��|�tj�tj�d�d�}tj�|�r&|�	|�dSdS)z%
        Load from ~/.pypirc
        )r{r|�
repositoryr��~z.pypircN)
�dict�fromkeysr�r�rVr=ra�
expanduserr�r�)r�defaults�rcr�r"r#r��s�zPyPIConfig.__init__cs&�fdd����D�}tt�j|��S)Ncs g|]}��|d���r|�qS)r�)r�rp)rZ�sectionr�r"r#r�s��z2PyPIConfig.creds_by_repository.<locals>.<listcomp>)�sectionsr�rn�_get_repo_cred)rZsections_with_repositoriesr"r�r#�creds_by_repository�s
�zPyPIConfig.creds_by_repositorycCs6|�|d���}|t|�|d���|�|d����fS)Nr�r{r|)r�rpry)rr��repor"r"r#r��s
�zPyPIConfig._get_repo_credcCs*|j��D]
\}}|�|�r|SqdS)z�
        If the URL indicated appears to be a repository defined in this
        config, return the credential for that repository.
        N)r��itemsr*)rr9r��credr"r"r#�find_credentials

��zPyPIConfig.find_credential)	r�r�r�r��propertyr�r�r�rgr"r"r�r#r��s
r�cCs:tj�|�}|\}}}}}}|�d�rtj�d��|dvr$t|�\}	}
nd}	|	sBt��	|�}|rBt
|�}	|j|f}tj
dg|�R�|	redt|	�}	||
||||f}
tj�|
�}tj�|�}|�d|	�ntj�|�}|�dt�||�}|	r�tj�|j�\}}}}}}||kr�||
kr�||||||f}
tj�|
�|_|S)	z4Open a urllib2 request, handling HTTP authenticationrKznonnumeric port: '')r3�httpsNz*Authenticating as %s for %s (from .pypirc)zBasic �
Authorizationz
User-Agent)r5rr6r)r3r4r5rNr�r�ror{rr�rxrOr��Request�
add_header�
user_agentr9)r9r��parsedr;rRr=�paramsr?r�rT�addressr�r�r:r�r�r(�s2Zh2Zpath2Zparam2Zquery2Zfrag2r"r"r#r2s8

r2cCs$|�d�\}}}|r||fSd|fS)zNsplituser('user[:passwd]@host[:port]')
    --> 'user[:passwd]', 'host[:port]'.rJN)�
rpartition)rUrV�delimr"r"r#rN;srNcCs|Srbr")r9r"r"r#�
fix_sf_urlFr.r�c	Cs*tj�|�\}}}}}}tj�|�}tj�|�rtj�|�S|�	d�r}tj�
|�r}g}t�|�D];}	tj�||	�}
|	dkrXt
|
d��}|��}Wd�n1sQwYn tj�
|
�rb|	d7}	|�dj|	d��q0d}
|
j|d�|�d	�}d
\}}nd\}}}dd
i}t�|�}tj�|||||�S)z7Read a local path, with special support for directoriesr/z
index.html�rNz<a href="{name}">{name}</a>)r+zB<html><head><title>{url}</title></head><body>{files}</body></html>rs)r9�files)���OK)r�zPath not foundz	Not foundr�z	text/html)r5rr6r�rGrVr=�isfiler�r)r�r�rar�r�r�format�io�StringIOr�r�)r9r;r<r=�paramr?r�rWr�r��filepathr(�bodyr��status�messager�Zbody_streamr"r"r#r1Js0
��


r1rb)r)Zr��sysrVrYr�rr;rur�r�rL�configparserr��http.clientr3�urllib.parser5�urllib.request�urllib.error�	functoolsrr�
pkg_resourcesrrrrrr	r
rrr
rrrr�	distutilsrZdistutils.errorsr�fnmatchrZsetuptools.wheelrZ setuptools.extern.more_itertoolsrr�rD�Irqr�rEr�r8rP�__all__Z_SOCKET_TIMEOUTZ_tmplr��version_infor�r$rrArrCrXrrhrjrzr|r�rr�rkrjrsrrrxry�RawConfigParserr�r�r�r2rNr�r1r"r"r"r#�<module>s�@
��	


!
�#

!	
&/