Your IP : 216.73.217.17


Current Path : /lib/python2.7/site-packages/wheel/
Upload File :
Current File : //lib/python2.7/site-packages/wheel/wheelfile.pyc

�
���]c@s
ddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZ
ddlmZmZmZddlmZddlmZmZmZmZmZmZejdej�Zdd	�Zd
efd��YZ dS(i����(tprint_functionN(tOrderedDict(tlog(tZIP_DEFLATEDtZipInfotZipFile(t
WheelError(turlsafe_b64decodet
as_unicodetnativeturlsafe_b64encodetas_bytestStringIOst^(?P<namever>(?P<name>.+?)-(?P<ver>.+?))(-(?P<build>\d[^-]*))?
     -(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)\.whl$cCs;ttjjd|ptj���}tj|�dd!S(NtSOURCE_DATE_EPOCHii(tinttostenvirontgetttimetgmtime(t	timestamp((s0/tmp/pip-install-NwWfNs/wheel/wheel/wheelfile.pytget_zipinfo_datetimes't	WheelFilecBs_eZdZejZdd�Zddd�Zd�Z	ddd�Z
dd�Zd�ZRS(	s�A ZipFile derivative class that also reads SHA-256 hashes from
    .dist-info/RECORD and checks any read files against those.
    trc
Cs<tjj|�}tj|�|_|jd�sC|jdkr[tdj	|���nt
j|||dtdt
�dj	|jjd��|_|jd|_t�|_i|_|dkr8d|j|j<d|j|jd	<d|j|jd
<y|j|j�}Wn)tk
rBtdj	|j���nX|��x�|D]�}|jd�}|jd
d�\}}}|rQ|jd�\}	}ytj|	�Wn&tk
r�tdj	|	���nX|	j�ddhkrtdj	|	���n|	t|jd��f|j|<qQqQWWdQXndS(Ns.whlsBad wheel filename {!r}tcompressiont
allowZip64s{}.dist-infotnamevers/RECORDRs.jwss.p7ssMissing {} filesutf-8u,iu=sUnsupported hash algorithm: {}tmd5tsha1s4Weak hash algorithm ({}) is not permitted by PEP 427tascii(NN(NN(NN(Rtpathtbasenamet
WHEEL_INFO_REtmatchtparsed_filenametendswithtNoneRtformatRt__init__RtTruetgrouptdist_info_pathtrecord_pathRt_file_hashest_file_sizestopentKeyErrortdecodetrsplittsplitthashlibtnewt
ValueErrortlowerRtencode(
tselftfiletmodeRtrecordtlineRthash_sumtsizet	algorithm((s0/tmp/pip-install-NwWfNs/wheel/wheel/wheelfile.pyR&&s@	


cs�d�����fd�}tj||||��tt|t�rQ|jn|��|dkr��jd�r��|jkr�t	dj
t�����n|j�\}��dk	r�tj
|���j|��_q�n�S(Ncsv|dkr"�j}�|�n
�||��j|�|rr�j��krrtdjt�����ndS(NsHash mismatch for file '{}'(R$t_eoftupdatetdigestRR%R	(tnewdatateof(teftef_namet
expected_hashtrunning_hashtupdate_crc_orig(s0/tmp/pip-install-NwWfNs/wheel/wheel/wheelfile.pyt_update_crcRs	


Rt/sNo hash found for file '{}'(R$RR-Rt
isinstanceRtfilenameR#R+RR%R	R2R3RI(R7tname_or_infoR9tpwdRIR>((RDRERFRGRHs0/tmp/pip-install-NwWfNs/wheel/wheel/wheelfile.pyR-Qs	c	Cs'tjd|j|�g}x�tj|�D]�\}}}|j�x�t|�D]�}tjjtjj	||��}tjj
|�rRtjj||�}||jkr�q�|j
d�r�|j||f�q�|j||�qRqRWq,W|j�x$|D]\}}|j||�qWdS(Ns#creating '%s' and adding '%s' to its
.dist-info(tloggertinfoRLRtwalktsorttsortedRtnormpathtjointisfiletrelpathR*R#tappendtwrite(	R7tbase_dirtdeferredtroottdirnamest	filenamestnameRtarcname((s0/tmp/pip-install-NwWfNs/wheel/wheel/wheelfile.pytwrite_filesls 
!
cCs�t|d��(}tj|j��}|j�}WdQXt|pE|dt|j��}tj	|j
�tj|j
�Bd>|_t
|_|j|||�dS(Ntrbt	date_timei(R-RtfstattfilenotreadRRtst_mtimetstattS_IMODEtst_modetS_IFMTt
external_attrRt
compress_typetwritestr(R7RLR`Rmtftsttdatatzinfo((s0/tmp/pip-install-NwWfNs/wheel/wheel/wheelfile.pyRY�s!)	cCs�tj||||�t|t�r.|jn|}tjd|�||jkr�|j|�}|j	t
t|j���f|j
|<t|�|j|<ndS(Nsadding '%s'(RRnRKRRLRORPR*t_default_algorithmR_R	R
RAR+tlenR,(R7tzinfo_or_arcnametbytesRmtfnamethash_((s0/tmp/pip-install-NwWfNs/wheel/wheel/wheelfile.pyRn�s(c
s��jdk	r��jdkr��jr�t�}tj|dddddd�}|j�fd��jj�D��|j	t
�j�d	d	f�tt
�j�d
t��}t|_d
|_�j|t|j���ntj��dS(Ntwt	delimitert,t	quotechart"tlineterminators
c3s9|]/\}\}}||d|�j|fVqdS(t=N(R,(t.0RwR>Rx(R7(s0/tmp/pip-install-NwWfNs/wheel/wheel/wheelfile.pys	<genexpr>�stRci�ii�(tfpR$R9R+Rtcsvtwritert	writerowstitemstwriterowR%R*RR	RRRmRlRnRtgetvalueRtclose(R7RqR�Rr((R7s0/tmp/pip-install-NwWfNs/wheel/wheel/wheelfile.pyR��s'	!		N(
t__name__t
__module__t__doc__R2tsha256RsR&R$R-RaRYRnR�(((s0/tmp/pip-install-NwWfNs/wheel/wheel/wheelfile.pyRs	+	

(!t
__future__RR�R2tos.pathRtreRhRtcollectionsRt	distutilsRROtzipfileRRRt	wheel.cliRt
wheel.utilRRR	R
RRtcompiletVERBOSER R$RR(((s0/tmp/pip-install-NwWfNs/wheel/wheel/wheelfile.pyt<module>s .