403Webshell
Server IP : 3.96.16.70  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3.9/site-packages/setuptools/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/setuptools/__pycache__/package_index.cpython-39.pyc
a

H�8h���@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlmZddlZddlmZmZmZmZmZmZmZmZm Z m!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�0d
�Z1e�0dej2�Z3e�0d�Z4e�0d
ej2�j5Z6d�7�Z8gd�Z9dZ:dZ;e;j<dj<ej=�ed�Z>dd�Z?dd�Z@dd�ZAdBdd�ZBdCdd�ZCdDdd�ZDdedfd d!�ZEd"d#�ZFe�0d$ej2�ZGeFd%d&��ZHGd'd(�d(�ZIGd)d*�d*eI�ZJGd+d,�d,e�ZKe�0d-�jLZMd.d/�ZNd0d1�ZOdEd2d3�ZPd4d5�ZQGd6d7�d7�ZRGd8d9�d9ejS�ZTejUjVfd:d;�ZWd<d=�ZXePe:�eW�ZWd>d?�ZYd@dA�ZZdS)Fz#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
CsFzt�|�WSty@}ztd|f�|�WYd}~n
d}~00dS)Nz1Not a URL, existing file, or requirement spec: %r)r�parse�
ValueErrorr)�spec�e�r"�</usr/lib/python3.9/site-packages/setuptools/package_index.py�parse_requirement_arg7s��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����Zwin32z	.win32-pyi�i�������z.win-amd64.exei�z	win-amd64z
.win-amd64-pyi��)�lower�endswith�
startswith)�namer'�base�py_verZplatr"r"r#r@s$



rc	Csxtj�|�}|\}}}}}}tj�|�d�d�}|dkrX|dkrXtj�|�d�d�}d|vrp|�dd�\}}||fS)N�/���zsourceforge.net�download����#�)�urllibr�urlparse�unquote�split)	�url�parts�scheme�server�path�
parameters�query�fragmentr+r"r"r#�egg_info_for_urlXsr?ccs\t|�\}}t|||�D]
}|Vq|rXt�|�}|rXt||�d�|td�D]
}|VqLdS)zEYield egg or source distribution objects that might be found at a URLr2)�
precedenceN)r?�distros_for_location�EGG_FRAGMENT�matchr�groupr)r7�metadatar+r>�distrCr"r"r#rcs
�
rcCs�|�d�r|dd�}|�d�r8d|vr8t�|||�gS|�d�rxd|vrxt|�}|��s^gSt||j|jtdd�gS|�d	�r�t|�\}}}|dur�t	||||t
|�StD]0}|�|�r�|dt|��}t	|||�Sq�gS)
z:Yield egg or source distribution objects based on basename�.egg.zipNr&z.egg�-z.whlr2)�location�project_name�versionr@r%)
r(rZ
from_locationrZ
is_compatiblerJrKrrrr�
EXTENSIONS�len)rI�basenamerEZwheelZwin_baser,�platformZextr"r"r#rAqs2
�
�
rAcCstt|�tj�|�|�S)zEYield possible egg or source distribution objects based on a filename)rAr�osr;rN)�filenamerEr"r"r#�distros_for_filename�s�rRc
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!
    rHcss|]}t�d|�VqdS)z	py\d\.\d$N)�rerC)�.0�pr"r"r#�	<genexpr>��z(interpret_distro_name.<locals>.<genexpr>�Nr2)�
