Your IP : 3.149.240.101


Current Path : /opt/alt/python37/lib/python3.7/site-packages/distlib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/distlib/__pycache__/wheel.cpython-37.pyc

B

:��a���@s�ddlmZddlZddlZddlZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlmZmZddlmZmZmZmZmZddlmZddlmZmZm Z m!Z!dd	l"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,dd
l-m.Z.m/Z/e
�0e1�Z2da3e4ed��r8dZ5n*ej6�7d
��rLdZ5nej6dk�r^dZ5ndZ5e�8d�Z9e9�s�dej:dd�Z9de9Z;e5e9Z<e,��=dd��=dd�Z>e�8d�Z?e?�r�e?�7d��r�e?�=dd��@d�dZ?ndd�ZAeA�Z?[Ae
�Bde
jCe
jDB�ZEe
�Bde
jCe
jDB�ZFe
�Bd�ZGe
�Bd �ZHd!ZId"ZJejKd#k�rHd$d%�ZLnd&d%�ZLGd'd(�d(eM�ZNeN�ZOGd)d*�d*eM�ZPd+d,�ZQd-d.�ZReR�ZS[Rd1d/d0�ZTdS)2�)�unicode_literalsN)�message_from_file�)�__version__�DistlibException)�	sysconfig�ZipFile�fsdecode�	text_type�filter)�InstalledDistribution)�Metadata�METADATA_FILENAME�WHEEL_METADATA_FILENAME�LEGACY_METADATA_FILENAME)
�FileOperator�convert_path�	CSVReader�	CSVWriter�Cache�cached_property�get_cache_base�read_exports�tempdir�get_platform)�NormalizedVersion�UnsupportedVersionErrorZpypy_version_info�pp�javaZjyZcliZip�cp�py_version_nodotz%s%s��py�-�_�.�SOABIzcpython-cCsRdtg}t�d�r|�d�t�d�r0|�d�t�d�dkrH|�d�d	�|�S)
Nr�Py_DEBUG�d�
WITH_PYMALLOC�mZPy_UNICODE_SIZE��u�)�
VER_SUFFIXr�get_config_var�append�join)�parts�r3�>/opt/alt/python37/lib/python3.7/site-packages/distlib/wheel.py�_derive_abi<s




r5zz
(?P<nm>[^-]+)
-(?P<vn>\d+[^-]*)
(-(?P<bn>\d+[^-]*))?
-(?P<py>\w+\d+(\.\w+\d+)*)
-(?P<bi>\w+)
-(?P<ar>\w+(\.\w+)*)
\.whl$
z7
(?P<nm>[^-]+)
-(?P<vn>\d+[^-]*)
(-(?P<bn>\d+[^-]*))?$
s
\s*#![^\r\n]*s^(\s*#!("[^"]+"|\S+))\s+(.*)$s#!pythons	#!pythonw�/cCs|S)Nr3)�or3r3r4�<lambda>^�r8cCs|�tjd�S)Nr6)�replace�os�sep)r7r3r3r4r8`r9c@s6eZdZdd�Zdd�Zdd�Zddd	�Zd
d�ZdS)
�MountercCsi|_i|_dS)N)�
impure_wheels�libs)�selfr3r3r4�__init__dszMounter.__init__cCs||j|<|j�|�dS)N)r>r?�update)r@�pathname�
extensionsr3r3r4�addhs
zMounter.addcCs4|j�|�}x"|D]\}}||jkr|j|=qWdS)N)r>�popr?)r@rCrD�k�vr3r3r4�removels
zMounter.removeNcCs||jkr|}nd}|S)N)r?)r@�fullname�path�resultr3r3r4�find_modulers
zMounter.find_modulecCsj|tjkrtj|}nP||jkr,td|��t�||j|�}||_|�dd�}t|�dkrf|d|_	|S)Nzunable to find extension for %sr%rr)
�sys�modulesr?�ImportError�impZload_dynamic�
__loader__�rsplit�len�__package__)r@rJrLr2r3r3r4�load_moduleys


zMounter.load_module)N)�__name__�
__module__�__qualname__rArErIrMrVr3r3r3r4r=cs

