ok

Mini Shell

Direktori : /opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyc

�
�2{Yc
@s>ddlmZdZdZdZdZdZdZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZyddlZddlZWnek
r�eZZnXeefZyeef7ZWnek
r�nXd	d
ddgZejd
dkr3ddlZnddlZejZdZdZ e dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1d Z2d!Z3d"Z4d#Z5d
Z6d$Z7d%Z8e7Z9e'e(e)e*e-e.e/e+e,e0e1e2fZ:e'e(e/e2fZ;e0e1e2fZ<d&d'd(d)d*d+d,d-fZ=e>d&d'd,d-f�Z?ie@d.6e@d/6e@d)6eAd*6eAd+6eAd(6ZBd0ZCd1ZDd2ZEd3ZFd4ZGd5ZHd6ZId7ZJdZKd8ZLd9ZMd:ZNd;ZOd<ZPd=ZQd>ZRd%ZSd$ZTe	jUd?d@fkr)dAZVnejW�ZVdB�ZXdC�ZYdD�ZZd=e9dE�Z[dF�Z\edG�Z]eCdHfeDdIfeEdJfeFdKfeGdLfeHdMffeLdNffeMdOffeNeIBdPfeId feNd!ffeOdNffePdOffeQeJBdPfeJd feQd!ffeRdNffeSdOffeTeKBdQfeKdRfeTd!fff
Z^dS�Z_de`fdT��YZadUeafdV��YZbdWeafdX��YZcdYeafdZ��YZdd[eafd\��YZed]eafd^��YZfd_effd`��YZgdaeffdb��YZhdceffdd��YZideeffdf��YZjdgeffdh��YZkdielfdj��YZmdkelfdl��YZndmelfdn��YZodoelfdp��YZpdqelfdr��YZqdselfdt��YZrd
elfdu��YZsd	elfdv��YZtdwelfdx��YZudy�ZveZwetjZdS(zi����(tprint_functions
$Revision$s0.9.0s&Lars Gust\u00e4bel (lars@gustaebel.de)s5$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $s?$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $s8Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend.NtTarFiletTarInfot
is_tarfiletTarErroriitiisustar  tustar00idi�t0t1t2t3t4t5t6t7tLtKtStxtgtXiitpathtlinkpathtsizetmtimetuidtgidtunametgnametatimetctimei�i�i`i@i iiiii�i@i iiitnttcesutf-8cCs,|j||�}|| |t|�tS(s8Convert a string to a null-terminated bytes object.
    (tencodetlentNUL(tstlengthtencodingterrors((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytstn�scCs8|jd�}|dkr(|| }n|j||�S(s8Convert a null-terminated bytes object to a string.
    Ri����(tfindtdecode(R$R&R'tp((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytnts�s
cCs�|dtd�kr^y%tt|dd�p1dd�}Wq�tk
rZtd��q�XnId}x@tt|�d�D](}|dK}|t||d�7}q{W|S(	s/Convert a number field to a python number.
    ii�tasciitstrictRisinvalid headeri(tchrtintR,t
ValueErrortInvalidHeaderErrortrangeR"tord(R$tnti((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytnti�s%

cCs�d|kod|dknrHd|d|fjd�t}n�|tksh|d|dkrwtd��n|dkr�tjdtjd	|��d}nt�}x6t|d�D]$}|j	d|d
@�|dL}q�W|j	dd�|S(s/Convert a python number to a number field.
    iiis%0*oR-isoverflow in number fieldRtli�i�(
R!R#t
GNU_FORMATR1tstructtunpacktpackt	bytearrayR3tinsert(R5tdigitstformatR$R6((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytitn�s	$$ %	cCsxdttjd|d �tjd|dd!��}dttjd|d �tjd|dd!��}||fS(	s�Calculate the checksum for a member's header by summing up all
       characters except for the chksum field which is treated as if
       it was filled with spaces. According to the GNU tar sources,
       some tars (Sun and NeXT) calculate chksum with signed char,
       which will be different if there are chars in the buffer with
       the high bit set. So we calculate two checksums, unsigned and
       signed.
    it148Bi�t356Bi�it148bt356b(tsumR:R;(tbuftunsigned_chksumt
signed_chksum((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytcalc_chksums�s	77cCs|dkrdS|dkrSx0trN|jd�}|s>Pn|j|�qWdSd}t||�\}}xQt|�D]C}|j|�}t|�|kr�td��n|j|�q{W|dkr|j|�}t|�|kr�td��n|j|�ndS(sjCopy length bytes from fileobj src to fileobj dst.
       If length is None, copy the entire content.
    iNiisend of file reachedi@i@(tNonetTruetreadtwritetdivmodR3R"tIOError(tsrctdstR%RGtBUFSIZEtblockst	remaindertb((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytcopyfileobjs,	R8t-RVtdtcR+trtwR$tttTcCsig}xStD]K}xB|D]-\}}||@|kr|j|�PqqW|jd�q
Wdj|�S(scConvert a file's mode to a string of the form
       -rwxrwxrwx.
       Used by TarFile.list()
    RXt(tfilemode_tabletappendtjoin(tmodetpermttabletbittchar((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytfilemode8s

cBseZdZRS(sBase exception.(t__name__t
__module__t__doc__(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRGstExtractErrorcBseZdZRS(s%General exception for extract errors.(RiRjRk(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRlJst	ReadErrorcBseZdZRS(s%Exception for unreadble tar archives.(RiRjRk(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRmMstCompressionErrorcBseZdZRS(s.Exception for unavailable compression methods.(RiRjRk(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRnPstStreamErrorcBseZdZRS(s=Exception for unsupported operations on stream-like TarFiles.(RiRjRk(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRoSstHeaderErrorcBseZdZRS(s!Base exception for header errors.(RiRjRk(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRpVstEmptyHeaderErrorcBseZdZRS(sException for empty headers.(RiRjRk(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRqYstTruncatedHeaderErrorcBseZdZRS(s Exception for truncated headers.(RiRjRk(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRr\stEOFHeaderErrorcBseZdZRS(s"Exception for end of file headers.(RiRjRk(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRs_sR2cBseZdZRS(sException for invalid headers.(RiRjRk(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR2bstSubsequentHeaderErrorcBseZdZRS(s3Exception for missing and invalid extended headers.(RiRjRk(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRtest
_LowLevelFilecBs2eZdZd�Zd�Zd�Zd�ZRS(s�Low-level file object. Supports reading and writing.
       It is used instead of a regular file object for streaming
       access.
    cCsgitjd6tjtjBtjBd6|}ttd�rK|tjO}ntj||d�|_dS(NR[R\tO_BINARYi�(	tostO_RDONLYtO_WRONLYtO_CREATtO_TRUNCthasattrRvtopentfd(tselftnameRc((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__init__rs
cCstj|j�dS(N(RwtcloseR~(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�{scCstj|j|�S(N(RwRMR~(RR((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRM~scCstj|j|�dS(N(RwRNR~(RR$((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRN�s(RiRjRkR�R�RMRN(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRuls
				t_StreamcBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	d
�Zdd�Z
d�Zd
�ZRS(s�Class that serves as an adapter between TarFile and
       a stream-like object.  The stream-like object only
       needs to have a read() or write() method and is accessed
       blockwise.  Use of gzip or bzip2 compression is possible.
       A stream-like object could be for example: sys.stdin,
       sys.stdout, a socket, a tape device etc.

       _Stream is intended to be used only internally.
    cCs�t|_|dkr0t||�}t|_n|dkrWt|�}|j�}n|p`d|_||_||_	||_
||_d|_d|_
t|_y�|dkr%yddl}Wntk
r�td��nX||_|jd�|_|dkr|j�q%|j�n|d	kr�yddl}Wntk
r`td
��nX|dkr�d|_|j�|_q�|j�|_nWn,|js�|j
j�nt|_�nXdS(s$Construct a _Stream object.
        t*R_itgzi����Nszlib module is not availableR[tbz2sbz2 module is not available(RLt_extfileobjRKRutFalset_StreamProxytgetcomptypeR�RctcomptypetfileobjtbufsizeRGtpostclosedtzlibtImportErrorRntcrc32tcrct
_init_read_gzt_init_write_gzR�tdbuftBZ2Decompressortcmpt
BZ2CompressorR�(RR�RcR�R�R�R�R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��sP								
	


			cCs*t|d�r&|jr&|j�ndS(NR�(R|R�R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__del__�scCs�|jjd|jj|jj|jjd�|_tjdtt	j	���}|j
d|d�|jjd�r�|jd |_n|j
|jj
dd	�t�d
S(s6Initialize for writing with gzip compression.
        i	is<Ls�s�s.gzi����s
iso-8859-1treplaceN(R�tcompressobjtDEFLATEDt	MAX_WBITSt
DEF_MEM_LEVELR�R:R<R0ttimet_Stream__writeR�tendswithR!R#(Rt	timestamp((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s
	cCsw|jdkr-|jj||j�|_n|jt|�7_|jdkrf|jj|�}n|j|�dS(s&Write string s to the stream.
        R�ttarN(	R�R�R�R�R�R"R�tcompressR�(RR$((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRN�scCs_|j|7_xIt|j�|jkrZ|jj|j|j �|j|j|_qWdS(s]Write string s to the stream if a whole new block
           is ready to be written.
        N(RGR"R�R�RN(RR$((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__write�scCs�|jr
dS|jdkrF|jdkrF|j|jj�7_n|jdkr�|jr�|jj|j�d|_|jdkr�|jjtj	d|j
d@��|jjtj	d|jd@��q�n|js�|jj
�nt|_dS(s[Close the _Stream object. No operation should be
           done on it afterwards.
        NR\R�R_R�s<LI����(R�RcR�RGR�tflushR�RNR:R<R�R�R�R�RL(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s		#)	cCss|jj|jj�|_d|_|jd�dkrItd��n|jd�dkrmtd��nt|jd��}|jd�|d	@r�t|jd��d
t|jd��}|j	|�n|d@rx3t
r|jd�}|s
|tkr�Pq�q�Wn|d@rUx3t
rQ|jd�}|sJ|tkr"Pq"q"Wn|d@ro|jd�nd
S(s:Initialize for reading a gzip compressed fileobj.
        R_is�snot a gzip fileissunsupported compression methodiiiiiN(R�t
decompressobjR�R�R�t
_Stream__readRmRnR4RMRLR#(RtflagtxlenR$((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�s.	

,
	
	
cCs|jS(s3Return the stream's file pointer position.
        (R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyttell#sicCs|||jdkrit||j|j�\}}x$t|�D]}|j|j�q?W|j|�ntd��|jS(sXSet the stream's file pointer to pos. Negative seeking
           is forbidden.
        is seeking backwards is not allowed(R�ROR�R3RMRo(RR�RTRUR6((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytseek(scCs�|dkrZg}x3trG|j|j�}|s7Pn|j|�qWdj|�}n|j|�}|jt|�7_|S(s�Return the next size number of bytes from the stream.
           If size is not defined, return all bytes of the stream
           up to EOF.
        R_N(RKRLt_readR�RaRbR�R"(RRR]RG((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRM5s	cCs�|jdkr|j|�St|j�}x�||kr�|j|j�}|sVPny|jj|�}Wntk
r�td��nX|j|7_|t|�7}q.W|j| }|j||_|S(s+Return size bytes from the stream.
        R�sinvalid compressed data(	R�R�R"R�R�R�t
decompressRPRm(RRRZRG((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�Gs 


cCs�t|j�}xN||kr_|jj|j�}|s=Pn|j|7_|t|�7}qW|j| }|j||_|S(ssReturn size bytes from stream. If internal buffer is empty,
           read another block from the stream.
        (R"RGR�RMR�(RRRZRG((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__read\s
N(RiRjRkR�R�R�RNR�R�R�R�R�RKRMR�R�(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s		4			
					
	R�cBs2eZdZd�Zd�Zd�Zd�ZRS(ssSmall proxy class that enables transparent compression
       detection for the Stream interface (mode 'r|*').
    cCs"||_|jjt�|_dS(N(R�RMt	BLOCKSIZERG(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�qs	cCs|jj|_|jS(N(R�RMRG(RR((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRMuscCs0|jjd�rdS|jjd�r,dSdS(Ns�R�tBZh91R�R�(RGt
startswith(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�ys
cCs|jj�dS(N(R�R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s(RiRjRkR�RMR�R�(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�ls
			t	_BZ2ProxycBsSeZdZd
Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
RS(sSmall proxy class that enables external file object
       support for "r:bz2" and "w:bz2" modes. This is actually
       a workaround for a limitation in bz2 module's BZ2File
       class which (unlike gzip.GzipFile) has no support for
       a file object argument.
    iicCs8||_||_t|jdd�|_|j�dS(NR�(R�RctgetattrRKR�tinit(RR�Rc((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s		cCsbddl}d|_|jdkrO|j�|_|jjd�d|_n|j�|_dS(Ni����iR[R_(	R�R�RcR�tbz2objR�R�RGR�(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s	cCs�t|j�}x`||krq|jj|j�}|s=Pn|jj|�}|j|7_|t|�7}qW|j| }|j||_|jt|�7_|S(N(R"RGR�RMt	blocksizeR�R�R�(RRRtrawtdataRG((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRM�s
cCs4||jkr|j�n|j||j�dS(N(R�R�RM(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s
cCs|jS(N(R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��scCs;|jt|�7_|jj|�}|jj|�dS(N(R�R"R�R�R�RN(RR�R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRN�scCs5|jdkr1|jj�}|jj|�ndS(NR\(RcR�R�R�RN(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��si@(RiRjRkR�R�R�RMR�R�RNR�(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s		
				t_FileInFilecBsAeZdZdd�Zd�Zd�Zd�Zdd�ZRS(sA thin wrapper around an existing file object that
       provides a part of its data as an individual file
       object.
    cCs||_||_||_d|_|dkrBd|fg}nd|_g|_d}|j}xs|D]k\}}||kr�|jjt||df�n|jjt	||||f�||7}||}qjW||jkr
|jjt||jdf�ndS(Ni(
R�toffsetRtpositionRKt	map_indextmapRaR�RL(RR�R�Rt	blockinfotlastpostrealpos((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s$							 
cCs#t|jd�stS|jj�S(Ntseekable(R|R�RLR�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��scCs|jS(s*Return the current file position.
        (R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��scCs
||_dS(s(Seek to a position in the file.
        N(R�(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��scCsK|dkr|j|j}nt||j|j�}d}x|dkrFx|tr�|j|j\}}}}||jko�|knr�PqP|jd7_|jt|j�krPd|_qPqPWt|||j�}|r|jj	||j|�||jj
|�7}n|t|7}||8}|j|7_qAW|S(s!Read data from the file.
        R_iiN(RKRR�tminRLR�R�R"R�R�RMR#(RRRGR�tstarttstopR�R%((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRM�s(	
N(	RiRjRkRKR�R�R�R�RM(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s			tExFileObjectcBs�eZdZdZd�Zd�Zd�Zd�Zdd�Z	e	Z
dd�Zd	�Zd
�Z
ejd�Zd�Zd
�ZRS(saFile-like object for reading an archive member.
       Is returned by TarFile.extractfile().
    icCsdt|j|j|j|j�|_|j|_d|_t|_|j|_d|_	d|_
dS(NR[iR_(R�R�toffset_dataRtsparseR�RcR�R�R�tbuffer(Rttarfilettarinfo((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�s				cCstS(N(RL(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytreadable!scCstS(N(R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytwritable$scCs
|jj�S(N(R�R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�'scCs�|jrtd��nd}|jrh|dkrH|j}d|_qh|j| }|j||_n|dkr�||jj�7}n ||jj|t|��7}|jt|�7_|S(s~Read at most size bytes from the file. If size is not
           present or None, read all data until EOF is reached.
        sI/O operation on closed fileR_N(R�R1R�RKR�RMR"R�(RRRG((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRM*s			
 i����cCs
|jrtd��n|jjd�d}|dkr�x|tr�|jj|j�}|j|7_|szd|kr=|jjd�d}|dkr�t|j�}nPq=q=Wn|dkr�t	||�}n|j| }|j||_|j
t|�7_
|S(s�Read one entire line from the file. If size is present
           and non-negative, return a string with at most that
           size, which may be an incomplete line.
        sI/O operation on closed files
iii����(R�R1R�R)RLR�RMR�R"R�R�(RRR�RG((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytreadlineEs$		
cCs:g}x-tr5|j�}|s%Pn|j|�q	W|S(s0Return a list with all remaining lines.
        (RLR�Ra(Rtresulttline((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt	readlinesbs	cCs|jrtd��n|jS(s*Return the current file position.
        sI/O operation on closed file(R�R1R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�ls	cCs|jrtd��n|tjkrHtt|d�|j�|_n�|tjkr�|dkrt|j|d�|_q�t|j||j�|_nC|tj	kr�tt|j||j�d�|_ntd��d|_
|jj|j�dS(s(Seek to a position in the file.
        sI/O operation on closed fileisInvalid argumentR_N(
R�R1RwtSEEK_SETR�tmaxRR�tSEEK_CURtSEEK_ENDR�R�R�(RR�twhence((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�ts	!(	cCs
t|_dS(sClose the file object.
        N(RLR�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��sccs,x%tr'|j�}|sPn|VqWdS(s/Get an iterator over the file's lines.
        N(RLR�(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__iter__�s
	N(RiRjRkR�R�R�R�R�RKRMtread1R�R�R�RwR�R�R�R�(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�s	
				
		cBs�eZdZd?Zdd�Zd�Zd�Zeee�Zd�Z	d�Z
ee	e
�Zd�Zd�Z
eedd�Zd�Zd �Zd!�Zed"��Zd#�Zed$��Zed%��Zed&��Zed'��Zed(��Zed)��Zd*�Zd+�Zd,�Z d-�Z!d.�Z"d/�Z#d0�Z$d1�Z%d2�Z&d3�Z'd4�Z(d5�Z)d6�Z*d7�Z+d8�Z,d9�Z-d:�Z.d;�Z/d<�Z0d=�Z1d>�Z2RS(@sInformational class which holds the details about an
       archive member given by a tar header block.
       TarInfo objects are returned by TarFile.getmember(),
       TarFile.getmembers() and TarFile.gettarinfo() and are
       usually created internally.
    R�RcRRRRtchksumttypetlinknameRRtdevmajortdevminorR�R�tpax_headersR�R�t_sparse_structst_link_targetR_cCs�||_d|_d|_d|_d|_d|_d|_t|_d|_	d|_
d|_d|_d|_
d|_d|_d|_i|_dS(sXConstruct a TarInfo object. name is the optional name
           of the member.
        i�iR_N(R�RcRRRRR�tREGTYPER�R�RRR�R�R�R�RKR�R�(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s"																cCs|jS(N(R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt_getpath�scCs
||_dS(N(R�(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt_setpath�scCs|jS(N(R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt_getlinkpath�scCs
||_dS(N(R�(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt_setlinkpath�scCs d|jj|jt|�fS(Ns<%s %r at %#x>(t	__class__RiR�tid(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__repr__�scCs�i
|jd6|jd@d6|jd6|jd6|jd6|jd6|jd6|jd	6|jd
6|j	d6|j
d6|jd
6|jd6}|d	t
kr�|djd�r�|dcd7<n|S(s9Return the TarInfo's attributes as a dictionary.
        R�i�RcRRRRR�R�R�RRR�R�t/(R�RcRRRRR�R�R�RRR�R�tDIRTYPER�(Rtinfo((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytget_info�s"











$tsurrogateescapecCsv|j�}|tkr+|j|||�S|tkrJ|j|||�S|tkrf|j||�Std��dS(s<Return a tar header as a string of 512 byte blocks.
        sinvalid formatN(R�tUSTAR_FORMATtcreate_ustar_headerR9tcreate_gnu_headert
PAX_FORMATtcreate_pax_headerR1(RR@R&R'R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyttobuf�scCst|d<t|d�tkr/td��nt|d�tkri|j|d�\|d<|d<n|j|t||�S(s3Return the object as a ustar header block.
        tmagicR�slinkname is too longR�tprefix(tPOSIX_MAGICR"tLENGTH_LINKR1tLENGTH_NAMEt_posix_split_namet_create_headerR�(RR�R&R'((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s
$cCs�t|d<d}t|d�tkrI||j|dt||�7}nt|d�tkr�||j|dt||�7}n||j|t||�S(s:Return the object as a GNU header block sequence.
        R�R_R�R�(	t	GNU_MAGICR"R�t_create_gnu_long_headertGNUTYPE_LONGLINKR�tGNUTYPE_LONGNAMER�R9(RR�R&R'RG((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�s
##c
Cs�t|d<|jj�}x�ddtfddtfddfD]�\}}}||kr_q>ny||jd	d
�Wn"tk
r�||||<q>nXt||�|kr>||||<q>q>Wx�ddddfD]�\}}||krd||<q�n||}d|ko+d|dkns@t|t	�r�t
|�||<d||<q�q�W|r|j|t|�}	nd}	|	|j
|td	d�S(s�Return the object as a ustar header block. If it cannot be
           represented this way, prepend a pax extended header sequence
           with supplement information.
        R�R�RR�RRi RR-R.RiRRiRiiR_R�(sunamesunamei (sgnamesgnamei (suidi(sgidi(ssizei(smtimei(R�R�tcopyR�R�R!tUnicodeEncodeErrorR"t
isinstancetfloattstrt_create_pax_generic_headertXHDTYPER�R�(
RR�R&R�R�thnameR%R?tvalRG((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�s4



4cCs|j|td�S(sAReturn the object as a pax global header block sequence.
        tutf8(RtXGLTYPE(tclsR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytcreate_pax_global_headerDscCs�|td }x$|r4|ddkr4|d }qW|t|�}|d }|sht|�tkrwtd��n||fS(sUSplit a name longer than 100 chars into a prefix
           and a name part.
        ii����R�sname is too long(t
LENGTH_PREFIXR"R�R1(RR�R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�Js
cCs�t|jdd�d||�t|jdd�d@d|�t|jdd�d|�t|jd	d�d|�t|jd
d�d|�t|jdd�d|�d
|jdt�t|jdd�d||�|jdt�t|jdd�d||�t|jdd�d||�t|jdd�d|�t|jdd�d|�t|jdd�d||�g}tjdtdj|��}t	|t�d}|d d|j
d�|d}|S(s�Return a header block. info is a dictionary with file
           information, format must be one of the *_FORMAT constants.
        R�R_idRcii�iRRRiRs        R�R�R�Ri RR�R�R�i�s%dsi����s%06oR-i����(R(tgetRAR�R�R:R<R�RbRJR!(R�R@R&R'tpartsRGR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�Ys&$#cCs@tt|�t�\}}|dkr<|t|t7}n|S(sdReturn the string payload filled with zero bytes
           up to the next 512 byte border.
        i(ROR"R�R#(tpayloadRTRU((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt_create_payloaduscCsm|j||�t}i}d|d<||d<t|�|d<t|d<|j|t||�|j|�S(sTReturn a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence
           for name.
        s
././@LongLinkR�R�RR�(R!R#R"R�R�R�R(RR�R�R&R'R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�s


cCs�t}xI|j�D];\}}y|jdd�Wqtk
rMt}PqXqWd}|rk|d7}nx�|j�D]�\}}|jd�}|r�|j|d�}n|jd�}t|�t|�d}d}	}
x6tr|tt|
��}	|	|
krPn|	}
q�W|tt|
�d�d	|d
|d7}qxWi}d|d
<||d<t|�|d<t|d<|j	|t
dd�|j|�S(s�Return a POSIX.1-2008 extended or global header sequence
           that contains a list of keyword, value pairs. The values
           must be strings.
        R	R.R_s21 hdrcharset=BINARY
R�iiR-t t=s
s././@PaxHeaderR�R�RR�R�(R�titemsR!RRLR"RtbytesR�R�R�R(RR�R�R&tbinarytkeywordtvaluetrecordsR8R5R+R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�s<
	

	
1


cCs2t|�dkr!td��nt|�tkrBtd��n|jt�tkrftd��nt|dd!�}|t|�kr�t	d��n|�}t
|dd!||�|_t|dd	!�|_t|d	d
!�|_
t|d
d!�|_t|dd!�|_t|dd!�|_||_|dd
!|_t
|d
d!||�|_t
|dd!||�|_t
|dd!||�|_t|dd!�|_t|dd!�|_t
|dd!||�}|jtkr|jjd�rt|_n|jtkr�d}g}x|td�D]n}	y6t|||d!�}
t||d|d!�}Wntk
r�PnX|j|
|f�|d7}q4Wt|d�}t|dd!�}
|||
f|_ n|j!�r|jj"d�|_n|r.|jt#kr.|d|j|_n|S(sAConstruct a TarInfo object from a 512 byte bytes object.
        isempty headerstruncated headersend of file headeri�i�sbad checksumidiliti|i�i�ii	i)iIiQiYi�R�i�iiii�i�i�($R"RqR�RrtcountR#RsR7RJR2R,R�RcRRRRR�R�R�RRR�R�tAREGTYPER�R�tGNUTYPE_SPARSER3R1RatboolR�tisdirtrstript	GNU_TYPES(RRGR&R'R�tobjR�R�tstructsR6R�tnumbytest
isextendedtorigsize((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytfrombuf�sZ		!
cCsP|jjt�}|j||j|j�}|jj�t|_|j|�S(sOReturn the next TarInfo object from TarFile object
           tarfile.
        (	R�RMR�R&R&R'R�R�t_proc_member(RR�RGR!((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytfromtarfilescCst|jttfkr"|j|�S|jtkr>|j|�S|jtttfkrc|j	|�S|j
|�SdS(sYChoose the right processing method depending on
           the type and call it.
        N(R�R�R�t
_proc_gnulongRt_proc_sparseRR
tSOLARIS_XHDTYPEt	_proc_paxt
_proc_builtin(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR's


cCsx|jj�|_|j}|j�s6|jtkrO||j|j�7}n||_|j	|j
|j|j�|S(sfProcess a builtin type or an unknown type which
           will be treated as a regular file.
        (
R�R�R�tisregR�tSUPPORTED_TYPESt_blockRR�t_apply_pax_infoR�R&R'(RR�R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR-$s		cCs�|jj|j|j��}y|j|�}Wntk
rPtd��nX|j|_|jt	kr�t
||j|j�|_
n-|jtkr�t
||j|j�|_n|S(sSProcess the blocks that hold a GNU longname
           or longlink member.
        s missing or bad subsequent header(R�RMR0RR(RpRtR�R�R�R,R&R'R�R�R�(RR�RGtnext((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR)5s
c
Cs|j\}}}|`x�|r�|jjt�}d}x�td�D]}}y6t|||d!�}t||d|d!�}	Wntk
r�PnX|r�|	r�|j||	f�n|d7}qFWt|d�}qW||_	|jj
�|_|j|j|j
�|_||_
|S(s8Process a GNU sparse header plus extra headers.
        iiiii�(R�R�RMR�R3R7R1RaRR�R�R�R0RR�(
RR�R"R$R%RGR�R6R�R#((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR*Ks(	
		cCs�|jj|j|j��}|jtkr9|j}n|jj�}tj	d|�}|dk	r�|jd�jd�|d<n|j
d�}|dkr�|j}nd}tjd�}d}x�tr�|j||�}|s�Pn|j�\}	}
t|	�}	||jd�d|jd�|	d!}|j|
dd|j�}
|
tkr}|j|||j|j�}n|j|dd|j�}|||
<||	7}q�Wy|j|�}Wntk
r�td	��nXd
|kr|j||�nbd|kr$|j|||�n@|j
d�d
krd|j
d�dkrd|j|||�n|jtt fkr�|j!||j|j�|j"|_"d|kr�|j#}
|j$�s�|jt%kr�|
|j|j�7}
n|
|_"q�n|S(sVProcess an extended or global header as described in
           POSIX.1-2008.
        s\d+ hdrcharset=([^\n]+)\niR	t
hdrcharsettBINARYs(\d+) ([^=]+)=iis missing or bad subsequent headersGNU.sparse.mapsGNU.sparse.sizesGNU.sparse.majorRsGNU.sparse.minorRRN(&R�RMR0RR�R
R�RtretsearchRKtgroupR*RR&tcompileRLtmatchtgroupsR0tendR�t_decode_pax_fieldR'tPAX_NAME_FIELDSR(RpRtt_proc_gnusparse_01t_proc_gnusparse_00t_proc_gnusparse_10RR+R1R�R�R.R/(RR�RGR�R9R3R&tregexR�R%RRR2R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR,gs`	+	

*	cCs�g}x6tjd|�D]"}|jt|jd���qWg}x6tjd|�D]"}|jt|jd���qXWtt||��|_dS(s?Process a GNU tar extended sparse header, version 0.0.
        s\d+ GNU.sparse.offset=(\d+)\nis\d+ GNU.sparse.numbytes=(\d+)\nN(R5tfinditerRaR0R7tlisttzipR�(RR2R�RGtoffsetsR9R#((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR?�s  cCsbg|djd�D]}t|�^q}tt|ddd�|ddd���|_dS(s?Process a GNU tar extended sparse header, version 0.1.
        sGNU.sparse.mapt,Nii(tsplitR0RCRDR�(RR2R�RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR>�s,cCs�d}g}|jjt�}|jdd�\}}t|�}xjt|�|dkr�d|kr�||jjt�7}n|jdd�\}}|jt|��qEW|jj�|_	t
t|ddd�|ddd���|_dS(s?Process a GNU tar extended sparse header, version 1.0.
        s
iiN(
RKR�RMR�RGR0R"RaR�R�RCRDR�(RR2R�R�tfieldsR�RGtnumber((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR@�scCsx�|j�D]�\}}|dkr8t|d|�q
|dkr]t|dt|��q
|dkr�t|dt|��q
|tkr
|tkr�yt||�}Wq�tk
r�d}q�Xn|dkr�|jd�}nt|||�q
q
W|j�|_dS(	soReplace fields with supplemental information from a previous
           pax extended or global header.
        sGNU.sparse.nameRsGNU.sparse.sizeRsGNU.sparse.realsizeiR�N(	RtsetattrR0t
PAX_FIELDStPAX_NUMBER_FIELDSR1RRR�(RR�R&R'RR((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR1�s"

cCs9y|j|d�SWntk
r4|j||�SXdS(s1Decode a single field from a pax record.
        R.N(R*tUnicodeDecodeError(RRR&tfallback_encodingtfallback_errors((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR<s
cCs0t|t�\}}|r(|d7}n|tS(s_Round up a byte count by BLOCKSIZE and return it,
           e.g. _block(834) => 1024.
        i(ROR�(RRRTRU((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR0
s
cCs
|jtkS(N(R�t
REGULAR_TYPES(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR.scCs
|j�S(N(R.(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisfilescCs
|jtkS(N(R�R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRscCs
|jtkS(N(R�tSYMTYPE(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytissymscCs
|jtkS(N(R�tLNKTYPE(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytislnkscCs
|jtkS(N(R�tCHRTYPE(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytischr scCs
|jtkS(N(R�tBLKTYPE(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisblk"scCs
|jtkS(N(R�tFIFOTYPE(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisfifo$scCs
|jdk	S(N(R�RK(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytissparse&scCs|jtttfkS(N(R�RVRXRZ(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytisdev(s(snamesmodesuidsgidssizesmtimeschksumstypeslinknamesunamesgnamesdevmajorsdevminorsoffsetsoffset_dataspax_headersssparsestarfiles_sparse_structss_link_target(3RiRjRkt	__slots__R�R�R�tpropertyRR�R�RR�R�tDEFAULT_FORMATtENCODINGR�R�R�R�tclassmethodRR�tstaticmethodR�RR�RR&R(R'R-R)R*R,R?R>R@R1R<R0R.RQRRSRURWRYR[R\R](((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�s`							
		1	
3?	
				f																c
Bs-eZdZdZeZeZdZeZ	e
Zd1Z
eZeZd1dd1d1d1d1d1d1dd1d1d1d�Zed1dd1ed��Zedd1d��Zedd1dd	��Zedd1dd
��Zidd6d
d6dd6Zd�Zd�Zd�Zd�Zd1d1d1d�Zed�Z d1ed1d1d�Z!d1d�Z"dd1d�Z#ded�Z$d�Z%ed�Z&d�Z'd �Z(d!�Z)d"�Z*d#�Z+d$�Z,d%�Z-d&�Z.d'�Z/d(�Z0d1ed)�Z1d*�Z2d1d+�Z3d,�Z4d-�Z5d.�Z6d/�Z7d0�Z8RS(2s=The TarFile Class provides an interface to tar archives.
    iiR[R�c
Cs�t|�dks|dkr-td��n||_idd6dd6dd	6||_|s�|jdkr�tjj|�r�d	|_d|_nt||j�}t|_	nN|d
kr�t|d
�r�|j}nt|d�r�|j|_nt
|_	|rtjj|�nd
|_||_|d
k	rC||_n|d
k	r[||_n|d
k	rs||_n|d
k	r�||_n|d
k	r�||_n|	|_|
d
k	r�|jtkr�|
|_n	i|_|d
k	r�||_n|d
k	r||_nt|_g|_t|_|jj�|_i|_y9|jdkrod
|_ |j!�|_ n|jdkrx�t
r|jj"|j�y&|jj#|�}|jj$|�Wq�t%k
r�|jj"|j�Pq�t&k
r}
t't(|
���q�Xq�Wn|jdkrzt
|_|jrz|jj)|jj*��}|jj+|�|jt|�7_qznWn,|j	s�|jj,�nt
|_�nXd
S(s�Open an (uncompressed) tar archive `name'. `mode' is either 'r' to
           read from an existing archive, 'a' to append data to an existing
           file or 'w' to create a new file overwriting an existing one. `mode'
           defaults to 'r'.
           If `fileobj' is given, it is used for reading or writing data. If it
           can be determined, `mode' is overridden by `fileobj's mode.
           `fileobj' is not closed, when TarFile is closed.
        iR�smode must be 'r', 'a' or 'w'trbR[sr+btatwbR\R�RctawN(-R"R1Rct_modeRwRtexistst	bltn_openR�R�RKR|R�RLtabspathR�R@R�tdereferencetignore_zerosR&R'R�R�tdebugt
errorlevelR�tmemberst_loadedR�R�tinodestfirstmemberR2R�R(RaRsRpRmRRRRNR�(RR�RcR�R@R�RlRmR&R'R�RnRoteRG((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�Fs�	""		!									
				c
	Ks4|r|rtd��n|dkr�x�|jD]�}t||j|�}|dk	rj|j�}ny||d||�SWq3ttfk
r�}	|dk	r3|j|�q3q3q3Xq3Wtd��nUd|krV|jdd�\}
}|
p�d}
|pd}||jkr3t||j|�}ntd|��|||
||�Sd	|kr|jd	d�\}
}|
p�d}
|p�d}|
d
kr�td��nt	||
|||�}y|||
||�}Wn|j
��nXt|_|S|dkr$|j
||||�Std
��dS(s|Open a tar archive for reading, writing or appending. Return
           an appropriate TarFile class.

           mode:
           'r' or 'r:*' open for reading with transparent compression
           'r:'         open for reading exclusively uncompressed
           'r:gz'       open for reading with gzip compression
           'r:bz2'      open for reading with bzip2 compression
           'a' or 'a:'  open for appending, creating the file if necessary
           'w' or 'w:'  open for writing without compression
           'w:gz'       open for writing with gzip compression
           'w:bz2'      open for writing with bzip2 compression

           'r|*'        open a stream of tar blocks with transparent compression
           'r|'         open an uncompressed stream of tar blocks for reading
           'r|gz'       open a gzip compressed stream of tar blocks
           'r|bz2'      open a bzip2 compressed stream of tar blocks
           'w|'         open an uncompressed stream for writing
           'w|gz'       open a gzip compressed stream for writing
           'w|bz2'      open a bzip2 compressed stream for writing
        snothing to openR[sr:*s%file could not be opened successfullyt:iR�sunknown compression type %rt|trwsmode must be 'r' or 'w'Rgsundiscernible modeN(R[sr:*(R1t	OPEN_METHR�RKR�RmRnR�RGR�R�R�R�ttaropen(
RR�RcR�R�tkwargsR�tfunct	saved_posRtRhtstreamR]((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR}�sN
	cKs@t|�dks|dkr-td��n|||||�S(sCOpen uncompressed tar archive name for reading or writing.
        iR�smode must be 'r', 'a' or 'w'(R"R1(RR�RcR�Rz((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRy�si	c	Ks6t|�dks|dkr-td��nyddl}|jWn#ttfk
ritd��nX|dk	}y8|j||d||�}|j||||�}Wnxt	k
r�|r�|dk	r�|j
�n|dkr��ntd��n*|r"|dk	r"|j
�n�nX||_|S(	skOpen gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        iRwsmode must be 'r' or 'w'i����Nsgzip module is not availableRVsnot a gzip file(
R"R1tgziptGzipFileR�tAttributeErrorRnRKRyRPR�RmR�(	RR�RcR�t
compresslevelRzR~t
extfileobjR]((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytgzopens.


	cKs�t|�dks|dkr-td��nyddl}Wntk
r\td��nX|dk	r{t||�}n|j||d|�}y|j||||�}Wn-t	t
fk
r�|j�td��nXt
|_|S(	slOpen bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
        iRwsmode must be 'r' or 'w'.i����Nsbz2 module is not availableR�snot a bzip2 file(R"R1R�R�RnRKR�tBZ2FileRyRPtEOFErrorR�RmR�R�(RR�RcR�R�RzR�R]((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytbz2open$s 

	RyR�R�R�R�R�cCs�|jr
dS|jdkr�|jjttd�|jtd7_t|jt�\}}|dkr�|jjtt|�q�n|j	s�|jj
�nt|_dS(slClose the TarFile. In write-mode, two finishing zero blocks are
           appended to the archive.
        NRgii(R�RcR�RNR#R�R�ROt
RECORDSIZER�R�RL(RRTRU((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�Hs		cCs2|j|�}|dkr.td|��n|S(sReturn a TarInfo object for member `name'. If `name' can not be
           found in the archive, KeyError is raised. If a member occurs more
           than once in the archive, its last occurrence is assumed to be the
           most up-to-date version.
        sfilename %r not foundN(t
_getmemberRKtKeyError(RR�R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt	getmember\scCs'|j�|js |j�n|jS(s�Return the members of the archive as a list of TarInfo objects. The
           list has the same order as the members in the archive.
        (t_checkRqt_loadRp(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt
getmembersgs
	
cCs g|j�D]}|j^q
S(s�Return the members of the archive as a list of their names. It has
           the same order as the list returned by getmembers().
        (R�R�(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pytgetnamesqsc	Cs\|jd�|d	k	r%|j}n|d	kr:|}ntjj|�\}}|jtjd�}|jd�}|j	�}||_
|d	kr�ttd�r�|jr�tj
|�}q�tj|�}ntj|j��}d}|j}tj|�r�|j|jf}	|jrj|jdkrj|	|jkrj||j|	krjt}
|j|	}qt}
|	dr||j|	<qn�tj|�r�t}
nstj|�r�t}
n[tj|�r�t}
tj|�}n4tj |�r�t!}
ntj"|�rt#}
nd	S||_||_$|j%|_&|j'|_(|
tkr]|j)|_*n	d|_*|j+|_,|
|_-||_.t/r�yt/j0|j&�d|_1Wq�t2k
r�q�Xnt3r�yt3j4|j(�d|_5Wq�t2k
r�q�Xn|
t!t#fkrXttd�rXttd�rXtj6|j7�|_8tj9|j7�|_:qXn|S(
sOCreate a TarInfo object for either the file `name' or the file
           object `fileobj' (using os.fstat on its file descriptor). You can
           modify some of the TarInfo's attributes before you add it using
           addfile(). If given, `arcname' specifies an alternative name for the
           file in the archive.
        RgR�tlstatR_iitmajortminorN(;R�RKR�RwRt
splitdriveR�tseptlstripR�R�R|RlR�tstattfstattfilenotst_modetS_ISREGtst_inotst_devtst_nlinkRrRTR�tS_ISDIRR�tS_ISFIFORZtS_ISLNKRRtreadlinktS_ISCHRRVtS_ISBLKRXRctst_uidRtst_gidRtst_sizeRtst_mtimeRR�R�tpwdtgetpwuidRR�tgrptgetgrgidRR�tst_rdevR�R�R�(RR�tarcnameR�tdrvR�tstatresR�tstmdtinodeR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt
gettarinfows~
			"
									

c	Csp|j�x_|D]W}|r�tt|j�dd�td|jpK|j|jpZ|jfdd�|j�s�|j	�r�tdd|j
|jfdd�ntd|jdd�tdt
j|j�d dd�nt|j|j�rd	nd
dd�|ra|j�r9td|jdd�n|j�ratd|jdd�qant�qWd
S(s�Print a table of contents to sys.stdout. If `verbose' is False, only
           the names of the members are printed. If it is True, an `ls -l'-like
           output is produced.
        R;Rs%s/%ss%10ss%d,%ds%10ds%d-%02d-%02d %02d:%02d:%02diR�R_s->slink toN(R�tprintRhRcRRRRRWRYR�R�RR�t	localtimeRR�RRSR�RU(RtverboseR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyRC�s&

	!)c		Cs�|jd�|dkr"|}n|dk	rtddl}|jdtd�||�rt|jdd|�dSn|jdk	r�tjj	|�|jkr�|jdd|�dS|jd|�|j
||�}|dkr�|jdd	|�dS|dk	r;||�}|dkr;|jdd|�dSn|j�rst|d
�}|j
||�|j�n�|j�r�|j
|�|r�xTtj|�D]@}|jtjj||�tjj||�||d|�q�Wq�n
|j
|�dS(s~Add the file `name' to the archive. `name' may be any type of file
           (directory, fifo, symbolic link, etc.). If given, `arcname'
           specifies an alternative name for the file in the archive.
           Directories are added recursively by default. This can be avoided by
           setting `recursive' to False. `exclude' is a function that should
           return True for each filename to be excluded. `filter' is a function
           that expects a TarInfo object argument and returns the changed
           TarInfo object, if it returns None the TarInfo object will be
           excluded from the archive.
        Rgi����Nsuse the filter argument insteadistarfile: Excluded %rstarfile: Skipped %ristarfile: Unsupported type %rRdtfilter(R�RKtwarningstwarntDeprecationWarningt_dbgR�RwRRkR�R.RjtaddfileR�RtlistdirtaddRb(	RR�R�t	recursivetexcludeR�R�R�tf((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��sD
		
*

*cCs�|jd�tj|�}|j|j|j|j�}|jj|�|jt	|�7_|dk	r�t||j|j�t
|jt�\}}|dkr�|jjtt|�|d7}n|j|t7_n|jj|�dS(s]Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
           given, tarinfo.size bytes are read from it and added to the archive.
           You can create TarInfo objects using gettarinfo().
           On Windows platforms, `fileobj' should always be opened with mode
           'rb' to avoid irritation about the file size.
        RgiiN(R�RR�R@R&R'R�RNR�R"RKRWRROR�R#RpRa(RR�R�RGRTRU((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�4s

t.cCs:g}|dkr|}nx_|D]W}|j�r\|j|�tj|�}d|_n|j||d|j��q"W|jdd��|j�x�|D]�}tj	j
||j�}y4|j||�|j
||�|j||�Wq�tk
r1}|jdkr�q2|jdd|�q�Xq�WdS(sMExtract all members from the archive to the current working
           directory and set owner, modification time and permissions on
           directories afterwards. `path' specifies a different directory
           to extract to. `members' is optional and must be a subset of the
           list returned by getmembers().
        i�t	set_attrstkeycSs|jS(N(R�(Re((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt<lambda>dsistarfile: %sN(RKRRaRRctextracttsorttreverseRwRRbR�tchowntutimetchmodRlRoR�(RRRptdirectoriesR�tdirpathRt((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt
extractallNs*	

!

R_cCs=|jd�t|t�r.|j|�}n|}|j�r^tjj||j�|_	ny,|j
|tjj||j�d|�Wn�tk
r�}|j
dkr��q9|jdkr�|jdd|j�q9|jdd|j|jf�n<tk
r8}|j
dkr!�q9|jdd|�nXdS(sxExtract a member from the archive to the current working directory,
           using its full name. Its file information is extracted as accurately
           as possible. `member' may be a filename or a TarInfo object. You can
           specify a different directory using `path'. File attributes (owner,
           mtime, mode) are set unless `set_attrs' is False.
        R[R�iistarfile: %sstarfile: %s %rN(R�RRR�RURwRRbR�R�t_extract_memberR�tEnvironmentErrorRotfilenameRKR�tstrerrorRl(RtmemberRR�R�Rt((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�ts&
!#cCs�|jd�t|t�r.|j|�}n|}|j�rP|j||�S|jtkro|j||�S|j�s�|j	�r�t|j
t�r�td��q�|j
|j|��SndSdS(s�Extract a member from the archive as a file object. `member' may be
           a filename or a TarInfo object. If `member' is a regular file, a
           file-like object is returned. If `member' is a link, a file-like
           object is constructed from the link's target. If `member' is none of
           the above, None is returned.
           The file-like object is read-only and provides the following
           methods: read(), readline(), readlines(), seek() and tell()
        R[s'cannot extract (sym)link as file objectN(R�RRR�R.t
fileobjectR�R/RURSR�R�Rotextractfilet_find_link_targetRK(RR�R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s	
cCs�|jd�}|jdtj�}tjj|�}|r_tjj|�r_tj|�n|j�sw|j	�r�|j
dd|j|jf�n|j
d|j�|j
�r�|j||�n�|j�r�|j||�n�|j�r
|j||�n�|j�s"|j�r5|j||�n]|j�sM|j	�r`|j||�n2|jtkr�|j||�n|j||�|r�|j||�|j	�s�|j||�|j||�q�ndS(s\Extract the TarInfo object tarinfo to a physical
           file called targetpath.
        R�is%s -> %sN(RR�RwR�RtdirnameRitmakedirsRURSR�R�R�R.tmakefileRtmakedirR[tmakefifoRWRYtmakedevtmakelinkR�R/tmakeunknownR�R�R�(RR�t
targetpathR�t	upperdirs((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s4#cCsFytj|d�Wn+tk
rA}|jtjkrB�qBnXdS(s,Make a directory called targetpath.
        i�N(RwtmkdirR�terrnotEEXIST(RR�R�Rt((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s
cCs�|j}|j|j�t|d�}|jdk	rqxJ|jD])\}}|j|�t|||�qAWnt|||j�|j|j�|j�|j	�dS(s'Make a file called targetpath.
        RfN(
R�R�R�RjR�RKRWRttruncateR�(RR�R�tsourcettargetR�R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��s	

cCs+|j||�|jdd|j�dS(sYMake a file from a TarInfo object with an unknown type
           at targetpath.
        is9tarfile: Unknown file type %r, extracted as regular file.N(R�R�R�(RR�R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�	scCs/ttd�rtj|�ntd��dS(s'Make a fifo called targetpath.
        tmkfifosfifo not supported by systemN(R|RwR�Rl(RR�R�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�	scCs�ttd�s ttd�r/td��n|j}|j�rT|tjO}n
|tjO}tj||tj	|j
|j��dS(s<Make a character or block device called targetpath.
        tmknodR�s'special devices not supported by systemN(R|RwRlRcRYR�tS_IFBLKtS_IFCHRR�R�R�R�(RR�R�Rc((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�	s 	
cCs�yj|j�r%tj|j|�nDtjj|j�rPtj|j|�n|j|j	|�|�WnPt
k
r�|j�r�tjjtjj|j
�|j�}q�|j}n>Xy|j|j	|�|�Wntk
r�td��nXdS(s�Make a (symbolic) link called targetpath. If it cannot be created
          (platform limitation), we try to make a copy of the referenced file
          instead of a link.
        s%unable to resolve link inside archiveN(RSRwtsymlinkR�RRiR�tlinkR�R�tsymlink_exceptionRbR�R�R�Rl(RR�R�R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�'	s"


cCstrttd�rtj�dkrytj|j�d}Wntk
r]|j}nXytj	|j
�d}Wntk
r�|j}nXyZ|j�r�ttd�r�tj
|||�n%tjdkr�tj|||�nWqtk
r}td��qXndS(s6Set owner of targetpath according to tarinfo.
        tgeteuidiitlchowntos2emxscould not change ownerN(R�R|RwR�R�tgetgrnamRR�RtgetpwnamRRRSR�tsystplatformR�R�Rl(RR�R�RtuRt((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�D	s '



cCsOttd�rKytj||j�WqKtk
rG}td��qKXndS(sASet file permissions of targetpath according to tarinfo.
        R�scould not change modeN(R|RwR�RcR�Rl(RR�R�Rt((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�Z	s
cCsYttd�sdSy tj||j|jf�Wntk
rT}td��nXdS(sBSet modification time of targetpath according to tarinfo.
        R�Ns"could not change modification time(R|RwR�RR�Rl(RR�R�Rt((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�c	s cCs�|jd�|jdk	r2|j}d|_|S|jj|j�d}xktr�y|jj|�}WnGt	k
r�}|j
r�|jdd|j|f�|jt7_qNq�n�t
k
r+}|j
r|jdd|j|f�|jt7_qNq�|jdkr�tt|���q�n�tk
rY|jdkr�td��q�n[tk
r�}|jdkr�tt|���q�n%tk
r�}tt|���nXPqNW|dk	r�|jj|�n	t|_|S(s�Return the next member of the archive as a TarInfo object, when
           TarFile is opened for reading. Return None if there is no more
           available.
        trais0x%X: %sis
empty fileN(R�RsRKR�R�R�RLR�R(RsRmR�R�R2RmRRqRrRtRpRaRq(RtmR�Rt((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR2n	sF
						
	cCs�|j�}|dk	r.||j|� }n|rItjj|�}nxKt|�D]=}|rztjj|j�}n	|j}||krV|SqVWdS(s}Find an archive member by name from bottom to top.
           If tarinfo is given, it is used as the starting point.
        N(R�RKtindexRwRtnormpathtreversedR�(RR�R�t	normalizeRpR�tmember_name((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��	s	cCs6x&tr(|j�}|dkrPqqWt|_dS(sWRead through the entire archive file and look for readable
           members.
        N(RLR2RKRq(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��	s
	cCsW|jr"td|jj��n|dk	rS|j|krStd|j��ndS(snCheck if TarFile is still open, and if the operation's mode
           corresponds to TarFile's mode.
        s%s is closedsbad operation for mode %rN(R�RPR�RiRKRc(RRc((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��	s	cCs�|j�r5tjj|j�d|j}d}n|j}|}|j|d|dt�}|dkr~t	d|��n|S(sZFind the target member of a symlink or hardlink member in the
           archive.
        R�R�R�slinkname %r not foundN(
RSRwRR�R�R�RKR�RLR�(RR�R�tlimitR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��	s 		cCs$|jrt|j�St|�SdS(s$Provide an iterator object.
        N(RqtiterRptTarIter(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��	s	
cCs)||jkr%t|dtj�ndS(s.Write debugging output to sys.stderr.
        tfileN(RnR�R�tstderr(Rtleveltmsg((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��	scCs|j�|S(N(R�(R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt	__enter__�	s
cCs?|dkr|j�n"|js2|jj�nt|_dS(N(RKR�R�R�RLR�(RR�Rt	traceback((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__exit__�	s

	N(9RiRjRkRnR�RlRmRoR`R@RaR&RKR'RR�R�R�R�RbR�R}RyR�R�RxR�R�R�R�R�RLRCR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R2R�R�R�R�R�R�RR(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR,sniK
			
	b>&#	&0											1	
					R�cBs/eZdZd�Zd�Zd�ZeZRS(sMIterator Class.

       for tarinfo in TarFile(...):
           suite...
    cCs||_d|_dS(s$Construct a TarIter object.
        iN(R�R�(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�
s	cCs|S(s Return iterator object.
        ((R((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR�
scCs}|jjs9|jj�}|sjt|j_t�qjn1y|jj|j}Wntk
rit�nX|jd7_|S(s�Return the next item using TarFile's next() method.
           When all members have been read, set TarFile as _loaded.
        i(R�RqR2RLt
StopIterationRpR�t
IndexError(RR�((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt__next__

s

(RiRjRkR�R�RR2(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR��	s
			cCs7yt|�}|j�tSWntk
r2tSXdS(sfReturn True if name points to a tar archive that we
       are able to handle, else return False.
    N(R}R�RLRR�(R�R]((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyR#
s

(xt
__future__Rt__version__tversiont
__author__t__date__t	__cvsid__t__credits__R�RwR�R�R�R:RR5R�R�R�RKR�tNotImplementedErrorR�tWindowsErrort	NameErrort__all__tversion_infot__builtin__tbuiltinsR}t_openR#R�R�R�R�R�R�R
R�RRTRRRVRXR�RZtCONTTYPER�R�RRR
R+R�R9R�R`R/RPR RKtsetR=RR0RLtS_IFLNKtS_IFREGR�tS_IFDIRR�tS_IFIFOtTSUIDtTSGIDtTSVTXtTUREADtTUWRITEtTUEXECtTGREADtTGWRITEtTGEXECtTOREADtTOWRITEtTOEXECR�RatgetfilesystemencodingR(R,R7RARJRWR`Rht	ExceptionRRlRmRnRoRpRqRrRsR2RttobjectRuR�R�R�R�R�RRR�RRj(((sV/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/_backport/tarfile.pyt<module>s.

	
					
					
					
	
	
		�?K��������*	

Zerion Mini Shell 1.0