ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/ensurepip/rewheel/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/ensurepip/rewheel/__pycache__/__init__.cpython-36.pyc

3

%j�aL�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZdd�Zdd�Z
dd�Zdd	�Zd
d�ZdS)�NcCs�tjdd�}|jddd�|jdddd	tjjd
�|j�}d}yttft	|���Wn4t
k
r�}ztdj|��d
}WYdd}~XnXtj
d
�dS)Nz,Recreate wheel of package with given RECORD.)Zdescription�record_pathzPath to RECORD file)�helpz-oz--output-dirz>Dir where to place the wheel, defaults to current working dir.�outdir)r�dest�defaultrz
Failed: {}�)�argparse�ArgumentParser�add_argument�os�path�curdir�
parse_args�print�rewheel_from_record�vars�
BaseException�format�sys�exit)�parser�nsZretcode�e�r�?/opt/alt/python36/lib64/python3.6/ensurepip/rewheel/__init__.py�run
srcs�g}tjtjtjg�}dd�|D�}x�|D]�}d}xd|D]\�tjj�|�djtj	���fdd�tj
��D�}�fdd�|D�}t|�dkr8|d}q8W|dk	r�|jtjj|d	��q*|jd�q*W|S)
z�Return list of paths to RECORD files for system-installed projects.

    If a project is not installed, the resulting list contains None instead
    of a path to its RECORD
    cSsg|]}tjj|�r|�qSr)rr�exists)�.0�sprrr�
<listcomp>(sz'find_system_records.<locals>.<listcomp>Nz-[^\{0}]+\.dist-infocsg|]}tjj�|��qSr)rr�join)r�p)rrrr.scsg|]}tj�|�r|�qSr)�re�match)r�c)�dist_info_rerrr0srrZRECORD)
�site�getsitepackagesr�base_prefix�base_exec_prefixrrr r�sep�listdir�len�append)ZprojectsZrecordsZsys_sitepackZprojectrZ
candidatesZfilteredr)r%rr�find_system_recordss

r.cCs�tjjtjj|��}|t|�d�jtjj�}t||�\}}t|�}tjj||d�}t	j
|dt	jd�}tj
�}	tj|	�}
x:|D]2\}}}
|jtjj||�|d�|
j|||
g�q�W|
j|ddg�|j||	j��|j�|jS)zcRecreates a whee of package with given record_path and returns path
    to the newly created wheel.Nz.whl�w)�modeZcompression)Zarcname�)rr�dirnamer,�stripr*�get_records_to_pack�get_wheel_namer �zipfileZZipFileZZIP_DEFLATED�io�StringIO�csv�writer�writeZwriterowZwritestr�getvalue�close�filename)rr�site_dir�record_relpath�to_write�to_omitZnew_wheel_nameZnew_wheel_pathZ	new_wheelZ
new_recordr:�fZsha_hash�sizerrrr:s
rcCstjjtjj|�d�}tj|dd��}tjj�j	|j
��}WdQRXtjjtjj|�d�}tj|dd��}tjj�j	|j
��}WdQRX|jd�}|jd�}d}	g}
x&|jd	�D]}|
j
|jd
�d�q�Wdj|
�}
|jd	�jd
�d
d�\}}
td|||	|
||
g�}d
jt|��S)z.Return proper name of the wheel, without .whl.ZWHEELzutf-8)�encodingNZMETADATA�NameZVersionr1ZTag�-r�.r�)rrr r2�codecs�open�emailrZParserZparsestr�read�getZget_allr-�split�filter�list)rZwheel_info_pathZwheel_info_fileZ
wheel_infoZ
metadata_pathZ
metadata_fileZmetadataZdistribution�versionZ	build_tagZlang_tag�tZabi_tagZplat_tagZto_joinrrrr5Vs 


r5c
Cstjj||�}tj|dd��}|j�}WdQRXtjj|�jtjj�}|dt	d��d}g}g}x�|j
�D]�}|jd�}	t	|	�dkrntjj|	d�s�|	dj
d	�s�|	djd
�s�|	djd�s�|	d|ks�|	dj
|�r�|j|	�q�|j|	�qnqnW||fS)aAccepts path of sitedir and path of RECORD file relative to it.
    Returns two lists:
    - list of files that can be written to new RECORD straight away
    - list of files that shouldn't be written or need some processing
      (pyc and pyo files, scripts)
    zutf-8)rENz	dist-info�data�,rIrz..z.pycz.pyo)rrr rJrKrMr2r3r*r,�
splitlinesrO�isabs�
startswith�endswithr-)
r?r@Zrecord_file_pathZrecord_fileZrecord_contentsZdata_dirrArB�lZsplrrrr4ns"
r4)rrJr9Zemail.parserrLrr7r"r&�
subprocessrr6rr.rr5r4rrrr�<module>s

Zerion Mini Shell 1.0