r=c@s�eZdZdZdZdZd4dd�Zedd	��Zed
d��Z	edd
��Z
edd��Zdd�Z
edd��Zdd�Zd5dd�Zdd�Zdd�Zdd�Zd6dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd7d,d-�Zd.d/�Zd0d1�Zd8d2d3�ZdS)9�Wheelz@
    Class to build and install from Wheel files (PEP 427).
    )rrZsha256NFcCs8||_||_d|_tg|_dg|_dg|_t��|_	|dkrRd|_
d|_|j|_
n�t�|�}|r�|�d�}|d|_
|d�d	d
�|_|d|_|j|_
n�tj�|�\}}t�|�}|s�td|��|r�tj�|�|_	||_
|�d�}|d|_
|d|_|d|_|d
�d�|_|d�d�|_|d�d�|_dS)zB
        Initialise an instance using a (valid) filename.
        r-�none�anyNZdummyz0.1�nmZvnr$r#ZbnzInvalid name or filename: %rr"r%Zbi�ar)�signZ
should_verify�buildver�PYVER�pyver�abi�archr;�getcwd�dirname�name�version�filenameZ	_filename�NAME_VERSION_RE�match�	groupdictr:rK�split�FILENAME_REr�abspath)r@rir_�verifyr*�inforfr3r3r4rA�sB











zWheel.__init__cCs^|jrd|j}nd}d�|j�}d�|j�}d�|j�}|j�dd�}d|j|||||fS)zJ
        Build and return a filename from the various components.
        r#r-r%r$z%s-%s%s-%s-%s-%s.whl)r`r1rbrcrdrhr:rg)r@r`rbrcrdrhr3r3r4ri�s