py_versionr@rO)r6�any�rangerMr�join)rIrNrErYr@rOr8rUr"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)rarbr"r`r#�
unique_values�srcz3<([^>]*\srel\s{0,10}=\s{0,10}['"]?([^'" >]+)[^>]*)>c	cs�t�|�D]d}|��\}}tttj|���d���}d|vsDd|vr
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�,Zhomepager/r2)z
<th>Home Pagez<th>Download URLr.N)�REL�finditer�groups�set�map�str�stripr'r6�HREFr3r�urljoin�
htmldecoderD�find�search)r7�pagerC�tag�relZrels�posr"r"r#�find_external_links�s
ruc@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"�rxr"r"r#�is_valid�szContentChecker.is_validcCsdS)zu
        Call reporter with information about the checker (hash name)
        substituted into the template.
        Nr")rx�reporter�templater"r"r#�report�szContentChecker.reportN)�__name__�
__module__�__qualname__�__doc__rzr|rr"r"r"r#rv�srvc@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�|�|_||_dSr])�	hash_name�hashlib�new�hash�expected)rxr�r�r"r"r#�__init__�szHashChecker.__init__cCsBtj�|�d}|st�S|j�|�}|s0t�S|fi|����S)z5Construct a (possibly null) ContentChecker from a URLr.)r3rr4rv�patternrp�	groupdict)�clsr7r>rCr"r"r#�from_urlszHashChecker.from_urlcCs|j�|�dSr])r��updaterwr"r"r#rzszHashChecker.feedcCs|j��|jkSr])r�Z	hexdigestr�r{r"r"r#r|szHashChecker.is_validcCs||j}||�Sr])r�)rxr}r~�msgr"r"r#rs
zHashChecker.reportN)r�r�r�rS�compiler�r��classmethodr�rzr|rr"r"r"r#r��s�

r�csZeZdZdZdPdd�Z�fdd	�ZdQdd�ZdRd
d�ZdSdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dTdd�Zdd�ZdU�fdd �	Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�ZdVd+d,�ZdWd-d.�Zd/d0�Zd1Zd2d3�Zd4d5�ZdXd6d7�Zd8d9�Zed:d;��Zd<d=�Z d>d?�Z!d@dA�Z"dBdC�Z#dDdE�Z$dFdG�Z%edHdI��Z&dJdK�Z'dLdM�Z(dNdO�Z)�Z*S)Yrz;A distribution index that scans web pages for download URLs�https://pypi.org/simple/��*NTcOsrtj|g|�Ri|��|dd|�d��|_i|_i|_i|_t�d�	t
t|���j|_
g|_tjj|_dS)Nr-�|)r	r�r(�	index_url�scanned_urls�fetched_urls�
package_pagesrSr�r\rirrC�allows�to_scanr3�request�urlopen�opener)rxr��hostsZ	ca_bundleZ
verify_sslr^�kwr"r"r#r�szPackageIndex.__init__cs0zt|j�Wnty"YdS0t��|�Sr])rrK�	Exception�super�add)rxrF��	__class__r"r#r�*s
zPackageIndex.addFcCs�||jvr|sdSd|j|<t|�s2|�|�dStt|��}|r\|�|�sPdS|�d|�|sn|rn||jvr�tt|j	|��dS|�|�s�d|j|<dS|�
d|�d|j|<d}|�|||�}|dur�dSt|t
jj�r�|jdkr�|�
d|j�d|j|j<d|j�d	d
���v�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�ignorer2�code�)&r��
URL_SCHEME�process_filename�listr�url_ok�debugr�rir��info�open_url�
isinstancer3�error�	HTTPErrorr�r�r7�headers�getr'�close�readrjZ	get_param�decoderlrfrrmrnrD�process_urlr)r��getattr�
process_index)rxr7Zretrieve�dists�tmpl�fr+rqr�rC�linkr"r"r#r�3sT





 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)rPr;�exists�warn�isdir�realpath�listdirr�r\rRr�r�rir�)rx�fn�nestedr;�itemr�r"r"r#r�hszPackageIndex.process_filenamecCsbt|�}|o|�d���dk}|s8|�tj�|�d�r<dSd}|rRt||��n|�||�dS)Nr2�fileTzN
Note: Bypassing %s (disallowed host; see http://bit.ly/2hrImnY for details).
)	r�rDr'r�r3rr4rr�)rxr7Zfatal�s�is_filer�r"r"r#r�xs�zPackageIndex.url_okcCs2ttjj|�}dd�|D�}tt�|j|��dS)Ncss0|](}t�|�D]}|�d�r||fVqqdS)z	.egg-linkN)rPr�r()rTr;�entryr"r"r#rV�s
�z.PackageIndex.scan_egg_links.<locals>.<genexpr>)�filterrPr;r�r��	itertools�starmap�
scan_egg_link)rxZsearch_path�dirsZ	egg_linksr"r"r#�scan_egg_links�s
�zPackageIndex.scan_egg_linkscCs�ttj�||���&}ttdttj|���}Wd�n1s>0Yt	|�dkrXdS|\}}t
tj�||��D]*}tjj|g|�R�|_t|_
|�|�qrdS)NrX)�openrPr;r\r�r�rirjrkrMr
rIrr@r�)rxr;r�Z	raw_lines�linesZegg_pathZ
setup_pathrFr"r"r#r��s4zPackageIndex.scan_egg_linkcCs�d}|�|j�s|Stttjj|t|j�d��d���}t|�dksRd|dvrV|St	|d�}t
|d�}d|j�|�
�i�|<t|�t|�fS)N)NNr-rXr1r2rT)r)r�r�rir3rr5rMr6rrr��
setdefaultr'r
)rxr�ZNO_MATCH_SENTINELr8�pkg�verr"r"r#�_scan�s�zPackageIndex._scanc	
Cs�t�|�D]:}z"|�tj�|t|�d����Wq
tyBYq
0q
|�|�\}}|s\dSt	||�D]H}t
|�\}}|�d�r�|s�|r�|d||f7}n
|�|�|�
|�qft�dd�|�S)z#Process the contents of a PyPI pager2r��.pyz
#egg=%s-%scSsd|�ddd�S)Nz<a href="%s#md5=%s">%s</a>r2�rX)rD)�mr"r"r#�<lambda>�rWz,PackageIndex.process_index.<locals>.<lambda>)rlrfr�r3rrmrnrDrrur?r(�need_version_info�scan_url�PYPI_MD5�sub)	rxr7rqrCr�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�rxr7r"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��rxr�r^r"r"r#r��s�zPackageIndex.scan_allcCsz|�|j|jd�|j�|j�s:|�|j|jd�|j�|j�sR|�|�t|j�|jd��D]}|�|�qfdS)Nr-r")	r�r��unsafe_namer�r��keyrJ�not_found_in_indexr�)rx�requirementr7r"r"r#�
find_packages�s
zPackageIndex.find_packagescsR|��|�|�||jD]"}||vr0|S|�d||�qtt|��||�S)Nz%s does not match %s)�prescanr�r�r�r�r�obtain)rxr�Z	installerrFr�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)rr�r|r�rP�unlinkrr�r*r;rN)rx�checkerrQ�tfpr"r"r#�
check_hash�s�
��zPackageIndex.check_hashcCsN|D]D}|jdus0t|�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)rxZurlsr7r"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�rir�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?))r�r�r�r�r�)rxr�Zmethr�r"r"r#r�s
�zPackageIndex.not_found_in_indexcCsvt|t�sbt|�}|rJ|�||�}t|�\}}|�d�rF|�|||�}|Stj�	|�rZ|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.
        r�rIN)
r�rr��
_download_urlr?r(�	gen_setuprPr;r�r$r��fetch_distribution)rxr �tmpdirr9�foundr+r>r"r"r#r/$s

zPackageIndex.downloadc	s���d|�i�d}d
�����fdd�	}|rH�����|�||�}|s^|dur^|||�}|dur��jdurx���||�}|dur�|s���|�||�}|dur���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�|dur�}||jD]v}|jtkrF�sF|�vr��d|�d�|<q||vo\|jtkp\�}|r��|j��}||_tj	�
|j�r|SqdS)Nz&Skipping development or system egg: %sr2)r�r@rr�rr/rI�download_locationrPr;r�)Zreq�envrF�testZloc��
develop_okrxZskipped�sourcer�r"r#ro^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)rI)N)r�r�r�r�r��cloner�)	rxr�r��
force_scanrrZlocal_indexrFror"r�r#r�Fs2




�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�rI)rxr�r�rrrFr"r"r#�fetch�szPackageIndex.fetchc
	Cst�|�}|r*dd�t||�d�d�D�p,g}t|�dkr�tj�|�}tj�|�|kr�tj�	||�}ddl
m}|||�s�t�
||�|}ttj�	|d�d��<}	|	�d|dj|djtj�|�df�Wd�n1s�0Y|S|�rtd	||f��ntd
��dS)NcSsg|]}|jr|�qSr")rK)rT�dr"r"r#�
<listcomp>�s�z*PackageIndex.gen_setup.<locals>.<listcomp>r2r)�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.)rBrCrrDrMrPr;rN�dirnamer\Zsetuptools.command.easy_installr�shutilZcopy2r��writerJrK�splitextr)
rxrQr>r�rCr�rNZdstrr�r"r"r#r��s@

��
���"���zPackageIndex.gen_setupi cCs:|�d|�d}�zt�|�}|�|�}t|tjj�rLtd||j	|j
f��|��}d}|j}d}d|vr�|�d�}	t
tt|	��}|�|||||�t|d��`}
|�|�}|r�|�|�|
�|�|d7}|�|||||�q�q�q�|�|||
�Wd�n1�s0Y|W|�r"|��Sn|�r4|��0dS)	NzDownloading %szCan't download %s: %s %srr.zcontent-lengthzContent-Length�wbr2)r�r�r�r�r�r3r�r�rr�r��dl_blocksizeZget_all�maxri�int�
reporthookr�r�rzrr�r�)rxr7rQ�fpr�r��blocknum�bs�sizeZsizesr�ryr"r"r#�_download_to�sD

