403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.7/site-packages/setuptools/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.7/site-packages/setuptools/__pycache__/package_index.cpython-37.opt-1.pyc
B

�a���@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�Z7ddddgZ8dZ9dZ:e:j;dj;ej<�ed�Z=dd�Z>dd�Z?dd�Z@dAdd�ZAdBdd�ZBdCdd �ZCdedfd!d�ZDd"d#�ZEe�/d$ej1�ZFeEd%d&��ZGGd'd(�d(�ZHGd)d*�d*eH�ZIGd+d�de�ZJe�/d,�jKZLd-d.�ZMd/d0�ZNdDd1d2�ZOd3d4�ZPGd5d6�d6�ZQGd7d8�d8ejR�ZSejTjUfd9d:�ZVd;d<�ZWeOe9�eV�ZVd=d>�ZXd?d@�ZYdS)Ez#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
CsBy
t�|�Stk
r<}ztd|f�|�Wdd}~XYnXdS)Nz1Not a URL, existing file, or requirement spec: %r)r
�parse�
ValueErrorr)�spec�e�r �</usr/lib/python3.7/site-packages/setuptools/package_index.py�parse_requirement_arg6s

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)NNNz.exez
.win32.exeNi�����win32z	.win32-pyi�i�������z.win-amd64.exei�z	win-amd64z
.win-amd64-pyi��)�lower�endswith�
startswith)�namer%�base�py_verZplatr r r!r?s$



c	Csxtj�|�}|\}}}}}}tj�|�d�d�}|dkrX|dkrXtj�|�d�d�}d|krp|�dd�\}}||fS)N�/���zsourceforge.net�download����#�)�urllibr�urlparse�unquote�split)	�url�parts�scheme�server�pathZ
parameters�query�fragmentr)r r r!�egg_info_for_urlWsr<ccsdt|�\}}xt|||�D]
}|VqW|r`t�|�}|r`x$t||�d�|td�D]
}|VqRWdS)zEYield egg or source distribution objects that might be found at a URLr0)�
precedenceN)r<�distros_for_location�EGG_FRAGMENT�matchr�groupr)r5�metadatar)r;�distr@r r r!rbs

cCs�|�d�r|dd�}|�d�r8d|kr8t�|||�gS|�d�rxd|krxt|�}|��s^gSt||j|jtdd�gS|�d	�r�t|�\}}}|dk	r�t	||||t
|�Sx4tD],}|�|�r�|dt|��}t	|||�Sq�WgS)
z:Yield egg or source distribution objects based on basenamez.egg.zipNr$z.egg�-z.whlr0)�location�project_name�versionr=z.exe)
r&rZ
from_locationrZ
is_compatiblerFrGrrrr�
EXTENSIONS�len)rE�basenamerBZwheelZwin_baser*�platformZextr r r!r>ps.



r>cCstt|�tj�|�|�S)zEYield possible egg or source distribution objects based on a filename)r>r�osr9rJ)�filenamerBr r r!�distros_for_filename�srNc
cs�|�d�}|s,tdd�|dd�D��r,dSxNtdt|�d�D]8}t||d�|d|��d�||d��|||d�Vq@WdS)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!
    rDcss|]}t�d|�VqdS)z	py\d\.\d$N)�rer@)�.0�pr r r!�	<genexpr>�sz(interpret_distro_name.<locals>.<genexpr>�Nr0)�
py_versionr=rK)r4�any�rangerIr�join)rErJrBrTr=rKr6rQr r r!r�s
$cst���fdd��}|S)zs
    Wrap a function returning an iterable such that the resulting iterable
    only ever yields unique items.
    cst�||��S)N)r)�args�kwargs)�funcr r!�wrapper�szunique_values.<locals>.wrapper)r)rZr[r )rZr!�
unique_values�sr\z(<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>c	cs�xvt�|�D]h}|��\}}tttj|���d���}d|ksFd|krx,t	�|�D]}t
j�|t
|�d���VqRWqWxHdD]@}|�|�}|dkr~t	�||�}|r~t
j�|t
|�d���Vq~WdS)zEFind rel="homepage" and rel="download" links in `page`, yielding URLs�,Zhomepager-r0)z
<th>Home Pagez<th>Download URLr,N)�REL�finditer�groups�set�map�str�stripr%r4�HREFr1r�urljoin�
htmldecoderA�find�search)r5�pager@�tagZrelZrels�posr r r!�find_external_links�s"

rmc@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 )ror r r!�is_valid�szContentChecker.is_validcCsdS)zu
        Call reporter with information about the checker (hash name)
        substituted into the template.
        Nr )ro�reporter�templater r r!�report�szContentChecker.reportN)�__name__�
__module__�__qualname__�__doc__rqrrrur r r r!rn�srnc@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�|�|_||_dS)N)�	hash_name�hashlib�new�hash�expected)ror{rr r r!�__init__�szHashChecker.__init__cCs>tj�|�d}|st�S|j�|�}|s0t�S|f|���S)z5Construct a (possibly null) ContentChecker from a URLr,)r1rr2rn�patternri�	groupdict)�clsr5r;r@r r r!�from_urlszHashChecker.from_urlcCs|j�|�dS)N)r~�update)rorpr r r!rqszHashChecker.feedcCs|j��|jkS)N)r~Z	hexdigestr)ror r r!rrszHashChecker.is_validcCs||j}||�S)N)r{)rorsrt�msgr r r!rus
zHashChecker.reportN)rvrwrxrO�compiler�r��classmethodr�rqrrrur r r r!rz�srzcsPeZdZdZdNdd�Z�fdd	�ZdOdd�ZdPd
d�ZdQdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dRdd�Zdd�ZdS�fdd �	Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�ZdTd+d,�ZdUd-d.�Zd/d0�Zd1Zd2d3�Zd4d5�ZdVd6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Z d@dA�Z!e"dWdBdC��Z#dDdE�Z$dFdG�Z%dHdI�Z&dJdK�Z'dLdM�Z(�Z)S)Xrz;A distribution index that scans web pages for download URLs�https://pypi.org/simple/��*NTcOsltj|f|�|�|dd|�d��|_i|_i|_i|_t�d�	t
t|���j|_
g|_tjj|_dS)Nr+�|)rr�r&�	index_url�scanned_urls�fetched_urls�
package_pagesrOr�rWrbrr@�allows�to_scanr1�request�urlopen�opener)ror�ZhostsZ	ca_bundleZ
verify_sslrX�kwr r r!r�szPackageIndex.__init__cs0yt|j�Wntk
r"dSXt��|�S)N)rrG�	Exception�super�add)rorC)�	__class__r r!r�)s
zPackageIndex.addFcCs�||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
�}|��x6t�|�D](}	t
j�|t|	� d���}
|�!|
��q�W|�"|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�htmlzcontent-type�zlatin-1�charset�ignorer0�codei�)&r��
URL_SCHEME�process_filename�listr�url_ok�debugr�rbr��info�open_url�
isinstancer1�error�	HTTPErrorr�r�r5�headers�getr%�close�readrcZ	get_param�decoderer_rrfrgrA�process_urlr'r��getattr�
process_index)ror5Zretrieve�dists�tmpl�fr)rjr�r@�linkr r r!r�2sT





 zPackageIndex.process_urlcCs�tj�|�s|�d|�dStj�|�rb|sbtj�|�}x(t�|�D]}|�tj�||�d�qDWt	|�}|r�|�
d|�tt|j
|��dS)Nz
Not found: %sTz	Found: %s)rLr9�exists�warn�isdir�realpath�listdirr�rWrNr�r�rbr�)ro�fn�nestedr9�itemr�r r r!r�gszPackageIndex.process_filenamecCsbt|�}|o|�d���dk}|s8|�tj�|�d�r<dSd}|rRt||��n|�||�dS)Nr0�fileTzN
Note: Bypassing %s (disallowed host; see http://bit.ly/2hrImnY for details).
)	r�rAr%r�r1rr2rr�)ror5Zfatal�s�is_filer�r r r!r�wszPackageIndex.url_okcCs2ttjj|�}dd�|D�}tt�|j|��dS)Ncss0|](}t�|�D]}|�d�r||fVqqdS)z	.egg-linkN)rLr�r&)rPr9�entryr r r!rR�sz.PackageIndex.scan_egg_links.<locals>.<genexpr>)�filterrLr9r�r��	itertools�starmap�
scan_egg_link)roZsearch_path�dirsZ	egg_linksr r r!�scan_egg_links�szPackageIndex.scan_egg_linksc	Cs�ttj�||���}ttdttj|���}WdQRXt	|�dkrDdS|\}}x>t
tj�||��D](}tjj|f|��|_t|_
|�|�q`WdS)NrS)�openrLr9rWr�r�rbrcrdrIr	rErr=r�)ror9r�Z	raw_lines�linesZegg_pathZ
setup_pathrCr r r!r��s zPackageIndex.scan_egg_linkcCs�d}|�|j�s|Stttjj|t|j�d��d���}t|�dksRd|dkrV|St	|d�}t
|d�}d|j�|�
�i�|<t|�t|�fS)N)NNr+rSr/r0rT)r'r�r�rbr1rr3rIr4r
rr��
setdefaultr%r)ror�ZNO_MATCH_SENTINELr6�pkg�verr r r!�_scan�s"zPackageIndex._scanc	
Cs�xJt�|�D]<}y"|�tj�|t|�d����Wqtk
rFYqXqW|�|�\}}|sbdSxVt	||�D]H}t
|�\}}|�d�r�|s�|r�|d||f7}n
|�|�|�
|�qnWt�dd�|�S)z#Process the contents of a PyPI pager0r�z.pyz
#egg=%s-%scSsd|�ddd�S)Nz<a href="%s#md5=%s">%s</a>r0�rS)rA)�mr r r!�<lambda>��z,PackageIndex.process_index.<locals>.<lambda>)rer_r�r1rrfrgrArrmr<r&�need_version_info�scan_url�PYPI_MD5�sub)	ror5rjr@r�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)ror5r r r!r��szPackageIndex.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�)ror�rXr r r!r��szPackageIndex.scan_allcCs~|�|j|jd�|j�|j�s:|�|j|jd�|j�|j�sR|�|�x&t|j�|jd��D]}|�|�qhWdS)Nr+r )	r�r��unsafe_namer�r��keyrF�not_found_in_indexr�)ro�requirementr5r r r!�
find_packages�s
zPackageIndex.find_packagescsR|��|�|�x,||jD]}||kr.|S|�d||�qWtt|��||�S)Nz%s does not match %s)�prescanr�r�r�r�r�obtain)ror�Z	installerrC)r�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)rur�rrr�rL�unlinkrr~r(r9rJ)ro�checkerrM�tfpr r r!�
check_hash�s

zPackageIndex.check_hashcCsRxL|D]D}|jdks2t|�r2|�d�s2tt|��r>|�|�q|j�|�qWdS)z;Add `urls` to the list that will be prescanned for searchesNzfile:)r�r�r'r�rr��append)roZurlsr5r 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�rbr�)ror 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�)ror�Zmethr�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.
        r0z.pyrEN)r�r
r��
_download_urlrAr<r&�	gen_setuprLr9r�r"r��fetch_distribution)ror�tmpdirr7�foundr)r;r r r!r-#s

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�}x�||jD]r}|jtkrH�sH|�kr��d|�d�|<q||ko^|jtkp^�}|r��|j��}||_tj	�
|j�r|SqWdS)Nz&Skipping development or system egg: %sr0)r�r=rr�rr-rE�download_locationrLr9r�)Zreq�envrCZtest�loc)�
develop_okro�skipped�sourcer�r r!rh]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)rE)N)r�r�r�r�r�Zcloner�)	ror�r��
force_scanr�r�Zlocal_indexrCrhr )r�ror�r�r�r!r�Es0




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)r�rE)ror�r�r�r�rCr 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�WdQRX|S|r�td	||f��ntd
��dS)NcSsg|]}|jr|�qSr )rG)rP�dr r r!�
<listcomp>�sz*PackageIndex.gen_setup.<locals>.<listcomp>r0r)�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.)r?r@rrArIrLr9rJ�dirnamerWZsetuptools.command.easy_installr��shutilZcopy2r��writerFrG�splitextr)
rorMr;r�r@r�rJ�dstr�r�r r r!r��s2

 zPackageIndex.gen_setupi c	Cs|�d|�d}z�t�|�}|�|�}t|tjj�rJtd||j	|j
f��|��}d}|j}d}d|kr�|�d�}	t
tt|	��}|�|||||�t|d��Z}
xD|�|�}|r�|�|�|
�|�|d7}|�|||||�q�Pq�W|�|||
�WdQRX|S|�r|��XdS)	NzDownloading %szCan't download %s: %s %srr,zcontent-lengthzContent-Length�wbr0)r�rzr�r�r�r1r�r�rr�r��dl_blocksizeZget_all�maxrb�int�
reporthookr�r�rqr�r�r�)ror5rM�fpr�r��blocknum�bs�sizeZsizesr�rpr r r!�_download_to�s:





zPackageIndex._download_tocCsdS)Nr )ror5rMrZblksizerr r r!r�szPackageIndex.reporthookc
Cs�|�d�rt|�Syt||j�Sttjjfk
r�}z>d�dd�|j	D��}|r`|�
||�ntd||f�|�Wdd}~XY�ntj
jk
r�}z|Sd}~XYn�tj
jk
r�}z,|r�|�
||j�ntd||jf�|�Wdd}~XYn�tjjk
�rD}z.|�r |�
||j�ntd||jf�|�Wdd}~XYnTtjjtj
fk
�r�}z*|�rt|�
||�ntd||f�|�Wdd}~XYnXdS)Nzfile:� cSsg|]}t|��qSr )rc)rP�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�
InvalidURLrWrXr�rr1r�r�ZURLError�reasonZ
BadStatusLine�lineZ
HTTPException�socket)ror5Zwarning�vr�r r r!r��s8
$ zPackageIndex.open_urlcCs�t|�\}}|r4x&d|kr0|�dd��dd�}qWnd}|�d�rN|dd�}tj�||�}|dksn|�d	�rz|�||�S|d
ks�|�d�r�|�||�S|�d�r�|�	||�S|d
kr�t
j�t
j
�|�d�S|�|d�|�||�SdS)Nz..�.�\�_Z__downloaded__z.egg.zipr$Zsvnzsvn+Zgitzgit+zhg+r�rST)r<�replacer&rLr9rWr'�
_download_svn�
_download_git�_download_hgr1r��url2pathnamerr2r��_attempt_download)ror7r5r�r(r;rMr r r!r�s$


zPackageIndex._download_urlcCs|�|d�dS)NT)r�)ror5r r r!r�1szPackageIndex.scan_urlcCs6|�||�}d|�dd���kr.|�|||�S|SdS)Nr�zcontent-typer�)rr�r%�_download_html)ror5rMr�r r r!r4szPackageIndex._attempt_downloadcCslt|�}x@|D]8}|��rt�d|�rD|��t�|�|�||�SPqW|��t�|�td|��dS)Nz <title>([^- ]+ - )?Revision \d+:zUnexpected HTML page found at )	r�rdrOrir�rLr�rr)ror5r�rMr�rr r r!r;s


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 deprecatedr/r0rr�zsvn:�@z//r+rS�:z --username=%s --password=%sz --username=z'Doing subversion checkout from %s to %szsvn checkout%s -q %s %s)�warningsr��UserWarningr4r%r'r1rr2�
_splituser�
urlunparser�rL�system)ror5rMZcredsr7�netlocr9rQ�qr��auth�host�userZpwr6r r r!rJs&zPackageIndex._download_svncCsptj�|�\}}}}}|�dd�d}|�dd�d}d}d|krR|�dd�\}}tj�||||df�}||fS)N�+r0r,r/rrr�)r1rZurlsplitr4�rsplitZ
urlunsplit)r5�
pop_prefixr7r"r9r:r��revr r r!�_vcs_split_rev_from_url`sz$PackageIndex._vcs_split_rev_from_urlcCsl|�dd�d}|j|dd�\}}|�d||�t�d||f�|dk	rh|�d|�t�d	||f�|S)
Nr/r0rT)r)zDoing git clone from %s to %szgit clone --quiet %s %szChecking out %szgit -C %s checkout --quiet %s)r4r+r�rLr!)ror5rMr*r r r!rrs
zPackageIndex._download_gitcCsl|�dd�d}|j|dd�\}}|�d||�t�d||f�|dk	rh|�d|�t�d	||f�|S)
Nr/r0rT)r)zDoing hg clone from %s to %szhg clone --quiet %s %szUpdating to %szhg --cwd %s up -C -r %s -q)r4r+r�rLr!)ror5rMr*r r r!r�s
zPackageIndex._download_hgcGstj|f|��dS)N)rr�)ror�rXr r r!r��szPackageIndex.debugcGstj|f|��dS)N)rr�)ror�rXr r r!r��szPackageIndex.infocGstj|f|��dS)N)rr�)ror�rXr r r!r��szPackageIndex.warn)r�r�NT)F)F)F)N)N)FFFN)FF)N)F)*rvrwrxryr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r-r�r�r�r�rrr�r�r�rrr�staticmethodr+rrr�r�r��
__classcell__r r )r�r!rsP
	