zWheel.filenamecCstj�|j|j�}tj�|�S)N)r;rKr1rfri�isfile)r@rKr3r3r4�exists�szWheel.existsccs@x:|jD]0}x*|jD] }x|jD]}|||fVq WqWqWdS)N)rbrcrd)r@rbrcrdr3r3r4�tags�sz
Wheel.tagscCs�tj�|j|j�}d|j|jf}d|}t�d�}t	|d���}|�
|�}|d�dd�}tdd	�|D��}t
tg}	d}
x`|	D]X}y>t�||�}|�|��}
||
�}t|d
�}
|
r�PWdQRXWq~tk
r�Yq~Xq~W|
s�tdd�|	���WdQRX|
S)
Nz%s-%sz%s.dist-infozutf-8�rz
Wheel-Versionr%rcSsg|]}t|��qSr3)�int)�.0�ir3r3r4�
<listcomp>�sz"Wheel.metadata.<locals>.<listcomp>)�fileobjz8Invalid wheel, because metadata is missing: looked in %sz, )r;rKr1rfrirgrh�codecs�	getreaderr�get_wheel_metadatarm�tuplerr�	posixpath�openr
�KeyError�
ValueError)r@rC�name_ver�info_dir�wrapper�zf�wheel_metadata�wv�file_versionZfnsrL�fn�metadata_filename�bf�wfr3r3r4�metadata�s0




zWheel.metadatac	CsXd|j|jf}d|}t�|d�}|�|��}t�d�|�}t|�}WdQRXt|�S)Nz%s-%sz%s.dist-info�WHEELzutf-8)	rgrhrr1r�r{r|r�dict)r@r�r�r�r�r�r��messager3r3r4r}�szWheel.get_wheel_metadatac	Cs6tj�|j|j�}t|d��}|�|�}WdQRX|S)Nru)r;rKr1rfrirr})r@rCr�rLr3r3r4rqsz
Wheel.infocCs�t�|�}|r||��}|d|�||d�}}d|��krBt}nt}t�|�}|rfd|��d}nd}||}||}nT|�d�}|�d�}	|dks�||	kr�d}
n|||d�d	kr�d	}
nd}
t|
|}|S)
Nspythonw� ���r9�
�
rr!s
)	�
SHEBANG_RErk�end�lower�SHEBANG_PYTHONW�SHEBANG_PYTHON�SHEBANG_DETAIL_RE�groups�find)r@�datar*r�ZshebangZdata_after_shebangZshebang_python�argsZcrZlfZtermr3r3r4�process_shebangs,




zWheel.process_shebangcCsh|dkr|j}ytt|�}Wn tk
r<td|��YnX||���}t�|��d��	d�}||fS)NzUnsupported hash algorithm: %r�=�ascii)
�	hash_kind�getattr�hashlib�AttributeErrorr�digest�base64Zurlsafe_b64encode�rstrip�decode)r@r�r��hasherrLr3r3r4�get_hash%szWheel.get_hashc	CsZt|�}ttj�||��}|�|ddf�t|��}x|D]}|�|�q:WWdQRXdS)Nr-)�list�to_posixr;rK�relpathr0rZwriterow)r@�recordsZrecord_path�base�p�writer�rowr3r3r4�write_record0s

zWheel.write_recordc
Cs�g}|\}}tt|j�}xX|D]P\}}	t|	d��}
|
��}WdQRXd|�|�}tj�|	�}
|�	|||
f�qWtj�
|d�}	|�||	|�ttj�
|d��}|�	||	f�dS)N�rbz%s=%s�RECORD)
r�r�r�r��readr�r;rK�getsizer0r1r�r�)r@rq�libdir�
archive_pathsr��distinfor�r��apr��fr�r��sizer3r3r4�
write_records8szWheel.write_recordsc	CsJt|dtj��2}x*|D]"\}}t�d||�|�||�qWWdQRXdS)N�wzWrote %s to %s in wheel)r�zipfile�ZIP_DEFLATED�logger�debug�write)r@rCr�r�r�r�r3r3r4�	build_zipHszWheel.build_zipc"s�|dkri}tt�fdd�d��d}|dkrFd}tg}tg}tg}nd}tg}d	g}d
g}|�d|�|_|�d|�|_|�d
|�|_	�|}	d|j
|jf}
d|
}d|
}g}
x�dD]�}|�kr�q��|}tj
�|�r�x�t�|�D]�\}}}x�|D]�}ttj
�||��}tj
�||�}ttj
�|||��}|
�||f�|dkr�|�d�s�t|d��}|��}WdQRX|�|�}t|d��}|�|�WdQRXq�Wq�Wq�W|	}d}x�t�|�D]�\}}}||k�rx@t|�D]4\}}t|�}|�d��r�tj
�||�}||=P�q�W|�std��xP|D]H}t|��d��r8�q tj
�||�}ttj
�||��}|
�||f��q W�q�Wt�|�}xJ|D]B}|dk�r�ttj
�||��}ttj
�||��}|
�||f��q�Wd|�p�|jdtd|g}x*|jD] \}}}|�d|||f��q�Wtj
�|d�}t|d��}|�d �|��WdQRXttj
�|d��}|
�||f�d!d"�} t |
| d#�}
|�!||f|	|
�tj
�|j"|j#�}!|�$|!|
�|!S)$z�
        Build a wheel from files in specified paths, and use any specified tags
        when determining the name of the wheel.
        Ncs|�kS)Nr3)r7)�pathsr3r4r8Vr9zWheel.build.<locals>.<lambda>)�purelib�platlibrr��false�truer[r\rbrcrdz%s-%sz%s.dataz%s.dist-info)r��headers�scriptsr�z.exer��wbz
.dist-infoz(.dist-info directory expected, not found)z.pycz.pyo)r�Z	INSTALLERZSHAREDr�zWheel-Version: %d.%dzGenerator: distlib %szRoot-Is-Purelib: %sz
Tag: %s-%s-%sr�r��
cSs*|d}|�d�}d|kr"|d7}||fS)Nrr6z
.dist-infoi')�count)�tr��nr3r3r4�sorter�s

zWheel.build.<locals>.sorter)�key)%r�r�IMPVER�ABI�ARCHra�getrbrcrdrgrhr;rK�isdir�walkr	r1r�r�r0�endswithr�r�r�r��	enumerate�AssertionError�listdir�
wheel_versionrrt�sortedr�rfrir�)"r@r�rtr�Zlibkey�is_pureZ
default_pyverZdefault_abiZdefault_archr�r��data_dirr�r�r�rK�root�dirs�filesr�r��rpr�r�r�r�rx�dnr�rbrcrdr�rCr3)r�r4�buildNs�


 





zWheel.buildcCs
|�d�S)zl
        Determine whether an archive entry should be skipped when verifying
        or installing.
        )r6z/RECORD.jws)r�)r@�arcnamer3r3r4�
skip_entry�szWheel.skip_entrycCKs�|j}|�d�}|�dd�}|�dd�}tj�|j|j�}d|j|jf}	d|	}
d|	}t	�|t
�}t	�|d�}
t	�|d	�}t�d
�}t
|d����}|�|
��}||�}t|�}WdQRX|d
�dd�}tdd�|D��}||jkr�|r�||j|�|ddk�r|d}n|d}i}|�|��<}t|d��&}x|D]}|d}|||<�q:WWdQRXWdQRXt	�|
d�}t	�|d�}t	�|
dd�}t|d�}d|_tj} g}!t��}"|"|_d|_�z��y��x�|��D�]�}#|#j}$t|$t��r�|$}%n
|$�d
�}%|� |%��r
�q�||%}|d�r<t!|#j"�|dk�r<t#d|%��|d�r�|d�dd�\}&}'|�|$��}|�$�}(WdQRX|�%|(|&�\})}*|*|'k�r�t#d|$��|�r�|%�&||f��r�t'�(d |%��q�|%�&|��o�|%�)d!�}+|%�&|��r|%�d"d�\})},}-tj�||,t*|-��}.n$|%|
|fk�r$�q�tj�|t*|%��}.|+�s4|�|$��}|�+||.�WdQRXtjd#k�r�t�,|.|#j-d$?d%@�|!�.|.�|�s�|d�r�t|.d&��4}|�$�}(|�%|(|&�\})}/|/|*k�r�t#d'|.��WdQRX| �r�|.�)d(��r�y|j/|.|d)�}0|!�.|0�Wn$t0k
�r0t'j1d*dd+�YnXnttj�2t*|$��}1tj�|"|1�}2|�|$��}|�+||2�WdQRXtj�|.�\}3}1|3|_|�3|1�}4|�4|4�|!�5|4��q�W|�r�t'�(d,�d}5�n�d}6|j6d
}|d-k�r�t	�|d.�}7y�|�|7��}t7|�}8WdQRXi}6x~d/D]v}9d0|9}:|:|8k�ri|6d1|9<};xL|8|:�8�D]<}<d2|<j9|<j:f}=|<j;�rx|=d3d4�|<j;�7}=|=|;|<j<�qHW�qWWn t0k
�r�t'�1d5�YnXndyB|�|��.}||�}t<�=|��d6�}6|6�r�|6�d7�}6WdQRXWn t0k
�rt'�1d8�YnX|6�r�|6�d9i�}>|6�d:i�}?|>�sB|?�r�|�dd�}@tj�>|@��sdt?d;��|@|_x6|>�@�D]*\}:}<d<|:|<f}A|�3|A�}4|�4|4��qtW|?�r�d=di}Bx8|?�@�D],\}:}<d<|:|<f}A|�3|A|B�}4|�4|4��q�Wtj�||�}tA|�}5tB|�}|d=|d=||d><|5�C||�}|�r8|!�.|�|5�D|!|d?|�|5St0k
�rvt'�Ed@�|�F��YnXWdtG�H|"�XWdQRXdS)Aa~
        Install a wheel to the specified paths. If kwarg ``warner`` is
        specified, it should be a callable, which will be called with two
        tuples indicating the wheel version of this software and the wheel
        version in the file, if there is a discrepancy in the versions.
        This can be used to issue any warnings to raise any exceptions.
        If kwarg ``lib_only`` is True, only the purelib/platlib files are
        installed, and the headers, scripts, data and dist-info metadata are
        not written. If kwarg ``bytecode_hashed_invalidation`` is True, written
        bytecode will try to use file-hash based invalidation (PEP-552) on
        supported interpreter versions (CPython 2.7+).

        The return value is a :class:`InstalledDistribution` instance unless
        ``options.lib_only`` is True, in which case the return value is ``None``.
        �warner�lib_onlyFZbytecode_hashed_invalidationz%s-%sz%s.dataz%s.dist-infor�r�zutf-8ruNz
Wheel-Versionr%rcSsg|]}t|��qSr3)rv)rwrxr3r3r4ry�sz!Wheel.install.<locals>.<listcomp>zRoot-Is-Purelibr�r�r�)�streamrr-r�)�dry_runTr!zsize mismatch for %s�=zdigest mismatch for %szlib_only: skipping %sz.exer6�posix�i�r�zdigest mismatch on write for %sz.py)Zhashed_invalidationzByte-compilation failed)�exc_infozlib_only: returning Nonez1.0zentry_points.txt)Zconsole�guiz
%s_scriptszwrap_%sz%s:%sz [%s]�,zAUnable to read legacy script metadata, so cannot generate scriptsrDzpython.commandsz8Unable to read JSON metadata, so cannot generate scriptsZwrap_consoleZwrap_guizValid script path not specifiedz%s = %sr��lib�prefixzinstallation failed.)Ir�r�r;rKr1rfrirgrhrrr{r|rr�rrmr~r�rr�recordrN�dont_write_bytecode�tempfileZmkdtempZ
source_dirZ
target_dir�infolist�
isinstancer
r�r��str�	file_sizerr�r��
startswithr�r�r�rZcopy_stream�chmod�
external_attrr0�byte_compile�	Exception�warning�basenameZmakeZset_executable_mode�extendrqr�valuesr��suffix�flags�json�loadr�r��itemsrr�Zwrite_shared_locationsZwrite_installed_files�	exceptionZrollback�shutil�rmtree)Cr@r�Zmaker�kwargsr�r�r�Zbc_hashed_invalidationrCr�r�r��
metadata_name�wheel_metadata_name�record_namer�r��bwfr�r�r�r�r�r�r��readerr�r�Zdata_pfxZinfo_pfxZ
script_pfxZfileopZbc�outfiles�workdir�zinfor��	u_arcname�kind�valuer�r$r�Z	is_script�wherer��outfileZ	newdigestZpycr�Zworknamer��	filenames�dist�commandsZepZepdatar�rGr(rH�sZconsole_scriptsZgui_scriptsZ
script_dir�script�optionsr3r3r4�install�sJ



"















z
Wheel.installcCs8tdkr4tj�t�td�dtjdd��}t|�atS)Nzdylib-cachez%s.%sr!)	�cacher;rKr1rr�rN�version_infor)r@r�r3r3r4�_get_dylib_cache�s
zWheel._get_dylib_cachec
Csltj�|j|j�}d|j|jf}d|}t�|d�}t�	d�}g}t
|d���}y�|�|���}||�}	t�
|	�}
|��}|�|�}tj�|j|�}
tj�|
�s�t�|
�x�|
��D]�\}}tj�|
t|��}tj�|�s�d}n6t�|�j}tj�|�}|�|�}tj|j�}||k}|�r(|�||
�|�||f�q�WWdQRXWntk
�r\YnXWdQRX|S)Nz%s-%sz%s.dist-infoZ
EXTENSIONSzutf-8ruT)r;rKr1rfrirgrhrr{r|rr�r
rr'Z
prefix_to_dirr�r��makedirsrrrs�stat�st_mtime�datetimeZ
fromtimestamp�getinfo�	date_time�extractr0r�)r@rCr�r�r�r�rLr�r�r�rDr%r�Z
cache_basergr��destr.Z	file_timerqZ
wheel_timer3r3r4�_get_extensions�s>




 zWheel._get_extensionscCst|�S)zM
        Determine if a wheel is compatible with the running system.
        )�
is_compatible)r@r3r3r4r1�szWheel.is_compatiblecCsdS)zP
        Determine if a wheel is asserted as mountable by its metadata.
        Tr3)r@r3r3r4�is_mountable�szWheel.is_mountablecCs�tj�tj�|j|j��}|��s2d|}t|��|��sJd|}t|��|t	jkrbt
�d|�nN|rtt	j�|�nt	j�
d|�|��}|r�tt	jkr�t	j�t�t�||�dS)Nz)Wheel %s not compatible with this Python.z$Wheel %s is marked as not mountable.z%s already in pathr)r;rKror1rfrir1rr2rNr�r�r0�insertr0�_hook�	meta_pathrE)r@r0rC�msgrDr3r3r4�mount�s"

zWheel.mountcCsrtj�tj�|j|j��}|tjkr2t�d|�n<tj�	|�|t
jkrRt
�	|�t
jsnt
tjkrntj�	t
�dS)Nz%s not in path)
r;rKror1rfrirNr�r�rIr4r>r5)r@rCr3r3r4�unmounts



z
Wheel.unmountcCstj�|j|j�}d|j|jf}d|}d|}t�|t�}t�|d�}t�|d�}t	�
d�}t|d����}	|	�|��}
||
�}t
|�}WdQRX|d�d	d
�}
tdd�|
D��}i}|	�|��:}t|d
��$}x|D]}|d}|||<q�WWdQRXWdQRXx�|	��D]�}|j}t|t��r*|}n
|�d�}|�d�}d|k�rTtd|��|�|��rd�q||}|d�r�t|j�|dk�r�td|��|d
�r|d
�dd
�\}}|	�|��}|��}WdQRX|�||�\}}||k�rtd|���qWWdQRXdS)Nz%s-%sz%s.dataz%s.dist-infor�r�zutf-8ruz
Wheel-Versionr%rcSsg|]}t|��qSr3)rv)rwrxr3r3r4ry(sz Wheel.verify.<locals>.<listcomp>)r�rr6z..zinvalid entry in wheel: %rr!zsize mismatch for %sr�zdigest mismatch for %s)r;rKr1rfrirgrhrrr{r|rr�rrmr~rr�r�r
r�rr�r�r�r�r�)r@rCr�r�r�rrrr�r�rr�r�r�r�r�r�rr�r�rr�rrrr�r$r�r3r3r4rpsV

 




zWheel.verifyc
Ks�dd�}dd�}tj�|j|j�}d|j|jf}d|}t�|d�}	t����}
t	|d���}i}xt|�
�D]h}
|
j}t|t�r�|}n
|�
d	�}||	kr�qjd
|kr�td|��|�|
|
�tj�|
t|��}|||<qjWWdQRX|||�\}}||f|�}|�r�|||�\}}|�r(||k�r(|||�|dk�rRtjd
d|
d�\}}t�|�n*tj�|��sltd|��tj�||j�}t|���}tj�|
|�}||f}|�||
|�|�||�|dk�r�t�||�WdQRX|S)a�
        Update the contents of a wheel in a generic way. The modifier should
        be a callable which expects a dictionary argument: its keys are
        archive-entry paths, and its values are absolute filesystem paths
        where the contents the corresponding archive entries can be found. The
        modifier is free to change the contents of the files pointed to, add
        new entries and remove entries, before returning. This method will
        extract the entire contents of the wheel to a temporary location, call
        the modifier, and then use the passed (and possibly updated)
        dictionary to write a new wheel. If ``dest_dir`` is specified, the new
        wheel is written there -- otherwise, the original wheel is overwritten.

        The modifier should return True if it updated the wheel, else False.
        This method returns the same value the modifier returns.
        cSsHd}}d|tf}||kr$d|}||kr@||}t|d�j}||fS)Nz%s/%sz%s/PKG-INFO)rK)rr
rh)�path_mapr�rhrKr�r3r3r4�get_version`sz!Wheel.update.<locals>.get_versioncSs�d}y|t|�}|�d�}|dkr*d|}nTdd�||dd��d�D�}|dd7<d	|d|�d�d
d�|D��f}Wn tk
r�t�d|�YnX|r�t|d
�}||_|�	t
�}|j||d�t�d||�dS)Nr#rz%s+1cSsg|]}t|��qSr3)rv)rwr!r3r3r4ryrsz8Wheel.update.<locals>.update_version.<locals>.<listcomp>rr%r�z%s+%scss|]}t|�VqdS)N)r�)rwrxr3r3r4�	<genexpr>usz7Wheel.update.<locals>.update_version.<locals>.<genexpr>z0Cannot update non-compliant (PEP-440) version %r)rK)rK�legacyzVersion updated from %r to %r)rr�rmr1rr�r�r
rhr�rr�)rhrK�updatedrHrxr2Zmdr<r3r3r4�update_versionjs(

 

z$Wheel.update.<locals>.update_versionz%s-%sz%s.dist-infor�ruzutf-8z..zinvalid entry in wheel: %rNz.whlz
wheel-update-)rr��dirzNot a directory: %r)r;rKr1rfrirgrhrrrr�r�r
r�rr.rr��mkstemp�closer�r�rr�r�r�copyfile)r@�modifierZdest_dirrr:r>rCr�r�rrr�r9rr�rrKZoriginal_versionr$�modifiedZcurrent_version�fd�newpathr�r�rqr3r3r4rBOsX






