MOON
Server: Apache
System: Linux s5.yayogua.com.py 6.12.0-124.55.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:54:02 EDT 2026 x86_64
User: sanbercountryclu (1012)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: //lib/python3.12/site-packages/setuptools/__pycache__/package_index.cpython-312.pyc
�

SSh���&�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.ej^d
�Z0ej^dejb�Z2ej^d�Z3ej^d
ejb�jhZ5djm�Z7gd�Z8dZ9dZ:e:jwdjvejx�e��Z=d�Z>d�Z?d�Z@d1d�ZAd1d�ZBd1d�ZCdedfd�ZDd�ZEej^dejb�ZF	eEd��ZGGd�d�ZHGd �d!eH�ZIGd"�d#e�ZJej^d$�j�ZLd%�ZMd&�ZNd2d'�ZOd(�ZPGd)�d*�ZQGd+�d,ej��ZSej�j�fd-�ZVd.�ZWeOe9�eV�ZVd/�ZXd0�ZYy)3z$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{}.{})�py_major�
setuptoolsc�n�	tj|�S#t$r}td|���|�d}~wwxYw)Nz/Not a URL, existing file, or requirement spec: )r�parse�
ValueErrorr)�spec�es  �=/usr/lib/python3.12/site-packages/setuptools/package_index.py�parse_requirement_argr'Es>���� � ��&�&�����CG�I�
��	���s��	4�/�4c�8�|j�}d\}}}|jd�ro|jd�r|dd}d}nV|jdd�r
|d	d
}|dd}d}n7|jd�r|dd}d
}n|jdd�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�plats     r&rrNs���
�J�J�L�E�)��D�&�$��~�~�f���>�>�,�'����:�D��D�
�
�
�k�3�
/��"�R�[�F����:�D��D�
�^�^�,�
-����:�D��D�
�
�
�o�s�
3��"�R�[�F����:�D��D������c�d�tjj|�}|\}}}}}}tjj|j	d�d�}|dk(r6|dk(r1tjj|j	d�d�}d|vr|j	dd�\}}||fS)N�/���zsourceforge.net�download����#�)�urllibr"�urlparse�unquote�split)	�url�parts�scheme�server�path�
parameters�query�fragmentr0s	         r&�egg_info_for_urlrGfs����L�L�!�!�#�&�E�8=�5�F�F�D�*�e�X��<�<����
�
�3��� 3�4�D�
�"�"�t�z�'9��|�|�#�#�D�J�J�s�O�B�$7�8��
�d�{����C��+���h���>�r3c#��K�t|�\}}t|||�D]}|���|rDtj|�}|r,t	||jd�|t��D]}|���yyy�w)zEYield egg or source distribution objects that might be found at a URLr:)�
precedenceN)rG�distros_for_location�EGG_FRAGMENT�matchr�groupr)r?�metadatar0rF�distrLs      r&rrqss����%�c�*�N�D�(�$�S�$��9���
�:���"�"�8�,���-��U�[�[��^�X�-����
����s�A,A.c�&�|jd�r|dd}|jd�rd|vrtj|||�gS|jd�rLd|vrHt|�}|j	�sgSt||j
|jtdz��gS|jd	�r%t|�\}}}|�t||||t|�StD]1}|j|�s�|dt|�}t|||�cSgS)
z:Yield egg or source distribution objects based on basename�.egg.zipNr+z.egg�-z.whlr:)�location�project_name�versionrIr))
r-r�
from_locationr�
is_compatiblerTrUrrrr�
EXTENSIONS�len)rS�basenamerN�wheel�win_baser1�platform�exts        r&rJrJs$������$��C�R�=������ �S�H�_��*�*�8�X�x�H�I�I����� �S�H�_��h����"�"�$��I��!�"�/�/��
�
�#�a�<�
�
�	
����� �%8��%B�"��&�(���(��(�H�f�k�8��
�
�����S�!���3�s�8�)�,�H�(��8�X�F�F���Ir3c�h�tt|�tjj	|�|�S)zEYield possible egg or source distribution objects based on a filename)rJr�osrCrZ)�filenamerNs  r&�distros_for_filenamerb�s*����x� �"�'�'�"2�"2�8�"<�h��r3c
#�FK�|jd�}|std�|ddD��rytt|��D]}||ddj	�s�nt|�}t||dj
|d|�dj
||d�|||����y�w)z�Generate the interpretation 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!
    rRc3�HK�|]}tjd|����y�w)z	py\d\.\d$N)�rerL)�.0�ps  r&�	<genexpr>z(interpret_distro_name.<locals>.<genexpr>�s����K��A�b�h�h�|�Q�7��s� "�Nr:)�
py_versionrIr])r>�any�rangerY�isdigitr�join)rSrZrNrjrIr]r@rgs        r&rr�s�����
�N�N�3��E��#�K��q�r��K�K���3�u�:�
����8�B�Q�<���!���
��J��
�������r��������q�r��������s
�AB!�AB!c�.��t���fd��}|S)zs
    Wrap a function returning an iterable such that the resulting iterable
    only ever yields unique items.
    c�&��t�|i|���S�Nr)�args�kwargs�funcs  �r&�wrapperzunique_values.<locals>.wrapper�s����t�T�4�V�4�5�5r3r)rtrus` r&�
unique_valuesrv�s"����4�[�6��6��Nr3z3<([^>]*\srel\s{0,10}=\s{0,10}['"]?([^'" >]+)[^>]*)>c
#�K�tj|�D]�}|j�\}}tt	t
j|j�jd���}d|vsd|vs�_tj|�D]<}tjj|t|jd������>��dD]l}|j|�}|dk7s�tj!||�}|s�3tjj|t|jd������ny�w)zEFind rel="homepage" and rel="download" links in `page`, yielding URLs�,�homepager7r:)z
<th>Home Pagez<th>Download URLr6N)�REL�finditer�groups�set�map�str�stripr,r>�HREFr;r"�urljoin�
htmldecoderM�find�search)r?�pagerL�tag�rel�rels�poss       r&�find_external_linksr��s��������d�#���<�<�>���S��3�s�y�y�#�)�)�+�"3�"3�C�"8�9�:������t�!3����s�+���l�l�*�*�3�
�5�;�;�q�>�0J�K�K�,�	$�5���i�i��n���"�9��K�K��c�*�E���l�l�*�*�3�
�5�;�;�q�>�0J�K�K�5�s�A4D?�7A1D?�)D?�=D?c�"�eZdZdZd�Zd�Zd�Zy)�ContentCheckerzP
    A null content checker that defines the interface for checking content
    c��y)z3
        Feed a block of data to the hash.
        N���self�blocks  r&�feedzContentChecker.feed�s��	r3c��y)zC
        Check the hash. Return False if validation fails.
        Tr��r�s r&�is_validzContentChecker.is_valid�s��r3c��y)zu
        Call reporter with information about the checker (hash name)
        substituted into the template.
        Nr�)r��reporter�templates   r&�reportzContentChecker.reports��
	r3N)�__name__�
__module__�__qualname__�__doc__r�r�r�r�r3r&r�r��s�����r3r�c�X�eZdZejd�Zd�Zed��Zd�Z	d�Z
d�Zy)�HashCheckerzK(?P<hash_name>sha1|sha224|sha384|sha256|sha512|md5)=(?P<expected>[a-f0-9]+)c�T�||_tj|�|_||_yrq)�	hash_name�hashlib�new�hash�expected)r�r�r�s   r&�__init__zHashChecker.__init__s ��"����K�K�	�*��	� ��
r3c���tjj|�d}|s
t�S|jj|�}|s
t�S|di|j
���S)z5Construct a (possibly null) ContentChecker from a URLr6r�)r;r"r<r��patternr��	groupdict)�clsr?rFrLs    r&�from_urlzHashChecker.from_urls^���<�<�(�(��-�b�1���!�#�#����"�"�8�,���!�#�#��'�U�_�_�&�'�'r3c�:�|jj|�yrq)r��updater�s  r&r�zHashChecker.feed s���	�	����r3c�P�|jj�|jk(Srq)r��	hexdigestr�r�s r&r�zHashChecker.is_valid#s���y�y�"�"�$��
�
�5�5r3c�0�||jz}||�Srq)r�)r�r�r��msgs    r&r�zHashChecker.report&s������'����}�r3N)r�r�r�re�compiler�r��classmethodr�r�r�r�r�r3r&r�r�
s?���b�j�j�	#��G�
!�
�(��(� �6�r3r�c�(��eZdZdZ				d&�fd�	Z�fd�Zd'd�Zd'd�Zd'd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d(d�Zd
�Zd(�fd�	Zd�Zd�Zd�Zd�Zd�Z				d)d�Zd*d�Zd�ZdZd�Zd�Zd(d�Zd�Zd�Zd�Zd�Z d�Z!e"d'd ��Z#d!�Z$d"�Z%d#�Z&d$�Z'd%�Z(�xZ)S)+rz;A distribution index that scans web pages for download URLsc�V��t�|�|i|��|dd|jd�z|_i|_i|_i|_tjdjtt|���j|_
g|_tj j"|_y)Nr5�|)�superr�r-�	index_url�scanned_urls�fetched_urls�
package_pagesrer�rnr~rrL�allows�to_scanr;�request�urlopen�opener)r�r��hosts�	ca_bundle�
verify_sslrr�kw�	__class__s       �r&r�zPackageIndex.__init__.s����	���$�%�"�%�"�S�)F�y�/A�/A�#�/F�+F�%G�G�������������j�j����#�i��*?�!@�A�G�G�������n�n�,�,��r3c�l��	t|j�t�|�|�S#t$rYywxYwrq)rrU�	Exceptionr��add)r�rOr�s  �r&r�zPackageIndex.add@s9���	��$�,�,�'��w�{�4� � ���	��	�s�'�	3�3c	���||jvr|syd|j|<t|�s|j|�ytt	|��}|r$|j|�sy|j
d|�|s|r||jvr tt|j|��y|j|�sd|j|<y|jd|�d|j|<d}|j|||z�}|�yt|tjj�r-|j dk(r|jd|j"z�d|j|j$<d|j&j)d	d
�j+�vr|j-�y|j$}|j/�}t|t0�sXt|tjj�rd}n|j&j3d�xsd}|j5|d
�}|j-�t6j9|�D]K}	tj:j=|t?|	jAd���}
|jC|
��M|jE|jF�r$tI|dd�dk7r|jK||�}yyy)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�ignorer:�code�)&r��
URL_SCHEME�process_filename�listr�url_ok�debugr�r~r��info�open_url�
isinstancer;�error�	HTTPErrorr�r�r?�headers�getr,�close�readr�	get_param�decoder�r{r"r�r�rM�process_urlr.r��getattr�
process_index)r�r?�retrieve�dists�tmpl�fr0r�r�rL�links           r&r�zPackageIndex.process_urlIsQ���$�#�#�#�H��!%����#���#���!�!�#�&�����-�.�E���{�{�3�'���
�
�+�S�1���C�4�+<�+<�$<���T�X�X�u�%�&���{�{�3��%)�D���c�"���	�	�,��$�!%����#��M���M�M�#�t�c�z�*���9���a����/�/�0�Q�V�V�s�]��I�I�0�1�5�5�8�9�#'����!�%�%� �������~�r�:�@�@�B�B�
�G�G�I���u�u���v�v�x���$��$��!�V�\�\�3�3�4�#���)�)�-�-�i�8�E�I���;�;�w��1�D�	���	��]�]�4�(�E��<�<�'�'��j����Q��.H�I�D����T�"�)��>�>�$�.�.�)�g�a���.F�#�.M��%�%�c�4�0�D�/N�)r3c��tjj|�s|jd|�ytjj	|�rk|sitjj|�}tj|�D]2}|jtjj||�d��4t|�}|r2|jd|�tt|j|��yy)Nz
Not found: %sTz	Found: %s)r`rC�exists�warn�isdir�realpath�listdirr�rnrbr�r�r~r�)r��fn�nestedrC�itemr�s      r&r�zPackageIndex.process_filename~s����w�w�~�~�b�!��I�I�o�r�*��
�7�7�=�=���V��7�7�#�#�B�'�D��
�
�4�(���%�%�b�g�g�l�l�4��&>��E�)�%�R�(����J�J�{�B�'���T�X�X�u�%�&�r3c��t|�}|xr"|jd�j�dk(}|s1|jtj
j
|�d�ryd}|rt||z��|j||�y)Nr:�fileTz�
Note: Bypassing %s (disallowed host; see https://setuptools.pypa.io/en/latest/deprecated/easy_install.html#restricting-downloads-with-allow-hosts for details).
)	r�rMr,r�r;r"r<rr�)r�r?�fatal�s�is_filer�s      r&r�zPackageIndex.url_ok�s}���s�O���4�����
�(�(�*�f�4���d�k�k�&�,�,�"7�"7��"<�Q�"?�@��
W�	�
� ��s��+�+��I�I�c�3�r3c��ttjj|�}d�|D�}t	tj|j|��y)Nc3�zK�|]3}tj|�D]}|jd�r||f����5y�w)z	.egg-linkN)r`r�r-)rfrC�entrys   r&rhz.PackageIndex.scan_egg_links.<locals>.<genexpr>�s>����
������D�)���~�~�k�*��5�M�)�
��s�9;)�filterr`rCr�r��	itertools�starmap�
scan_egg_link)r��search_path�dirs�	egg_linkss    r&�scan_egg_linkszPackageIndex.scan_egg_links�sB���b�g�g�m�m�[�1��
��
�	�	
�Y�
�
�t�1�1�9�
=�>r3c
���ttjj||��5}t	tdt
tj|���}ddd�t�dk7ry|\}}ttjj||��D]C}tjj|g|���|_t|_
|j|��Ey#1swY��xYw)Nri)�openr`rCrnr�r�r~rr�rYrrSr	rIr�)r�rCr��	raw_lines�lines�egg_path�
setup_pathrOs        r&r�zPackageIndex.scan_egg_link�s���
�"�'�'�,�,�t�U�+�
,�	����c�#�)�)�Y�&?�@�A�E�-��u�:��?��$���*�&�r�w�w�|�|�D�(�'C�D�D��G�G�L�L��6��6�D�M�)�D�O��H�H�T�N�E�-�
,�s�.C$�$C-c	���d}|j|j�s|Stttj
j|t|j�djd���}t|�dk7sd|dvr|St|d�}t|d�}d|jj|j�i�|<t|�t|�fS)N)NNr5rir9r:rT)r.r�r�r~r;r"r=rYr>rr
r��
setdefaultr,r)r�r��NO_MATCH_SENTINELr@�pkg�vers      r&�_scanzPackageIndex._scan�s���&�����t�~�~�.�$�$��S����-�-�t�C����4G�4I�/J�/P�/P�QT�/U�V�W���u�:��?�c�U�1�X�o�$�$���a��!���5��8�$��?C����%�%�c�i�i�k�2�6�t�<��3���S�!1�1�1r3c��tj|�D]J}	|jtjj|t
|jd�����L|j|�\}}|syt||�D]S}t|�\}}|jd�r!|s|r|d|�d|��z
}n|j|�|j|��Utjd�|�S#t$rY��wxYw)z#Process the contents of a PyPI pager:r��.pyz#egg=rRc�.�d|jddd�zS)Nz<a href="%s#md5=%s">%s</a>r:�ri)rM)�ms r&�<lambda>z,PackageIndex.process_index.<locals>.<lambda>�s��2�Q�W�W�Q��1�5E�Er3)r�r{rr;r"r�r�rMr#r�rGr-�need_version_info�scan_url�PYPI_MD5�sub)	r�r?r�rLrr
�new_urlr0�frags	         r&r�zPackageIndex.process_index�s����]�]�4�(�E�
��
�
�6�<�<�/�/��Z����A��5O�P�Q�)��:�:�c�?���S���+�3��5�G�)�'�2�J�D�$��}�}�U�#�D���s�C�8�8�G��*�*�3�/��M�M�'�"�6��|�|�E�t�
�	
��%�
��
�s�AC3�3	C?�>C?c�(�|jd|�y)NzPPage at %s links to .py file(s) without version info; an index scan is required.)�scan_all�r�r?s  r&rzPackageIndex.need_version_info�s���
�
�
 ��	