�



.��zPackageIndex._download_tocCsdSr]r")rxr7rQrZblksizerr"r"r#r�szPackageIndex.reporthookc
Cs�|�d�rt|�Szt||j�WSttjjfy�}zHd�dd�|j	D��}|r`|�
||�ntd||f�|�WYd}~�n*d}~0tj
jy�}z|WYd}~Sd}~0tj
j�y}z4|r�|�
||j�ntd||jf�|�WYd}~n�d}~0tjj�yT}z6|�r,|�
||j�ntd||jf�|�WYd}~n^d}~0tjjtj
f�y�}z2|�r�|�
||�ntd||f�|�WYd}~n
d}~00dS)Nr�� cSsg|]}t|��qSr")rj)rT�argr"r"r#r�rWz)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�
InvalidURLr\r^r�rr3r�r�ZURLError�reasonZ
BadStatusLine�lineZ
HTTPException�socket)rxr7Zwarning�vr�r"r"r#r��sJ
(�������zPackageIndex.open_urlcCs�t|�\}}|r0d|vr4|�dd��dd�}qnd}|�d�rJ|dd�}tj�||�}|�t|��sttd|����|�	||�p�|�
||�S)	Nz..�.�\�_Z__downloaded__rGr&zInvalid filename )r?�replacer(rPr;r\r)rjr�
_download_vcs�_download_other)rxr7r�r*r>rQr"r"r#r�s
zPackageIndex._download_urlcCsLtj�|�j}|�d�\}}}tddgdgt|��}tt|h|@�d�S)a

        >>> rvcs = PackageIndex._resolve_vcs
        >>> rvcs('git+http://foo/bar')
        'git'
        >>> rvcs('hg+https://foo/bar')
        'hg'
        >>> rvcs('git:myhost')
        'git'
        >>> rvcs('hg:myhost')
        >>> rvcs('http://foo/bar')
        �+�svn�git�hgN)	r3r�urlsplitr9�	partitionrh�bool�next�iter)r7r9�pre�sep�postZallowedr"r"r#�_resolve_vcs*s
zPackageIndex._resolve_vcsc
Cs�|�|�}|sdS|dkr(td|����|�d�\}}}|�|�\}}|�d|�d|�d|���t�|dd||g�t|d	|d
d|g|d|dd	d
|dgd�}|dur�|�d|���t�||�|S)Nr)z/Invalid config, SVN download is not supported: r1zDoing z clone from z to rz--quietz-CZcheckoutz--cwdZupz-rz-q)r*r+z
Checking out )r4rr-�_vcs_split_rev_from_urlr��
subprocessZ
check_call�dict)rxr7Z
spec_filenameZvcsrQr$�revZco_commandsr"r"r#r&=s&
��zPackageIndex._download_vcscCsDtj�|�j}|dkr,tj�tj�|�j�S|�|d�|�	||�S)Nr�T)
r3rr,r9r��url2pathnamer4r;r��_attempt_download)rxr7rQr9r"r"r#r'Vs
zPackageIndex._download_othercCs|�|d�dS)NT)r�r�r"r"r#r�^szPackageIndex.scan_urlcCs6|�||�}d|�dd���vr.|�|||�S|SdS)Nr�r�r�)rr�r'�_download_html)rxr7rQr�r"r"r#r:aszPackageIndex._attempt_downloadcCsnt|�}|D]>}|��rt�d|�rF|��t�|�|�||�SqLq|��t�|�td|��dS)Nz <title>([^- ]+ - )?Revision \d+:zUnexpected HTML page found at )	r�rkrSrpr�rPr��
_download_svnr)rxr7r�rQr�rr"r"r#r;hs

zPackageIndex._download_htmlcCst�dt�|�dd�d}d}|���d�r�d|vr�tj�|�\}}}}}}	|s�|�d�r�d	|d
d�vr�|d
d��d	d�\}}t	|�\}
}|
r�d|
vr�|
�dd�\}}
d||
f}nd
|
}|}||||||	f}tj�
|�}|�d||�t�
d|||f�|S)Nz"SVN download support is deprecatedr1r2rr�zsvn:�@z//r-rX�:z --username=%s --password=%sz --username=z'Doing subversion checkout from %s to %szsvn checkout%s -q %s %s)�warningsr��UserWarningr6r'r)r3rr4�
_splituser�
urlunparser�rP�system)rxr7rQZcredsr9�netlocr;rU�qr��auth�host�userZpwr8r"r"r#r<ws&zPackageIndex._download_svncCsttj�|�}|j�dd�d}|j�d�\}}}|�d�\}}}|rL||fn|df\}}	|j||dd��	�}
|
|	fS)	a�
        Given a possible VCS URL, return a clean URL and resolved revision if any.

        >>> vsrfu = PackageIndex._vcs_split_rev_from_url
        >>> vsrfu('git+https://github.com/pypa/setuptools@v69.0.0#egg-info=setuptools')
        ('https://github.com/pypa/setuptools', 'v69.0.0')
        >>> vsrfu('git+https://github.com/pypa/setuptools#egg-info=setuptools')
        ('https://github.com/pypa/setuptools', None)
        >>> vsrfu('http://foo/bar')
        ('http://foo/bar', None)
        r(r2r.r1r=Nr�)r9r;r>)
r3rr,r9r6r;r-�
rpartition�_replace�geturl)r7r8Zclean_schemeZno_fragment_pathr$r1r2r3Z
clean_pathr8Zresolvedr"r"r#r5�s
�
z$PackageIndex._vcs_split_rev_from_urlcGstj|g|�R�dSr])rr�r�r"r"r#r��szPackageIndex.debugcGstj|g|�R�dSr])rr�r�r"r"r#r��szPackageIndex.infocGstj|g|�R�dSr])rr�r�r"r"r#r��szPackageIndex.warn)r�r�NT)F)F)F)N)N)FFFN)FF)N)+r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r/r�rr�rrrr�r��staticmethodr4r&r'r�r:r;r<r5r�r�r��
__classcell__r"r"r�r#rsX�

	
5




		
#�
L

)$
#

 rz!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?cCs|�d�}t�|�S)Nr)rDr�Zunescape)rCZwhatr"r"r#�
decode_entity�s
rNcCs
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_subrN)�textr"r"r#rn�s	rncs�fdd�}|S)Ncs��fdd�}|S)Nc	s>t��}t���z�|i|��Wt�|�St�|�0dSr])r ZgetdefaulttimeoutZsetdefaulttimeout)r^r_Zold_timeout)ra�timeoutr"r#�_socket_timeout�s

�z@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeoutr")rarR�rQr`r#rR�sz'socket_timeout.<locals>._socket_timeoutr")rQrRr"rSr#�socket_timeout�srTcCs2tj�|�}|��}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�)r3rr5�encode�base64Z	b64encoder�r%)rFZauth_sZ
auth_bytesZ
encoded_bytesZencodedr"r"r#�_encode_auth�s

