Your IP : 18.118.208.127


Current Path : /lib/python3.8/site-packages/setuptools/__pycache__/
Upload File :
Current File : //lib/python3.8/site-packages/setuptools/__pycache__/wheel.cpython-38.pyc

U

�Qab��@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddl	mZddlm
Z
ddlmZddl
mZddlmZeZe�d	ej�jZd
Zdd�ZGd
d�d�ZdS)zWheels support.�)�get_platformN)�
parse_version)�canonicalize_name)�PY3)�
pep425tags)�write_requirementsz�^(?P<project_name>.+?)-(?P<version>\d.*?)
    ((-(?P<build>\d.*?))?-(?P<py_version>.+?)-(?P<abi>.+?)-(?P<platform>.+?)
    )\.whl$z�try:
    __import__('pkg_resources').declare_namespace(__name__)
except ImportError:
    __path__ = __import__('pkgutil').extend_path(__path__, __name__)
cCs�t�|�D]�\}}}tj�||�}|D].}tj�||�}tj�|||�}t�||�q&ttt|���D]D\}	}
tj�||
�}tj�|||
�}tj�	|�sft�||�||	=qfq
tj|dd�D]\}}}|r�t
�t�|�q�dS)zDMove everything under `src_dir` to `dst_dir`, and delete the former.T)�topdownN)�os�walk�path�relpath�join�renames�reversed�list�	enumerate�exists�AssertionError�rmdir)Zsrc_dirZdst_dir�dirpathZdirnames�	filenames�subdir�f�srcZdst�n�d�r�4/usr/lib/python3.8/site-packages/setuptools/wheel.py�unpack%s
rc@sheZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	e
dd��Ze
dd��Ze
dd��Z
dS)�WheelcCsPttj�|��}|dkr$td|��||_|����D]\}}t|||�q6dS)Nzinvalid wheel name: %r)	�
WHEEL_NAMEr	r�basename�
ValueError�filename�	groupdict�items�setattr)�selfr#�match�k�vrrr�__init__=szWheel.__init__cCs&t�|j�d�|j�d�|j�d��S)z>List tags (py_version, abi, platform) supported by this wheel.�.)�	itertools�productZ
py_version�splitZabi�platform�r'rrr�tagsEs



�z
Wheel.tagscs$t���t�fdd�|��D�d�S)z5Is the wheel is compatible with the current platform?c3s|]}|�krdVqdS)TNr)�.0�t�Zsupported_tagsrr�	<genexpr>Psz&Wheel.is_compatible.<locals>.<genexpr>F)rZ
get_supported�nextr2r1rr5r�
is_compatibleMszWheel.is_compatiblecCs,tj|j|j|jdkrdnt�d���dS)N�any)�project_name�versionr0z.egg)�
pkg_resources�Distributionr:r;r0r�egg_namer1rrrr>Rs��zWheel.egg_namecCsJ|��D]4}t�|�}|�d�rt|��t|j��r|Sqtd��dS)Nz
.dist-infoz.unsupported wheel format. .dist-info not found)Znamelist�	posixpath�dirname�endswithr�
startswithr:r")r'�zf�memberr@rrr�
get_dist_infoXs

��
zWheel.get_dist_infoc	Cs(t�|j��}|�||�W5QRXdS)z"Install wheel as an egg directory.N)�zipfileZZipFiler#�_install_as_egg)r'�destination_eggdirrCrrr�install_as_eggbszWheel.install_as_eggcCs\d|j|jf}|�|�}d|}tj�|d�}|�||||�|�||�|�||�dS)Nz%s-%sz%s.data�EGG-INFO)	r:r;rEr	rr
�_convert_metadata�_move_data_entries�_fix_namespace_packages)r'rHrCZ
dist_basename�	dist_info�	dist_data�egg_inforrrrGgs
zWheel._install_as_eggc
s&��fdd�}|d�}t|�d��}td�|ko>td�kn}|sTtd|��t�|���|�tj�|���tj	j
|�t�|��d��d	d
��tt
t�����������fdd��jD�}t��|�t�tj�|d
�tj�|d��tj	t�|d�d�}	t|	�d�dtj�|d��dS)Nc
sT��t��|���8}tr&|���d�n|��}tj���	|�W5QR�SQRXdS)Nzutf-8)
�openr?r
r�read�decode�email�parserZParserZparsestr)�name�fp�value)rNrCrr�get_metadatassz-Wheel._convert_metadata.<locals>.get_metadataZWHEELz
Wheel-Versionz1.0z2.0dev0z$unsupported wheel format version: %s)ZmetadatacSsd|_t|�S�N)Zmarker�str)�reqrrr�raw_req�sz(Wheel._convert_metadata.<locals>.raw_reqc
s2i|]*}|t�fdd�t���|f��D���qS)c3s|]}|�kr|VqdSrZr)r3r\)�install_requiresrrr6�s�z5Wheel._convert_metadata.<locals>.<dictcomp>.<genexpr>)�sorted�map�requires)r3Zextra)�distr^r]rr�
<dictcomp>�s
��z+Wheel._convert_metadata.<locals>.<dictcomp>ZMETADATAzPKG-INFO)r^�extras_require)ZattrsrPzrequires.txt)r�getr"r	�mkdirZ
extractallrr
r<r=Z
from_locationZPathMetadatarr_r`raZextras�rename�
setuptools�dictrZget_command_obj)
rCrHrNrPrYZwheel_metadataZ
wheel_versionZwheel_v1rdZ
setup_distr)rbrNr^r]rCrrKqsL��


������zWheel._convert_metadatacs�tj�|���tj��d�}tj�|�r�tj�|dd�}t�|�t�|�D]D}|�d�rpt�tj�||��qLt�tj�||�tj�||��qLt�	|�t
tjj�fdd�dD��D]}t||�q�tj���r�t�	��dS)z,Move data entries to their correct location.ZscriptsrJz.pycc3s|]}tj��|�VqdSrZ)r	rr
)r3r�rOrrr6�s�z+Wheel._move_data_entries.<locals>.<genexpr>)�dataZheadersZpurelibZplatlibN)r	rr
rrf�listdirrA�unlinkrgr�filterr)rHrOZdist_data_scriptsZegg_info_scripts�entryrrrjrrL�s.�

�
�zWheel._move_data_entriesc
Cs�tj�|d�}tj�|�r�t|��}|����}W5QRX|D]b}tjj|f|�d���}tj�|d�}tj�|�r>tj�|�s>t|d��}|�t�W5QRXq>dS)Nznamespace_packages.txtr,z__init__.py�w)	r	rr
rrQrRr/�write�NAMESPACE_PACKAGE_INIT)rPrHZnamespace_packagesrW�modZmod_dirZmod_initrrrrM�s�
zWheel._fix_namespace_packagesN)�__name__�
__module__�__qualname__r+r2r8r>rErIrG�staticmethodrKrLrMrrrrr;s


9
r)�__doc__Zdistutils.utilrrTr-r	r?�rerFr<rhrZ!setuptools.extern.packaging.utilsrZsetuptools.extern.sixrrZsetuptools.command.egg_infor�typeZ
__metaclass__�compile�VERBOSEr(r rrrrrrrr�<module>s,�

?>