Your IP : 18.117.74.47


Current Path : /opt/alt/python35/lib64/python3.5/ensurepip/rewheel/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/ensurepip/rewheel/__pycache__/__init__.cpython-35.opt-2.pyc



$�YfL�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZdd�Zdd�Z
dd�Zdd	�Zd
d�ZdS)�NcCs�tjdd�}|jddd�|jddddd	d
dtjj�|j�}d}yttt	|���Wn>t
k
r�}ztd
j|��d}WYdd}~XnXtj
d�dS)N�descriptionz,Recreate wheel of package with given RECORD.�record_path�helpzPath to RECORD filez-oz--output-dirz>Dir where to place the wheel, defaults to current working dir.�dest�outdir�defaultrz
Failed: {}�)�argparse�ArgumentParser�add_argument�os�path�curdir�
parse_args�print�rewheel_from_record�vars�
BaseException�format�sys�exit)�parser�ns�retcode�e�r�-/opt/alt/python35/lib64/python3.5/__init__.py�run
s
rcsg}tjtjtjg�}dd�|D�}x�|D]�}d}x�|D]��tjj�|�djtj	���fdd�tj
��D�}�fdd�|D�}t|�dkrN|d}qNW|dk	r�|jtjj|d��q;|jd�q;W|S)	NcSs(g|]}tjj|�r|�qSr)rr
�exists)�.0�sprrr�
<listcomp>(s	z'find_system_records.<locals>.<listcomp>z-[^\{0}]+\.dist-infocs%g|]}tjj�|��qSr)rr
�join)r�p)r rrr!.s	cs(g|]}tj�|�r|�qSr)�re�match)r�c)�dist_info_rerrr!0s	rrZRECORD)
�site�getsitepackagesr�base_prefix�base_exec_prefixrr
r"r�sep�listdir�len�append)Zprojects�recordsZsys_sitepackZprojectr
Z
candidatesZfilteredr)r'r r�find_system_recordss

%"r1cCsEtjjtjj|��}|t|�d�jtjj�}t||�\}}t|�}tjj||d�}t	j
|dddt	j�}tj
�}	tj|	�}
xO|D]G\}}}
|jtjj||�d|�|
j|||
g�q�W|
j|ddg�|j||	j��|j�|jS)Nz.whl�mode�w�compressionZarcname�)rr
�dirnamer.�stripr,�get_records_to_pack�get_wheel_namer"�zipfile�ZipFile�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%"
rcCs�tjjtjj|�d�}tj|dd��%}tjj�j	|j
��}WdQRXtjjtjj|�d�}tj|dd��%}tjj�j	|j
��}WdQRX|jd�}|jd�}d}	g}
x1|jd�D] }|
j
|jd	�d
�q�Wdj|
�}
|jd�jd	�dd
�\}}
td|||	|
||
g�}d	jt|��S)NZWHEEL�encodingzutf-8ZMETADATA�NameZVersionr5ZTag�-r�.r�)rr
r"r6�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_joinrrrr9Vs !%!%(!r9c
Cs\tjj||�}tj|dd��}|j�}WdQRXtjj|�jtjj�}|dt	d��d}g}g}x�|j
�D]�}|jd�}	t	|	�dkr�tjj|	d�s.|	dj
d�s.|	djd	�s.|	djd
�s.|	d|ks.|	dj
|�r>|j|	�qN|j|	�q�q�W||fS)NrKzutf-8z	dist-info�data�,rOrz..z.pycz.pyo)rr
r"rPrQrSr6r7r,r.�
splitlinesrU�isabs�
startswith�endswithr/)
rErFZrecord_file_pathZrecord_fileZrecord_contentsZdata_dirrGrH�lZsplrrrr8ns"!)&#r8)r	rPr?Zemail.parserrRrr=r$r(�
subprocessrr:rr1rr9r8rrrr�<module>s

?>