rXc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
Credentialz:
    A username/password pair. Use like a namedtuple.
    cCs||_||_dSr]��username�password)rxr[r\r"r"r#r��szCredential.__init__ccs|jV|jVdSr]rZr{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#rY�srYc@s0eZdZdd�Zedd��Zdd�Zdd�Zd	S)
�
PyPIConfigcCsNt�gd�d�}tj�||�tj�tj�d�d�}tj�	|�rJ|�
|�dS)z%
        Load from ~/.pypirc
        )r[r\�
repositoryr��~z.pypircN)r7�fromkeys�configparser�RawConfigParserr�rPr;r\�
expanduserr�r�)rx�defaultsZrcr"r"r#r�s
zPyPIConfig.__init__cs&�fdd����D�}tt�j|��S)Ncs g|]}��|d���r|�qS)ra)r�rk)rT�sectionr{r"r#rs�z2PyPIConfig.creds_by_repository.<locals>.<listcomp>)Zsectionsr7ri�_get_repo_cred)rxZsections_with_repositoriesr"r{r#�creds_by_repositorys
�zPyPIConfig.creds_by_repositorycCs6|�|d���}|t|�|d���|�|d����fS)Nrar[r\)r�rkrY)rxrhZrepor"r"r#ris
�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)rj�itemsr))rxr7ra�credr"r"r#�find_credentials
zPyPIConfig.find_credentialN)r�r�r�r��propertyrjrirmr"r"r"r#r`s