5




		
#
J

)$
#z!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?cCs|�d�}t�|�S)Nr)rAr�Zunescape)r@Zwhatr r r!�
decode_entity�s
r.cCs
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_subr.)�textr r r!rg�s	rgcs�fdd�}|S)Ncs��fdd�}|S)Nc	s.t��}t���z
�||�St�|�XdS)N)rZgetdefaulttimeoutZsetdefaulttimeout)rXrYZold_timeout)rZ�timeoutr r!�_socket_timeout�s


z@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeoutr )rZr2)r1)rZr!r2�sz'socket_timeout.<locals>._socket_timeoutr )r1r2r )r1r!�socket_timeout�sr3cCs2tj�|�}|��}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�)r1rr3�encode�base64Z	b64encoder�r)r$Zauth_sZ
auth_bytesZ
encoded_bytesZencodedr r r!�_encode_auth�s

r7c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
Credentialz:
    A username/password pair. Use like a namedtuple.
    cCs||_||_dS)N)�username�password)ror9r:r r r!r��szCredential.__init__ccs|jV|jVdS)N)r9r:)ror r r!�__iter__�szCredential.__iter__cCsdt|�S)Nz%(username)s:%(password)s)�vars)ror r r!�__str__�szCredential.__str__N)rvrwrxryr�r;r=r r r r!r8�sr8c@s0eZdZdd�Zedd��Zdd�Zdd�Zd	S)
