Your IP : 18.116.10.48


Current Path : /opt/alt/python27/lib64/python2.7/ensurepip/rewheel/
Upload File :
Current File : //opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pyc

�
^
bc@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZd�Zd�Z
d�Zd�Zd�ZdS(i����Nc	Cs�tjdd�}|jddd�|jddddd	d
dtjj�|j�}d}ytt|��GHWn't	k
r�}d
j
|�GHd}nXtjd�dS(Ntdescriptions,Recreate wheel of package with given RECORD.trecord_paththelpsPath to RECORD files-os--output-dirs>Dir where to place the wheel, defaults to current working dir.tdesttoutdirtdefaultis
Failed: {}i(
targparsetArgumentParsertadd_argumenttostpathtcurdirt
parse_argstrewheel_from_recordtvarst
BaseExceptiontformattsystexit(tparsertnstretcodete((s?/opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pytrun
s

cCsPg}tjtjtjg�}g|D]}tjj|�r(|^q(}x�|D]�}d}x�|D]�}tjj	||�dj
tj�}gtj|�D]}tjj	||�^q�}g|D]}	t
j||	�r�|	^q�}
t|
�dkrf|
d}qfqfW|dk	r;|jtjj	|d��qS|jd�qSW|S(s�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
    s-[^\{0}]+\.dist-infoiitRECORDN(tsitetgetsitepackagesRtbase_prefixtbase_exec_prefixR	R
texiststNonetjoinRtseptlistdirtretmatchtlentappend(tprojectstrecordstsys_sitepacktsptprojectR
tdist_info_retpt
candidatestctfiltered((s?/opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pytfind_system_recordss+

%1+cCs?tjjtjj|��}|t|�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(scRecreates a whee of package with given record_path and returns path
    to the newly created wheel.s.whltmodetwtcompressiontarcnamet(R	R
tdirnameR$tstripR tget_records_to_packtget_wheel_nameRtzipfiletZipFiletZIP_DEFLATEDtiotStringIOtcsvtwritertwritetwriterowtwritestrtgetvaluetclosetfilename(RRtsite_dirtrecord_relpathtto_writetto_omittnew_wheel_nametnew_wheel_patht	new_wheelt
new_recordR@tftsha_hashtsize((s?/opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pyR
:s"
c
Cs�tjjtjj|�d�}tj|dd��%}tjj�j	|j
��}WdQXtjjtjj|�d�}tj|dd��%}tjj�j	|j
��}WdQX|jd�}|jd�}d}	g}
x1|jd	�D] }|
j
|jd
�d�q�Wdj|
�}
|jd	�jd
�d
d!\}}
td|||	|
||
g�}d
jt|��S(s.Return proper name of the wheel, without .whl.tWHEELtencodingsutf-8NtMETADATAtNametVersionR5tTagt-it.ii(R	R
RR6tcodecstopentemailRtParsertparsestrtreadtgettget_allR%tsplittfilterRtlist(Rtwheel_info_pathtwheel_info_filet
wheel_infot
metadata_patht
metadata_filetmetadatatdistributiontversiont	build_tagtlang_tagtttabi_tagtplat_tagtto_join((s?/opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pyR9Vs !$!$%!c
CsUtjj||�}tj|dd��}|j�}WdQXtjj|�jtjj�}|t	d� d}g}g}x�|j
�D]�}|jd�}	t	|	�dkr�tjj|	d�s'|	dj
d	�s'|	djd
�s'|	djd�s'|	d|ks'|	dj
|�r7|j|	�qG|j|	�q�q�W||fS(sAccepts 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)
    RSsutf-8Ns	dist-infotdatat,iis..s.pycs.pyo(R	R
RRZR[R_R6R7R R$t
splitlinesRbtisabst
startswithtendswithR%(
RGRHtrecord_file_pathtrecord_filetrecord_contentstdata_dirRIRJtltspl((s?/opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pyR8ns"!)&#(RRZR?temail.parserR\R	R=R"Rt
subprocessRR:RR0R
R9R8(((s?/opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pyt<module>s				

?>