zWheel.update)NFF)N)NN)F)N)rWrXrY�__doc__r�r�rA�propertyrirsrtrr�r}rqr�r�r�r�r�r�r�r$r'r0r1r2r7r8rprBr3r3r3r4rZ�s6
) 	

tn	"
8rZcCs^ddl}|��}g}|ddkrZx0|d�d�D]}|�|��rHt|�nd�q0Wt|�}|S)NrZglibcrr%)�platformZlibc_verrmr0�isdigitrvr~)rI�verrLr!r3r3r4�_get_glibc_version�srLc
Cs�tg}td}x6ttjdddd�D]}|�d�|t|�g��q&Wg}x6t��D]*\}}}|�	d�rT|�|�
dd�d�qTW|��tdkr�|�
dt�|�d�g}tg}tjd	k�r�t�d
t�}|�r�|��\}	}}}
t|�}|
g}|
dk�r|�d�|
d
k�r|�d�|
dk�r*|�d�|
dk�r>|�d�|
dk�rR|�d�xL|dk�r�x2|D]*}d|	|||f}
|
tk�rd|�|
��qdW|d8}�qTW�x.|D�]$}�x|D�]}
|�d�t|df�||
f�|dk�r�tj�	d��r�|
�dd�}
t�}t|�dk�r�|dk�r>|�d�t|df�|d|
f�|dk�rj|�d�t|df�|d|
f�|dk�r�|�d�t|df�|d|
f�|�d�t|df�|d|d|d|
ff��q�W�q�WxXt|�D]L\}}|�d�t|f�ddf�|dk�r�|�d�t|df�ddf��q�WxXt|�D]L\}}|�d�d |f�ddf�|dk�r6|�d�d |df�ddf��q6Wt|�S)!zG
    Return (pyver, abi, arch) tuples compatible with this Python.
    rrr�r-z.abir%r!r[�darwinz(\w+)_(\d+)_(\d+)_(\w+)$)�i386�ppcZfat)rNrO�x86_64Zfat3)�ppc64rPZfat64)rNrP�intel)rNrPrRrOrQ�	universalz%s_%s_%s_%s�linuxZlinux_)r!�z
manylinux1_%s)r!�zmanylinux2010_%s)r!�zmanylinux2014_%szmanylinux_%s_%s_%sr\r")r.�rangerNr&r0r1r�rQZget_suffixesr�rm�sortr�r3r�rI�rerkr�rv�
IMP_PREFIXr:rLrTr��set)Zversions�major�minorZabisrr$rLZarchesr*rgrdZmatchesrkr!rcr2rxrhr3r3r4�compatible_tags�s�

















$
$r_cCs^t|t�st|�}d}|dkr"t}x6|D].\}}}||jkr(||jkr(||jkr(d}Pq(W|S)NFT)r�rZ�COMPATIBLE_TAGSrbrcrd)ZwheelrtrLrKrcrdr3r3r4r1s
r1)N)UZ
__future__rr�r{r+�emailrr�rQr
�loggingr;rrZrrNr�r�r-rr�compatrrr	r
rZdatabaserr�r
rrr�utilrrrrrrrrrrrhrr�	getLoggerrWr�r%�hasattrr[rIr�r/r.r&rar�r:r�r�rmr5�compile�
IGNORECASE�VERBOSErnrjr�r�r�r�r<r��objectr=r4rZrLr_r`r1r3r3r3r4�<module>s�0


	


#1
P

?>