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



YfL@sddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddZddZ
ddZdd	Zd
dZdS)NcCstjdd}|jddd|jddddd	d
dtjj|j}d}yttt	|Wn>t
k
r}ztd
j|d}WYdd}~XnXtj
ddS)Ndescriptionz,Recreate wheel of package with given RECORD.record_pathhelpzPath to RECORD filez-oz--output-dirz>Dir where to place the wheel, defaults to current working dir.destoutdirdefaultrz
Failed: {})argparseArgumentParseradd_argumentospathcurdir
parse_argsprintrewheel_from_recordvars
BaseExceptionformatsysexit)parsernsretcodeer-/opt/alt/python35/lib64/python3.5/__init__.pyrun
s
rcsg}tjtjtjg}dd|D}x|D]}d}x|D]tjj|djtj	fddtj
D}fdd|D}t|dkrN|d}qNW|dk	r|jtjj|dq;|jdq;W|S)	NcSs(g|]}tjj|r|qSr)rr
exists).0sprrr
<listcomp>(s	z'find_system_records.<locals>.<listcomp>z-[^\{0}]+\.dist-infocs%g|]}tjj|qSr)rr
join)rp)r rrr!.s	cs(g|]}tj|r|qSr)rematch)rc)dist_info_rerrr!0s	rrZRECORD)
sitegetsitepackagesrbase_prefixbase_exec_prefixrr
r"rseplistdirlenappend)ZprojectsrecordsZsys_sitepackZprojectr
Z
candidatesZfilteredr)r'r rfind_system_recordss

%"r1cCsEtjjtjj|}|t|djtjj}t||\}}t|}tjj||d}t	j
|dddt	j}tj
}	tj|	}
xO|D]G\}}}
|jtjj||d||
j|||
gqW|
j|ddg|j||	j|j|jS)Nz.whlmodewcompressionZarcname)rr
dirnamer.stripr,get_records_to_packget_wheel_namer"zipfileZipFileZIP_DEFLATEDioStringIOcsvwriterwriteZwriterowZwritestrgetvalueclosefilename)rrsite_dirrecord_relpathto_writeto_omitZnew_wheel_nameZnew_wheel_pathZ	new_wheelZ
new_recordr@fZsha_hashsizerrrr:s%"
rcCstjjtjj|d}tj|dd%}tjjj	|j
}WdQRXtjjtjj|d}tj|dd%}tjjj	|j
}WdQRX|jd}|jd}d}	g}
x1|jdD] }|
j
|jd	d
qWdj|
}
|jdjd	dd
\}}
td|||	|
||
g}d	jt|S)NZWHEELencodingzutf-8ZMETADATANameZVersionr5ZTag-r.r)rr
r"r6codecsopenemailrZParserZparsestrreadgetZget_allr/splitfilterlist)rZwheel_info_pathZwheel_info_fileZ
wheel_infoZ
metadata_pathZ
metadata_fileZmetadataZdistributionversionZ	build_tagZlang_tagtZabi_tagZplat_tagZto_joinrrrr9Vs !%!%(!r9c
Cs\tjj||}tj|dd}|j}WdQRXtjj|jtjj}|dt	dd}g}g}x|j
D]}|jd}	t	|	dkrtjj|	ds.|	dj
ds.|	djd	s.|	djd
s.|	d|ks.|	dj
|r>|j|	qN|j|	qqW||fS)NrKzutf-8z	dist-infodata,rOrz..z.pycz.pyo)rr
r"rPrQrSr6r7r,r.
splitlinesrUisabs
startswithendswithr/)
rErFZrecord_file_pathZrecord_fileZrecord_contentsZdata_dirrGrHlZsplrrrr8ns"!)&#r8)r	rPr?Zemail.parserrRrr=r$r(
subprocessrr:rr1rr9r8rrrr<module>s
Back to Directory File Manager