Your IP : 18.224.38.170


Current Path : /lib/python3.8/site-packages/setuptools/__pycache__/
Upload File :
Current File : //lib/python3.8/site-packages/setuptools/__pycache__/wheel.cpython-38.opt-1.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]\}}}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�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�nextr1r0rr4r�
is_compatibleMszWheel.is_compatiblecCs,tj|j|j|jdkrdnt�d���dS)N�any)�project_name�versionr/z.egg)�
pkg_resources�Distributionr9r:r/r�egg_namer0rrrr=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�
startswithr9r!)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_eggdirrBrrr�install_as_eggbszWheel.install_as_eggcCs\d|j|jf}|�|�}d|}tj�|d�}|�||||�|�||�|�||�dS)Nz%s-%sz%s.data�EGG-INFO)	r9r:rDr	rr
�_convert_metadata�_move_data_entries�_fix_namespace_packages)r&rGrBZ
dist_basename�	dist_info�	dist_data�egg_inforrrrFgs
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)rMrBrr�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|VqdSrYr)r2r[)�install_requiresrrr5�s�z5Wheel._convert_metadata.<locals>.<dictcomp>.<genexpr>)�sorted�map�requires)r2Zextra)�distr]r\rr�
<dictcomp>�s
��z+Wheel._convert_metadata.<locals>.<dictcomp>ZMETADATAzPKG-INFO)r]�extras_require)ZattrsrOzrequires.txt)r�getr!r	�mkdirZ
extractallrr
r;r<Z
from_locationZPathMetadatarr^r_r`Zextras�rename�
setuptools�dictrZget_command_obj)
rBrGrMrOrXZwheel_metadataZ
wheel_versionZwheel_v1rcZ
setup_distr)rarMr]r\rBrrJqsL��


������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.ZscriptsrIz.pycc3s|]}tj��|�VqdSrY)r	rr
)r2r�rNrrr5�s�z+Wheel._move_data_entries.<locals>.<genexpr>)�dataZheadersZpurelibZplatlibN)r	rr
rre�listdirr@�unlinkrfr�filterr)rGrNZdist_data_scriptsZegg_info_scripts�entryrrrirrK�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
rrPrQr.�write�NAMESPACE_PACKAGE_INIT)rOrGZnamespace_packagesrV�modZmod_dirZmod_initrrrrL�s�
zWheel._fix_namespace_packagesN)�__name__�
__module__�__qualname__r*r1r7r=rDrHrF�staticmethodrJrKrLrrrrr;s


9
r)�__doc__Zdistutils.utilrrSr,r	r>�rerEr;rgrZ!setuptools.extern.packaging.utilsrZsetuptools.extern.sixrrZsetuptools.command.egg_infor�typeZ
__metaclass__�compile�VERBOSEr'rrqrrrrrr�<module>s,�

?>