r3c��|j|jvr&|r|j|g|���|jd�|j	|j�y)Nz6Scanning index of all packages (this may take a while))r�r�r�r�r�r�r�rrs   r&rzPackageIndex.scan_all�sG���>�>��!2�!2�2����	�	�#�%��%��I�I�N�O��
�
�d�n�n�%r3c���|j|j|jzdz�|jj	|j
�s+|j|j|jzdz�|jj	|j
�s|j|�t|jj	|j
d��D]}|j|��y)Nr5r�)	rr��unsafe_namer�r��keyrT�not_found_in_indexr�)r��requirementr?s   r&�
find_packageszPackageIndex.find_packages�s����
�
�d�n�n�{�'>�'>�>��D�E��!�!�%�%�k�o�o�6��M�M�$�.�.�;�+C�+C�C�c�I�J��!�!�%�%�k�o�o�6��#�#�K�0���*�*�.�.�{����C�D�C��M�M�#��Er3c����|j�|j|�||jD]}||vr|cS|jd||��tt
|�||�S)Nz%s does not match %s)�prescanr%r"r�r�r�obtain)r�r$�	installerrOr�s    �r&r(zPackageIndex.obtainsa����������;�'�����)�D��{�"����J�J�-�{�D�A�*��\�4�/��Y�G�Gr3c�0�|j|jd|z�|j�sg|j�t	j
|�t
|jj�dtjj|��d���y)z-
        checker is a ContentChecker
        zValidating %%s checksum for %sz validation failed for z; possible download problem?N)r�r�r�r�r`�unlinkrr�r/rCrZ)r��checkerra�tfps    r&�
check_hashzPackageIndex.check_hash
su��	���t�z�z�#C�h�#N�O����!��I�I�K��I�I�h�� ��<�<�$�$�b�g�g�&6�&6�x�&@�B��
�"r3c���|D]k}|j�0t|�r%|jd�stt	|��r|j|��Q|jj
|��my)z;Add `urls` to the list that will be prescanned for searchesN�file:)r�r�r.r�rr�append)r��urlsr?s   r&�add_find_linkszPackageIndex.add_find_linkssX���C����$�!�#���>�>�'�*����,�-��
�
�c�"����#�#�C�(�r3c�|�|jr)tt|j|j��d|_y)z7Scan urls scheduled for prescanning (e.g. --find-links)N)r�r�r~rr�s r&r'zPackageIndex.prescan's'���<�<���T�]�]�D�L�L�1�2���r3c��||jr|jd}}n|jd}}|||j�|j	�y)Nz#Couldn't retrieve index page for %rz3Couldn't find index page for %r (maybe misspelled?))r"r�r�r!r)r�r$�methr�s    r&r#zPackageIndex.not_found_in_index-sJ������ ��	�	�#H�#�D��	�	�E��D�	
�S�+�)�)�*��
�
�r3c�z�t|t�s�t|�}|rV|j|j	d�||�}t|�\}}|j
d�r|j|||�}|Stjj|�r|St|�}t|j||�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:rrSN)r�rr��
_download_urlrMrGr-�	gen_setupr`rCr�r'r��fetch_distribution)r�r$�tmpdirrA�foundr0rFs       r&r7zPackageIndex.download8s���$�$��,���%�F���*�*�6�<�<��?�D�&�I��!1�$�!7���h��=�=��'� �N�N�5�(�F�C�E���������%���,�T�2���t�.�.�t�V�<�j�$�O�Or3c�������	��jd|�i�	d}d	���	��fd�	}|r)�j��j|�||�}|s|�	|||�}|�$�j��j�||�}|�|s�j|�||�}|��j	d�xrdxsd|�y�jd|�|j|j��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 %sNc�z��|��}||jD]�}|jtk(r�s|�vr�jd|�d�|<�4||vxr|jtkxs�}|s�U�j|j�	�}||_tjj|j�s��|cSy)Nz&Skipping development or system egg: %sr:)r"rIrr�r	r7rS�download_locationr`rCr�)
�req�envrO�test�loc�
develop_okr��skipped�sourcer;s
     �����r&r�z-PackageIndex.fetch_distribution.<locals>.findxs�����{����C�G�G����?�?�l�2�:��7�*��	�	�D� ��)*���
���s�{�U����;�(F�(T�f�*����-�-��
�
�v�>�C�-0�D�*��w�w�~�~�d�&<�&<�=�#��%r3z:No local packages or working download links found for %s%sza source distribution of r�zBest match: %s)rSrq)r�r'r%r�r��cloner?)
r�r$r;�
force_scanrFrD�local_indexrOr�rEs
` ` ``   @r&r:zPackageIndex.fetch_distributionZs����4	
�	�	�$�k�2�����	$�	$�,��L�L�N����{�+���$�D���/���[�1�D��<��|�|�'�������$�D��<�
����{�+���$�D��<��I�I�L��7�7�=�2��
�
�I�I�&��-��:�:�t�'=�'=�:�>�>r3c�H�|j||||�}|�|jSy)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:rS)r�r$r;rHrFrOs      r&�fetchzPackageIndex.fetch�s-���&�&�{�F�J��O�����=�=� �r3c��tj|�}|xr6t||jd�d�D�cgc]}|jr|��c}xsg}t|�dk(�rBtjj|�}tjj|�|k7rwtjj||�}tjj|�r tjj||�stj||�|}ttjj|d�d�5}	|	j!d|dj"�d|dj�dtjj%|�d�d��ddd�|S|rt'd	|�d
|����t'd��cc}w#1swY|SxYw)Nr:zsetup.py�wz(from setuptools import setup
setup(name=rz
, version=z, py_modules=[z])
z9Can't unambiguously interpret project/version identifier zI; any dashes in the name or version should be escaped using underscores. zpCan't process plain .py files without an '#egg=name-version' suffix to enable automatic setup script generation.)rKrLrrMrUrYr`rCrZ�dirnamernr��samefile�shutil�copy2r�writerT�splitextr)
r�rarFr;rL�dr�rZ�dstr�s
          r&r9zPackageIndex.gen_setup�s����"�"�8�,���
�/�x����Q���N��N�A��9�9��N��
��	��u�:��?��w�w�'�'��1�H��w�w���x�(�F�2��g�g�l�l�6�8�4�������s�+����0@�0@��3�0O��L�L��3�/�"�H��b�g�g�l�l�6�:�6��<���
�
��a��-�-��a��(�(����(�(��2�1�5���=��O�
� �&.�u�6��
�!�G��
��K�$=��O�s�G�AG�Gi c�>�|jd|�d}	tj|�}|j|�}t	|t
jj�r(td|�d|j�d|j����|j�}d}|j}d}d|vr?|jd�}	ttt|	��}|j!|||||�t#|d	�5}
	|j%|�}|r=|j'|�|
j)|�|d
z
}|j!|||||�nn�R|j+|||
�ddd�||r|j-�SS#1swY�xYw#|r|j-�wwxYw)NzDownloading %szCan't download �: � rr6zcontent-lengthzContent-Length�wbr:)r�r�r�r�r�r;r�r�rr�r��dl_blocksize�get_all�maxr~�int�
reporthookrr�r�rRr.r�)r�r?ra�fpr,r��blocknum�bs�size�sizesr-r�s            r&�_download_tozPackageIndex._download_to�so���	�	�"�C�(�
��	�!�*�*�3�/�G����s�#�B��"�f�l�l�4�4�5�$�25�r�w�w����G����g�g�i�G��H��"�"�B��D��7�*����(8�9���3�s�E�?�+������X�x��T�B��h��%����G�G�B�K�E�����U�+��	�	�%�(� �A�
������X�x��T�J��������3�7�&������
��&�%������
��s%�C!F�7A'E;�	F�;F�F�Fc��yrqr�)r�r?rar`�blksizerbs      r&r^zPackageIndex.reporthook
s��r3c	���|jd�rt|�S	t||j�S#tt
jjf$rh}dj|jD�cgc]
}t|���ncc}wc}�}|r|j||�nt|�d|���|�Yd}~yd}~wtjj$r}|cYd}~Sd}~wtjj $rE}|r|j||j"�ntd|�d|j"���|�Yd}~yd}~wt
jj$$rD}|r|j||j&�nt|�d|j&���|�Yd}~yd}~wt
jj(t*f$r1}|r|j||�ntd|�d|���|�Yd}~yd}~wwxYw)Nr0rXzDownload error for rWz7 returned a bad status line. The server might be down, )r.�
local_open�open_with_authr�r#�http�client�
InvalidURLrnrrrr�rr;r�r��URLError�reason�
BadStatusLine�line�
HTTPException�OSError)r�r?�warning�v�argr�s      r&r�zPackageIndex.open_urls����>�>�'�"��c�?�"�	T�!�#�t�{�{�3�3���D�K�K�2�2�3�	B��(�(����7���C��H���7�8�C���	�	�'�3�'�$��S�%9�:��A�(���|�|�%�%�	��H���|�|�$�$�	���	�	�'�1�8�8�,�$�36����A����-��
�{�{�(�(�	���	�	�'�1�6�6�*�$�"%�q�v�v�/����+�����)�)�7�3�	T���	�	�'�1�%�$�C��%K�L�RS�S�&��	T�sW�4�#G7�B:�0B
�3B:�: G7�C!�G7�! G7�;E� G7�!:F � &G7�'G2�2G7c���t|�\}}|r,d|vr*|jdd�jdd�}d|vr�'nd}|jd�r|dd}tjj||�}|j
t|��std|����|d	k(s|j
d
�r|j||�S|dk(s|j
d�r|j||�S|j
d
�r|j||�S|dk(r?tjjtjj!|�d�S|j#|d�|j%||�S)Nz..�.�\�_�__downloaded__rQr+zInvalid filename �svnzsvn+�gitzgit+zhg+r�riT)rG�replacer-r`rCrnr.rr#�
_download_svn�
_download_git�_download_hgr;r��url2pathnamer"r<r��_attempt_download)r�rAr?r;r/rFras       r&r8zPackageIndex._download_url0s^��*�#�.���h���$�,��|�|�D�#�.�6�6�t�S�A���$�,�$�D��=�=��$����9�D��7�7�<�<���-���"�"�3�v�;�/��0��
�;�<�<��U�?�f�/�/��7��%�%�c�8�4�4�
�u�_�� 1� 1�&� 9��%�%�c�8�4�4�
�
�
�u�
%��$�$�S�(�3�3�
�v�
��>�>�.�.�v�|�|�/D�/D�S�/I�!�/L�M�M��K�K��T�"��)�)�#�x�8�8r3c�(�|j|d�y)NT)r�rs  r&rzPackageIndex.scan_urlQs������d�#r3c��|j||�}d|jdd�j�vr|j|||�S|S)Nr�r�r�)rdr�r,�_invalid_download_html)r�r?rar�s    r&r�zPackageIndex._attempt_downloadTsJ���#�#�C��2���W�[�[���4�:�:�<�<��.�.�s�G�X�F�F��Or3c�H�tj|�td|����)NzUnexpected HTML page found at )r`r+r)r�r?r�ras    r&r�z#PackageIndex._invalid_download_html[s!��
�	�	�(���=�c�U�C�D�Dr3c��td|����)Nz/Invalid config, SVN download is not supported: r)r�r?�	_filenames   r&r~zPackageIndex._download_svn_s���N�s�e�T�U�Ur3c�&�tjj|�\}}}}}|jdd�d}|jdd�d}d}d|vr|j	dd�\}}tjj||||df�}||fS)N�+r:r6r9r�@r�)r;r"�urlsplitr>�rsplit�
urlunsplit)r?�
pop_prefixrA�netlocrCrEr�revs        r&�_vcs_split_rev_from_urlz$PackageIndex._vcs_split_rev_from_urlbs���,2�L�L�,A�,A�#�,F�)����e�T����c�1�%�b�)���z�z�#�q�!�!�$�����$�;����C��+�I�D�#��l�l�%�%�v�v�t�U�B�&G�H���C�x�r3c��|jdd�d}|j|d��\}}|jd||�tjddd	||g�|�-|jd
|�tjdd|dd	|g�|S)
Nr9r:rT�r�zDoing git clone from %s to %sr|rG�--quietzChecking out %s�-C�checkout�r>r�r��
subprocess�
check_call�r�r?rar�s    r&rzPackageIndex._download_gitts����>�>�#�q�)�!�,���/�/���/�E���S��	�	�1�3��A����u�g�y�#�x�H�I��?��I�I�'��-��!�!�5�$��*�i�QT�"U�V��r3c
��|jdd�d}|j|d��\}}|jd||�tjddd	||g�|�/|jd
|�tjdd|dd
d|dg�|S)Nr9r:rTr�zDoing hg clone from %s to %s�hgrGr�zUpdating to %sz--cwd�upr�z-rz-qr�r�s    r&r�zPackageIndex._download_hg�s����>�>�#�q�)�!�,���/�/���/�E���S��	�	�0�#�x�@����t�W�i��h�G�H��?��I�I�&��,��!�!�4��(�D�$��c�SW�"X�Y��r3c�0�tj|g|���yrq)rr�rs   r&r�zPackageIndex.debug�s���	�	�#���r3c�0�tj|g|���yrq)rr�rs   r&r�zPackageIndex.info���������t�r3c�0�tj|g|���yrq)rr�rs   r&r�zPackageIndex.warn�r�r3)zhttps://pypi.org/simple/)�*NT)Frq)FFFN)FF)*r�r�r�r�r�r�r�r�r�rr�rr�rrr%r(r.r3r'r#r7r:rKr9rZrdr^r�r8rr�r�r~�staticmethodr�rr�r�r�r��
__classcell__�r�s@r&rr+s����E�-����-�$!�31�j'� 
 �?�� 2� 