�
PyPIConfigcCsPt�dddgd�}tj�||�tj�tj�d�d�}tj�	|�rL|�
|�dS)z%
        Load from ~/.pypirc
        r9r:�
repositoryr��~z.pypircN)�dict�fromkeys�configparser�RawConfigParserr�rLr9rW�
expanduserr�r�)ro�defaultsZrcr r r!r��s
zPyPIConfig.__init__cs&�fdd����D�}tt�j|��S)Ncs g|]}��|d���r|�qS)r?)r�rd)rP�section)ror r!r��sz2PyPIConfig.creds_by_repository.<locals>.<listcomp>)ZsectionsrArb�_get_repo_cred)roZsections_with_repositoriesr )ror!�creds_by_repository�szPyPIConfig.creds_by_repositorycCs6|�|d���}|t|�|d���|�|d����fS)Nr?r9r:)r�rdr8)rorGZrepor r r!rH�szPyPIConfig._get_repo_credcCs*x$|j��D]\}}|�|�r|SqWdS)z�
        If the URL indicated appears to be a repository defined in this
        config, return the credential for that repository.
        N)rI�itemsr')ror5r?�credr r r!�find_credentials
zPyPIConfig.find_credentialN)rvrwrxr��propertyrIrHrLr r r r!r>�s	r>cCs<tj�|�}|\}}}}}}|�d�r2tj�d��|dkrHt|�\}	}
nd}	|	s�t��	|�}|r�t
|�}	|j|f}tj
d	|��|	r�dt|	�}	||
||||f}
tj�|
�}tj�|�}|�d|	�ntj�|�}|�dt�||�}|	�r8tj�|j�\}}}}}}||k�r8||
k�r8||||||f}
tj�|
�|_|S)
z4Open a urllib2 request, handling HTTP authenticationrznonnumeric port: '')r
ZhttpsN�*Authenticating as %s for %s (from .pypirc)zBasic Z
Authorizationz
User-Agent)rN)r1rr2r&r
rrrr>rLrcr9rr�r7r r�ZRequestZ
add_header�
user_agentr5)r5r�Zparsedr7r"r9�paramsr:r�r$ZaddressrKr�r6r�r�r�s2Zh2Zpath2Zparam2Zquery2Zfrag2r r r!r	
s8

r	cCs |�d�\}}}|r|nd|fS)zNsplituser('user[:passwd]@host[:port]')
    --> 'user[:passwd]', 'host[:port]'.rN)�
rpartition)r%r&Zdelimr r r!r<srcCs|S)Nr )r5r r r!�
fix_sf_urlGsrSc
Cstj�|�\}}}}}}tj�|�}tj�|�r<tj�|�S|�	d�r�tj�
|�r�g}x�t�|�D]b}	tj�||	�}
|	dkr�t
|
d��}|��}WdQRXPntj�
|
�r�|	d7}	|�dj|	d��qbWd}
|
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>r4)r5�files)��ZOK)i�zPath not foundz	Not foundzcontent-typez	text/html)r1rr2r�rrLr9�isfiler�r&r�r�rWr�r�r��format�io�StringIOr�r�)r5r7r8r9Zparamr:r�rMrUr��filepathrZbodyr��status�messager�Zbody_streamr r r!rKs,


r)N)N)N)r)Zry�sysrLrOrYr�rr6r|r�rrCr�Zhttp.clientr
Zurllib.parser1Zurllib.requestZurllib.error�	functoolsrrZ
pkg_resourcesrrrrrrr	r
rrr
rrrZ	distutilsrZdistutils.errorsrZfnmatchrZsetuptools.wheelrZ setuptools.extern.more_itertoolsrr�r?�Irer�r@r�r4rH�__all__Z_SOCKET_TIMEOUTZ_tmplrX�version_inforOr"rr<rr>rNrr\r^rmrnrzrr�r/r.rgr3r7r8rDr>r�r�r	rrSrr r r r!�<module>s�@
	

!
!
!

&/

Youez - 2016 - github.com/yon3zu
LinuXploit