r`cCs@tj�|�}|\}}}}}}|�d�r2tj�d��|dvrHt|�\}	}
nd}	|	s�t��	|�}|r�t
|�}	|j|f}tj
dg|�R�|	r�dt|	�}	||
||||f}
tj�|
�}tj�|�}|�d|	�ntj�|�}|�dt�||�}|	�r<tj�|j�\}}}}}}||k�r<||
k�r<||||||f}
tj�|
�|_|S)	z4Open a urllib2 request, handling HTTP authenticationr>znonnumeric port: '')r�httpsNz*Authenticating as %s for %s (from .pypirc)zBasic Z
Authorizationz
User-Agent)r3rr4r(rrrrAr`rmrjr[rr�rXrBr�ZRequestZ
add_header�
user_agentr7)r7r��parsedr9rDr;�paramsr=r�rF�addressrlr�r8r�r�r�s2Zh2Zpath2Zparam2Zquery2Zfrag2r"r"r#r)s8

rcCs |�d�\}}}|r|nd|fS)zNsplituser('user[:passwd]@host[:port]')
    --> 'user[:passwd]', 'host[:port]'.r=N)rI)rGrH�delimr"r"r#rAXsrAcCs|Sr]r")r7r"r"r#�
fix_sf_urlcsrvc	Cs,tj�|�\}}}}}}tj�|�}tj�|�r<tj�|�S|�	d�r�tj�
|�r�g}t�|�D]x}	tj�||	�}
|	dkr�t
|
d��}|��}Wd�n1s�0Yq�ntj�
|
�r�|	d7}	|�dj|	d��q`d}
|
j|d�|�d	�}d
\}}n
d\}}}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>rU)r7�files)��ZOK)r�zPath not foundz	Not foundr�z	text/html)r3rr4r�r9rPr;�isfiler�r(r�r�r\r�r�r��format�io�StringIOr�r�)r7r9r:r;Zparamr=r�rQrxr��filepathr�bodyr�Zstatus�messager�Zbody_streamr"r"r#rgs.&�


r)N)N)N)r)[r��sysr6rPrSr|r
r rWr�r�r?rdr�Zhttp.clientr�urllib.parser3Zurllib.requestZurllib.error�	functoolsrrZ
pkg_resourcesrrrrrr	r
rrr
rrrrZ	distutilsrZdistutils.errorsr�fnmatchrZsetuptools.wheelrZ setuptools.extern.more_itertoolsrr�rB�Irlr�rCr�r6rL�__all__Z_SOCKET_TIMEOUTZ_tmplr{�version_inforpr$rr?rrArRrrcrerurvr�rr�rOrNrnrTrXrYrer`r�r�rrArvrr"r"r"r#�<module>s�@
��	

!
�
#

!%
&/

Youez - 2016 - github.com/yon3zu
LinuXploit