�:
�&�
�H��
)��	� P�L����M?�^�,�\�L�"�H
� T�D9�B$��E�V�����"����r3rz!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?c�N�|jd�}tj|�S)Nr)rMr��unescape)rL�whats  r&�
decode_entityr��s���;�;�q�>�D��=�=���r3c�"�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�)�texts r&r�r��s���m�T�*�*r3c����fd�}|S)Nc������fd�}|S)Nc����tj�}tj��	�|i|��tj|�S#tj|�wxYwrq)�socket�getdefaulttimeout�setdefaulttimeout)rrrs�old_timeoutrt�timeouts   ��r&�_socket_timeoutz@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeout�sN��� �2�2�4�K��$�$�W�-�
6��T�,�V�,��(�(��5���(�(��5�s�A	�	A r�)rtr�r�s` �r&r�z'socket_timeout.<locals>._socket_timeout�s���	6��r3r�)r�r�s` r&�socket_timeoutr��s���	��r3c���tjj|�}|j�}t	j
|�}|j
�}|jdd�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�)r;r"r=�encode�base64�	b64encoder�r})�auth�auth_s�
auth_bytes�
encoded_bytes�encodeds     r&�_encode_authr��sR���\�\�
!�
!�$�
'�F�����J��$�$�Z�0�M��"�"�$�G��?�?�4��$�$r3c�"�eZdZdZd�Zd�Zd�Zy)�
Credentialz:
    A username/password pair. Use like a namedtuple.
    c� �||_||_yrq��username�password)r�r�r�s   r&r�zCredential.__init__�s�� ��
� ��
r3c#�DK�|j��|j��y�wrqr�r�s r&�__iter__zCredential.__iter__�s�����m�m���m�m��s� c��dt|�zS)Nz%(username)s:%(password)s)�varsr�s r&�__str__zCredential.__str__�s��*�T�$�Z�7�7r3N)r�r�r�r�r�r�r�r�r3r&r�r��s���!��8r3r�c�:��eZdZ�fd�Zed��Zd�Zd�Z�xZS)�
PyPIConfigc�0��tjgd�d�}t�|�
|�tj
j
tj
jd�d�}tj
j|�r|j|�yy)z%
        Load from ~/.pypirc
        )r�r��
repositoryr��~z.pypircN)
�dict�fromkeysr�r�r`rCrn�
expanduserr�r�)r��defaults�rcr�s   �r&r�zPyPIConfig.__init__�sf����=�=�!G��L��
����"�
�W�W�\�\�"�'�'�,�,�S�1�9�
=��
�7�7�>�>�"���I�I�b�M�r3c���|j�D�cgc]$}|j|d�j�r|��&}}tt	|j
|��Scc}w)Nr�)�sectionsr�r�r�r~�_get_repo_cred)r��section�sections_with_repositoriess   r&�creds_by_repositoryzPyPIConfig.creds_by_repository�sa�� �=�=�?�&
�*���x�x���.�4�4�6�
�*�	#�&
��C��+�+�-G�H�I�I��
&
s�)Ac���|j|d�j�}|t|j|d�j�|j|d�j��fS)Nr�r�r�)r�r�r�)r�r��repos   r&r�zPyPIConfig._get_repo_cred�s]���x�x���.�4�4�6���Z��H�H�W�j�)�/�/�1��H�H�W�j�)�/�/�1�
�
�	
r3c�r�|jj�D]\}}|j|�s�|cSy)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��creds    r&�find_credentialzPyPIConfig.find_credentials4��
!%� 8� 8� >� >� @��J���~�~�j�)���!Ar3)	r�r�r�r��propertyr�r�r�r�r�s@r&r�r��s(���	��J��J�
�r3r�c��tjj|�}|\}}}}}}|jd�rtj
j
d��|dvrt|�\}	}
nd}	|	sJt�j|�}|r/t|�}	|j|f}tjdg|���|	rgdt|	�z}	|
||||f}
tjj|
�}tj j#|�}|j%d|	�ntj j#|�}|j%dt&�||�}|	rftjj|j(�\}}}}}}||k(r1|
k(r,||||||f}
tjj|
�|_|S)	z4Open a urllib2 request, handling HTTP authentication�:znonnumeric port: '')rj�httpsNz*Authenticating as %s for %s (from .pypirc)zBasic �
Authorizationz
User-Agent)r;r"r<r-rjrkrl�
_splituserr�r�rr�rr�r��
urlunparser��Request�
add_header�
user_agentr?)r?r��parsedrAr�rC�paramsrErr��addressr�r�r@rr�r_�s2�h2�path2�param2�query2�frag2s                       r&riri
s����\�\�
"�
"�3�
'�F�06�-�F�F�D�&�%�����s���k�k�$�$�%:�;�;�
�"�"�"�6�*�
��g�����|�+�+�C�0����t�9�D��=�=�#�%�D��H�H�A�I�D�I���,�t�,�,�����v�u�d�:���,�,�)�)�%�0���.�.�(�(��1�����?�D�1��.�.�(�(��-�����|�Z�0�	���B��06�|�|�/D�/D�R�V�V�/L�,��B��v�v�u�
��<�B�'�M����v�v�u�<�E��\�\�,�,�U�3�B�F�
�Ir3c�@�|jd�\}}}|r||fSd|fS)zNsplituser('user[:passwd]@host[:port]')
    --> 'user[:passwd]', 'host[:port]'.r�N)�
rpartition)�host�user�delims   r&r�r�9s0������,��D�%���D�d�*�*�t�d�*�*r3c��|Srqr�)r?s r&�
fix_sf_urlr�Ds���Jr3c��tjj|�\}}}}}}tjj	|�}t
jj|�rtjj|�S|jd�r�t
jj|�r�g}tj|�D]�}	t
jj||	�}
|	dk(r't|
d�5}|j�}ddd�nkt
jj|
�r|	dz
}	|jdj!|	�����d}
|
j!|dj|��	�}d
\}}nd\}}}dd
i}t#j$�}tj&j)|||||�S#1swY��xYw)z7Read a local path, with special support for directoriesr5z
index.html�rNz<a href="{name}">{name}</a>)r/zB<html><head><title>{url}</title></head><body>{files}</body></html>r�)r?�files)���OK)r�zPath not foundz	Not foundr�z	text/html)r;r"r<r�r�r`rC�isfiler�r-r�r�rnrr�r1�format�io�StringIOr�r�)r?rArBrC�paramrErrarr��filepathr_�bodyr��status�messager��body_streams                  r&rhrhHsy��/5�|�|�/D�/D�S�/I�,�F�F�D�%����~�~�*�*�4�0�H�	�w�w�~�~�h���~�~�%�%�c�*�*�	
���s�	����
�
�h� 7������H�%�A��w�w�|�|�H�a�0�H��L� ��(�C�(�B��7�7�9�D�)�������x�(��S����L�L�6�=�=�1�=�E�F�&�X�
��;�;�3�d�i�i��.>�;�?�D�#���� B������{�+�G��+�+�d�#�K��<�<�!�!�#�v�w���M�M�#)�(�s�?G
�
G	rq)r)Zr�r��sysr`rerrPr�r�r�r��configparserr��http.clientrj�urllib.parser;�urllib.request�urllib.error�	functoolsrr �
pkg_resourcesrrrrr	r
rrr
rrrrr�	distutilsr�distutils.errorsr�fnmatchr�setuptools.wheelr� setuptools.extern.more_itertoolsrr�rK�Ir�rrLr�r>rX�__all__�_SOCKET_TIMEOUT�_tmplr�version_infor�r'rrGrrJrbrrvrzr�r�r�rrr�r�r�r�r�r��RawConfigParserr�r�r�rir�r�rhr�r3r&�<module>r s��*��
�	�	�	�
�
�
��������������� �+��"�<��r�z�z�6�7���r�z�z�3�R�T�T�:���2�:�:�J����R�Z�Z�,�b�d�d�
3�
9�
9�
�
.�
4�
4�
6�
�����F��
�\�\�
�W�^�^�S�-�-�
.�:���
�
��0�� �F�.2�k�TX��D
��b�j�j�K�R�T�T�R���
�L��L�$��2�.��Bj	�;�j	�^�R�Z�Z�<�
=�
A�
A�
��
	+��%�*8�8�"$��-�-�$�N &�~�~�5�5�+�^+�1���0��@���Nr3