Spade
Mini Shell
| Directory:~$ /proc/self/root/usr/lib/python3.6/site-packages/setuptools/__pycache__/ |
| [Home] [System Details] [Kill Me] |
3
J$�\b�@s�dZddlmZddlZddlZddlZddlZddlZddlZddl m
Z
mZmZddl
mZddlmZddlm
ZddlmZdd lmZejd
ej�jZdZdd
�ZGdd�de�ZdS)zWheels
support.�)�get_platformN)�Distribution�PathMetadata�
parse_version)�canonicalize_name)�PY3)r)�
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�x�tj|�D]�\}}}tjj||�}x6|D].}tjj||�}tjj|||�}tj||�q*WxXttt|���D]D\} }
tjj||
�}tjj|||
�}tjj |�sntj||�|| =qnWqWx0tj|dd�D]\}}}|s�t
�tj|�q�WdS)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�src�dst�n�d�r�/usr/lib/python3.6/wheel.py�unpack!s
r!c@s<eZdZdd�Zdd�Zdd�Zdd�Zd d
�Zdd�Zd
S)�WheelcCsTttjj|��}|dkr$td|��||_x$|j�j�D]\}}t|||�q8WdS)Nzinvalid
wheel name: %r) �
WHEEL_NAMErr
�basename�
ValueError�filename� groupdict�items�setattr)�selfr&�match�k�vrrr
�__init__9szWheel.__init__cCs&tj|jjd�|jjd�|jjd��S)z>List
tags (py_version, abi, platform) supported by this
wheel.�.)� itertools�product�
py_version�split�abi�platform)r*rrr �tagsAs
z
Wheel.tagscs$tj��t�fdd�|j�D�d�S)z5Is the wheel
is compatible with the current
platform?c3s|]}|�krdVqdS)TNr)�.0�t)�supported_tagsrr
� <genexpr>Jsz&Wheel.is_compatible.<locals>.<genexpr>F)rZ
get_supported�nextr6)r*r)r9r
�
is_compatibleGszWheel.is_compatiblecCs*t|j|j|jdkrdnt�d�j�dS)N�any)�project_name�versionr5z.egg)rr>r?r5r�egg_name)r*rrr
r@LszWheel.egg_namecCsJx<|j�D]0}tj|�}|jd�r
t|�jt|j��r
|Sq
Wtd��dS)Nz
.dist-infoz.unsupported wheel format. .dist-info not
found)Znamelist� posixpath�dirname�endswithr�
startswithr>r%)r*�zf�memberrBrrr �
get_dist_infoRs
zWheel.get_dist_infocstj|j�����d|j|jf}|j���d|���fdd�}|d�}|d�}t|jd��}td�|koxtd �kns�td
|��t j
|��j|�t jj
|���tj|�t|��d��dd
��ttt��j��������fdd��jD�}t jj
|d�}t j�|�t jt jj
|d�t jj
|d��tt�|d�d�} t| jd�dt jj
|d��t jj
|���t jj
�d�}
t jj|
��rt jj
|dd�}t j
|�xVt j|
�D]H}|jd��r�t jt jj
|
|��n t jt jj
|
|�t jj
||���q�Wt j|
�x0t
t jj�fdd�d#D��D]}
t!|
|��q$Wt jj���rPt j��t jj
|d�}t jj|��rt"|��}|j#�j$�}WdQRXxr|D]j}t jj
|f|j$d
���}t jj
|d!�}t jj|��r�t jj|��r�t"|d"��}|j%t&�WdQRX�q�WWdQRXdS)$z"Install
wheel as an egg
directory.z%s-%sz%s.datac sH�jtj�|���,}tr&|j�jd�n|j�}tjj�j |�SQRXdS)Nzutf-8)
�openrArr�read�decode�email�parserZParserZparsestr)�name�fp�value)� dist_inforErr
�get_metadatabsz*Wheel.install_as_egg.<locals>.get_metadataZWHEELZMETADATAz
Wheel-Versionz1.0z2.0dev0z$unsupported
wheel format version:
%s)ZmetadatacSsd|_t|�S)N)Zmarker�str)�reqrrr
�raw_reqxsz%Wheel.install_as_egg.<locals>.raw_reqc s6i|].}tt�fdd�t��j|f��D���|�qS)c3s|]}|�kr|VqdS)Nr)r7rS)�install_requiresrr
r:~sz2Wheel.install_as_egg.<locals>.<dictcomp>.<genexpr>)r�sorted�map�requires)r7Zextra)�distrUrTrr
�
<dictcomp>|sz(Wheel.install_as_egg.<locals>.<dictcomp>zEGG-INFOzPKG-INFO)rU�extras_require)Zattrs�egg_infoNzrequires.txt�scriptsz.pycc3s|]}tjj�|�VqdS)N)rr
r)r7r)� dist_datarr
r:�sz'Wheel.install_as_egg.<locals>.<genexpr>�data�headers�purelib�platlibznamespace_packages.txtr/z__init__.py�w)r_r`rarb)'�zipfileZZipFiler&r>r?rGr�getr%r�mkdirZ
extractallr
rrZ
from_locationrrrVrWrXZextras�rename�SetuptoolsDistribution�dictr Zget_command_objr�listdirrC�unlinkr�filterr!rHrIr3�write�NAMESPACE_PACKAGE_INIT)r*Zdestination_eggdirZ
dist_basenamerQZwheel_metadataZ
dist_metadataZ
wheel_versionr[r\Z
setup_distZdist_data_scriptsZegg_info_scripts�entryrZnamespace_packagesrN�modZmod_dirZmod_initr)rYr^rPrUrTrEr
�install_as_egg\sr
zWheel.install_as_eggN) �__name__�
__module__�__qualname__r.r6r<r@rGrqrrrr r"7s
r")�__doc__Zdistutils.utilrrKr0rrA�rerdZ
pkg_resourcesrrrZ!setuptools.extern.packaging.utilsrZsetuptools.extern.sixrZ
setuptoolsrhrZsetuptools.command.egg_infor �compile�VERBOSEr+r#rnr!�objectr"rrrr
�<module>s&