AlkantarClanX12

Your IP : 3.149.251.26


Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/tarfile.pyo

�
zfc
@sGdZdZdZdZdZdZdZddlmZ	dd	l
Z
dd	lZdd	lZdd	l
Z
dd	lZdd	lZdd	lZdd	lZdd	lZdd	lZydd	lZdd	lZWnek
r�eZZnXd
ddd
gZdZdZedZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,d Z-d!Z.d"Z/d#Z0d$Z1d%Z2e1Z3e!e"e#e$e'e(e)e%e&e*e+e,fZ4e!e"e)e,fZ5e*e+e,fZ6d&d'd(d)d*d+d,d-fZ7ie8d.6e8d/6e8d)6e9d*6e9d+6e9d(6Z:d0Z;d1Z<d2Z=d3Z>d4Z?d5Z@d6ZAd7ZBdZCd8ZDd9ZEd:ZFd;ZGd<ZHd=ZId>ZJd%ZKd$ZLe
jM�ZNeNekr�e
jO�ZNnd?�ZPd@�ZQdA�ZRd=e3dB�ZSdC�ZTdD�ZUedE�ZVe;dFfe<dGfe=dHfe>dIfe?dJfe@dKffeDdLffeEdMffeFeABdNfeAdfeFd ffeGdLffeHdMffeIeBBdNfeBdfeId ffeJdLffeKdMffeLeCBdOfeCdPfeLd fff
ZWdQ�ZXd
eYfdR��YZZdSeZfdT��YZ[dUeZfdV��YZ\dWeZfdX��YZ]dYeZfdZ��YZ^d[eZfd\��YZ_d]e_fd^��YZ`d_e_fd`��YZadae_fdb��YZbdce_fdd��YZcdee_fdf��YZddgfdh��YZedifdj��YZfdkegfdl��YZhdmegfdn��YZidoegfdp��YZjdqegfdr��YZkdegfds��YZld
egfdt��YZmdufdv��YZndwfdx��YZodyeofdz��YZpd{eofd|��YZqd}erfd~��YZsd#Ztd=Zudfd���YZvd��ZwemjZd	S(�s,Read from and write to tar format archives.
s$Revision: 85213 $s0.9.0s!Lars Gust�bel (lars@gustaebel.de)s$Date$s$Id$s3Gustavo Niemeyer, Niels Gust�bel, Richard Townsend.i����(topenNtTarFiletTarInfot
is_tarfiletTarErrorsiisustar  sustar00idi�t0t1t2t3t4t5t6t7tLtKtStxtgtXiiitpathtlinkpathtsizetmtimetuidtgidtunametgnametatimetctimei�i�i`i@i iiiii�i@i iiicCs|| |t|�tS(s@Convert a python string to a null-terminated string buffer.
    (tlentNUL(tstlength((s/usr/lib64/python2.7/tarfile.pytstn�scCs'|jd�}|dkr|S|| S(s?Convert a null-terminated string field to a python string.
    si����(tfind(Rtp((s/usr/lib64/python2.7/tarfile.pytnts�scCs�|dtd�kr^y%tt|�j�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�Risinvalid headerli(	tchrtintR$tstript
ValueErrortInvalidHeaderErrortxrangeRtord(Rtnti((s/usr/lib64/python2.7/tarfile.pytnti�s%

cCs�d|kod|dknr?d|d|ft}n�|tks_|d|dkrntd��n|dkr�tjdtjd|��d}nd	}x6t|d�D]$}t|d
@�|}|dL}q�Wtd�|}|S(s/Convert a python number to a number field.
    iiis%0*oisoverflow in number fieldR
tlti�i�(Rt
GNU_FORMATR(tstructtunpacktpackR*R%(R,tdigitstformatRR-((s/usr/lib64/python2.7/tarfile.pytitn�s	$ %cCs�|dkr�y|j|d�SWq�tk
r�g}xU|D]M}y|j|j|d��Wq=tk
r�|j|jd��q=Xq=Wdj|�SXn|j||�SdS(s*Convert a unicode object to a string.
    sutf-8tstricttutf8R0N(tencodetUnicodeEncodeErrortappendtjoin(RtencodingterrorsRtc((s/usr/lib64/python2.7/tarfile.pytuts�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(tsumR2R3(tbuftunsigned_chksumt
signed_chksum((s/usr/lib64/python2.7/tarfile.pytcalc_chksums�s	77cCs�|dkrdS|dkr0tj||�dSd}t||�\}}xQt|�D]C}|j|�}t|�|kr�td��n|j|�qXW|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@(	tNonetshutiltcopyfileobjtdivmodR*treadRtIOErrortwrite(tsrctdstR tBUFSIZEtblockst	remaindertbRG((s/usr/lib64/python2.7/tarfile.pyRMs$R/t-RWtdR@R#trtwRtttTcCsig}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()
    RXR0(tfilemode_tableR<R=(tmodetpermttabletbittchar((s/usr/lib64/python2.7/tarfile.pytfilemode7s

cBseZdZRS(sBase exception.(t__name__t
__module__t__doc__(((s/usr/lib64/python2.7/tarfile.pyRFstExtractErrorcBseZdZRS(s%General exception for extract errors.(ReRfRg(((s/usr/lib64/python2.7/tarfile.pyRhIst	ReadErrorcBseZdZRS(s&Exception for unreadable tar archives.(ReRfRg(((s/usr/lib64/python2.7/tarfile.pyRiLstCompressionErrorcBseZdZRS(s.Exception for unavailable compression methods.(ReRfRg(((s/usr/lib64/python2.7/tarfile.pyRjOstStreamErrorcBseZdZRS(s=Exception for unsupported operations on stream-like TarFiles.(ReRfRg(((s/usr/lib64/python2.7/tarfile.pyRkRstHeaderErrorcBseZdZRS(s!Base exception for header errors.(ReRfRg(((s/usr/lib64/python2.7/tarfile.pyRlUstEmptyHeaderErrorcBseZdZRS(sException for empty headers.(ReRfRg(((s/usr/lib64/python2.7/tarfile.pyRmXstTruncatedHeaderErrorcBseZdZRS(s Exception for truncated headers.(ReRfRg(((s/usr/lib64/python2.7/tarfile.pyRn[stEOFHeaderErrorcBseZdZRS(s"Exception for end of file headers.(ReRfRg(((s/usr/lib64/python2.7/tarfile.pyRo^sR)cBseZdZRS(sException for invalid headers.(ReRfRg(((s/usr/lib64/python2.7/tarfile.pyR)astSubsequentHeaderErrorcBseZdZRS(s3Exception for missing and invalid extended headers.(ReRfRg(((s/usr/lib64/python2.7/tarfile.pyRpdst
_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(NRZR[tO_BINARYi�(	tostO_RDONLYtO_WRONLYtO_CREATtO_TRUNCthasattrRrRtfd(tselftnameR_((s/usr/lib64/python2.7/tarfile.pyt__init__qs
cCstj|j�dS(N(RstcloseRy(Rz((s/usr/lib64/python2.7/tarfile.pyR}zscCstj|j|�S(N(RsRORy(RzR((s/usr/lib64/python2.7/tarfile.pyRO}scCstj|j|�dS(N(RsRQRy(RzR((s/usr/lib64/python2.7/tarfile.pyRQ�s(ReRfRgR|R}RORQ(((s/usr/lib64/python2.7/tarfile.pyRqks
				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�d@|_|d	kr|j�q�|j�nu|d
kr�yddl}Wntk
rdtd��nX|d	kr�d|_|j�|_q�|j�|_nWn,|js�|j
j�nt|_�nXdS(s$Construct a _Stream object.
        t*R0ltgzi����Nszlib module is not availablel��RZtbz2sbz2 module is not available(tTruet_extfileobjRKRqtFalset_StreamProxytgetcomptypeR{R_tcomptypetfileobjtbufsizeRGtpostclosedtzlibtImportErrorRjtcrc32tcrct
_init_read_gzt_init_write_gzR�tdbuftBZ2Decompressortcmpt
BZ2CompressorR}(RzR{R_R�R�R�R�R�((s/usr/lib64/python2.7/tarfile.pyR|�sP								
	


			cCs*t|d�r&|jr&|j�ndS(NR�(RxR�R}(Rz((s/usr/lib64/python2.7/tarfile.pyt__del__�scCs�|jjd|jj|jj|jjd�|_tjdtt	j	���}|j
d|�t|j�t
kr�|jjdd�|_n|jjd�r�|jd |_n|j
|jt�d	S(
s6Initialize for writing with gzip compression.
        i	is<Ls�%s�s
iso-8859-1treplaces.gzi����N(R�tcompressobjtDEFLATEDt	MAX_WBITSt
DEF_MEM_LEVELR�R2R4tlongttimet_Stream__writettypeR{tunicodeR:tendswithR(Rzt	timestamp((s/usr/lib64/python2.7/tarfile.pyR��s
	cCs{|jdkr1|jj||j�d@|_n|jt|�7_|jdkrj|jj|�}n|j|�dS(s&Write string s to the stream.
        R�l��ttarN(	R�R�R�R�R�RR�tcompressR�(RzR((s/usr/lib64/python2.7/tarfile.pyRQ�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(RGRR�R�RQ(RzR((s/usr/lib64/python2.7/tarfile.pyt__write�scCs|jr
dSt|_z�|jdkrR|jdkrR|j|jj�7_n|jdkr�|jr�|jj|j�d|_|jdkr�|jjt	j
d|jd@��|jjt	j
d|jd@��q�nWd|j
s�|jj�nXdS(s[Close the _Stream object. No operation should be
           done on it afterwards.
        NR[R�R0R�s<Ll��(R�R�R_R�RGR�tflushR�RQR2R4R�R�R�R}(Rz((s/usr/lib64/python2.7/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.
        R0is�snot a gzip fileissunsupported compression methodiiiiiN(R�t
decompressobjR�R�R�t
_Stream__readRiRjR+ROR�R(RztflagtxlenR((s/usr/lib64/python2.7/tarfile.pyR�s.	

,
	
	
cCs|jS(s3Return the stream's file pointer position.
        (R�(Rz((s/usr/lib64/python2.7/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�RNR�R*RORk(RzR�RURVR-((s/usr/lib64/python2.7/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.
        R0N(RKR�t_readR�R<R=R�R(RzRR\RG((s/usr/lib64/python2.7/tarfile.pyRO5s	cCs�|jdkr|j|�St|j�}|jg}x||kr�|j|j�}|sbPny|jj|�}Wntk
r�td��nX|j	|�|t|�7}q:Wdj
|�}|||_|| S(s+Return size bytes from the stream.
        R�sinvalid compressed dataR0(R�R�RR�R�R�t
decompressRPRiR<R=(RzRR@R\RG((s/usr/lib64/python2.7/tarfile.pyR�Gs"



cCs�t|j�}|jg}xL||kri|jj|j�}|sIPn|j|�|t|�7}qWdj|�}|||_|| S(ssReturn size bytes from stream. If internal buffer is empty,
           read another block from the stream.
        R0(RRGR�ROR�R<R=(RzRR@R\RG((s/usr/lib64/python2.7/tarfile.pyt__read]s

N(ReRfRgR|R�R�RQR�R}R�R�R�RKROR�R�(((s/usr/lib64/python2.7/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�ROt	BLOCKSIZERG(RzR�((s/usr/lib64/python2.7/tarfile.pyR|ss	cCs|jj|_|jS(N(R�RORG(RzR((s/usr/lib64/python2.7/tarfile.pyROwscCsJ|jjd�rdS|jdd!dkrF|jdd!dkrFd	Sd
S(Ns�R�iitBZhii
s1AY&SYR�R�(RGt
startswith(Rz((s/usr/lib64/python2.7/tarfile.pyR�{s
,cCs|jj�dS(N(R�R}(Rz((s/usr/lib64/python2.7/tarfile.pyR}�s(ReRfRgR|ROR�R}(((s/usr/lib64/python2.7/tarfile.pyR�ns
			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�R_tgetattrRKR{tinit(RzR�R_((s/usr/lib64/python2.7/tarfile.pyR|�s		cCsbddl}d|_|jdkrO|j�|_|jjd�d|_n|j�|_dS(Ni����iRZR0(	R�R�R_R�tbz2objR�R�RGR�(RzR�((s/usr/lib64/python2.7/tarfile.pyR��s	cCs�|jg}t|j�}x^||kr{|jj|j�}|sIPn|jj|�}|j|�|t|�7}qWdj|�|_|j| }|j||_|j	t|�7_	|S(NR0(
RGRR�ROt	blocksizeR�R�R<R=R�(RzRRWRtrawtdataRG((s/usr/lib64/python2.7/tarfile.pyRO�s

cCs4||jkr|j�n|j||j�dS(N(R�R�RO(RzR�((s/usr/lib64/python2.7/tarfile.pyR��s
cCs|jS(N(R�(Rz((s/usr/lib64/python2.7/tarfile.pyR��scCs;|jt|�7_|jj|�}|jj|�dS(N(R�RR�R�R�RQ(RzR�R�((s/usr/lib64/python2.7/tarfile.pyRQ�scCs5|jdkr1|jj�}|jj|�ndS(NR[(R_R�R�R�RQ(RzR�((s/usr/lib64/python2.7/tarfile.pyR}�si@(ReRfRgR�R|R�ROR�R�RQR}(((s/usr/lib64/python2.7/tarfile.pyR��s		
				t_FileInFilecBs\eZdZd	d�Zd�Zd�Zd	d�Zd�Zd�Z	d�Z
d�ZRS(
sA thin wrapper around an existing file object that
       provides a part of its data as an individual file
       object.
    cCs1||_||_||_||_d|_dS(Ni(R�toffsetRtsparsetposition(RzR�R�RR�((s/usr/lib64/python2.7/tarfile.pyR|�s
				cCs|jS(s*Return the current file position.
        (R�(Rz((s/usr/lib64/python2.7/tarfile.pyR��scCs
||_dS(s(Seek to a position in the file.
        N(R�(RzR�((s/usr/lib64/python2.7/tarfile.pyR��scCse|dkr|j|j}nt||j|j�}|jdkrT|j|�S|j|�SdS(s!Read data from the file.
        N(RKRR�tminR�t
readnormalt
readsparse(RzR((s/usr/lib64/python2.7/tarfile.pyRO�s
cCs7|jj|�}t|�|kr3td��n|S(Nsunexpected end of data(R�RORRi(RzRRG((s/usr/lib64/python2.7/tarfile.pyR��scCs6|jj|j|j�|j|7_|j|�S(s*Read operation for regular files.
        (R�R�R�R�t_FileInFile__read(RzR((s/usr/lib64/python2.7/tarfile.pyR��scCs\g}xF|dkrN|j|�}|s.Pn|t|�8}|j|�q	Wdj|�S(s)Read operation for sparse files.
        iR0(treadsparsesectionRR<R=(RzRR�RG((s/usr/lib64/python2.7/tarfile.pyR��scCs�|jj|j�}|dkr%dSt||j|j|j�}t|t�r�|j	|j|j}|j
j|j|�|j|7_|j|�S|j|7_t
|SdS(s0Read a single section of a sparse file.
        R0N(R�R"R�RKR�R�Rt
isinstancet_datatrealposR�R�R�R(RzRtsectionR�((s/usr/lib64/python2.7/tarfile.pyR�s 
N(ReRfRgRKR|R�R�ROR�R�R�R�(((s/usr/lib64/python2.7/tarfile.pyR��s		
			tExFileObjectcBsheZdZdZd�Zdd�Zdd�Zd�Zd�Z	e
jd�Zd	�Z
d
�ZRS(saFile-like object for reading an archive member.
       Is returned by TarFile.extractfile().
    icCsmt|j|j|jt|dd��|_|j|_d|_t|_	|j|_d|_
d|_dS(NR�RZiR0(R�R�toffset_dataRR�RKR{R_R�R�R�tbuffer(Rzttarfilettarinfo((s/usr/lib64/python2.7/tarfile.pyR|s				cCs�|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 fileR0N(R�R(R�RKR�RORR�(RzRRG((s/usr/lib64/python2.7/tarfile.pyRO,s			
 i����cCs,|jrtd��nd|jkr@|jjd�d}n�|jg}x�tr�|jj|j�}|j|�|s�d|krOdj	|�|_|jjd�d}|dkr�t
|j�}nPqOqOW|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
iR0ii����(
R�R(R�R"R�R�ROR�R<R=RR�R�(RzRR�tbuffersRG((s/usr/lib64/python2.7/tarfile.pytreadlineDs(		

cCs:g}x-tr5|j�}|s%Pn|j|�q	W|S(s0Return a list with all remaining lines.
        (R�R�R<(Rztresulttline((s/usr/lib64/python2.7/tarfile.pyt	readlinescs	cCs|jrtd��n|jS(s*Return the current file position.
        sI/O operation on closed file(R�R(R�(Rz((s/usr/lib64/python2.7/tarfile.pyR�ms	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 argumentR0N(
R�R(RstSEEK_SETR�tmaxRR�tSEEK_CURtSEEK_ENDR�R�R�(RzR�twhence((s/usr/lib64/python2.7/tarfile.pyR�us	!(	cCs
t|_dS(sClose the file object.
        N(R�R�(Rz((s/usr/lib64/python2.7/tarfile.pyR}�sccs,x%tr'|j�}|sPn|VqWdS(s/Get an iterator over the file's lines.
        N(R�R�(RzR�((s/usr/lib64/python2.7/tarfile.pyt__iter__�s
	N(ReRfRgR�R|RKROR�R�R�RsR�R�R}R�(((s/usr/lib64/python2.7/tarfile.pyR�s	
	
		cBs�eZdZdd�Zd�Zd�Zeee�Zd�Zd�Z	eee	�Z
d�Zd�Ze
ed	d
�Zd�Zd�Zd
�Zed��Zd�Zed��Zed��Zed��Zeed��Zed��Zed��Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd �Z(d!�Z)d"�Z*d#�Z+d$�Z,d%�Z-d&�Z.RS('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.
    R0cCs�||_d|_d|_d|_d|_d|_d|_t|_d|_	d|_
d|_d|_d|_
d|_d|_i|_dS(sXConstruct a TarInfo object. name is the optional name
           of the member.
        i�iR0N(R{R_RRRRtchksumtREGTYPER�tlinknameRRtdevmajortdevminorR�R�tpax_headers(RzR{((s/usr/lib64/python2.7/tarfile.pyR|�s 															cCs|jS(N(R{(Rz((s/usr/lib64/python2.7/tarfile.pyt_getpath�scCs
||_dS(N(R{(RzR{((s/usr/lib64/python2.7/tarfile.pyt_setpath�scCs|jS(N(R�(Rz((s/usr/lib64/python2.7/tarfile.pyt_getlinkpath�scCs
||_dS(N(R�(RzR�((s/usr/lib64/python2.7/tarfile.pyt_setlinkpath�scCs d|jj|jt|�fS(Ns<%s %r at %#x>(t	__class__ReR{tid(Rz((s/usr/lib64/python2.7/tarfile.pyt__repr__�scCsi
|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<nxAdD]9}t||�tkr�||j||�||<q�q�W|S(s9Return the TarInfo's attributes as a dictionary.
        R{i�R_RRRRR�R�R�RRR�R�t/(R{R�RR(R{R_RRRRR�R�R�RRR�R�tDIRTYPER�R�R:(RzR>R?tinfotkey((s/usr/lib64/python2.7/tarfile.pytget_info�s(











$
!R8cCss|j||�}|tkr+|j|�S|tkrD|j|�S|tkrc|j|||�Std��dS(s<Return a tar header as a string of 512 byte blocks.
        sinvalid formatN(R�tUSTAR_FORMATtcreate_ustar_headerR1tcreate_gnu_headert
PAX_FORMATtcreate_pax_headerR((RzR6R>R?R�((s/usr/lib64/python2.7/tarfile.pyttobuf�s

cCsyt|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_MAGICRtLENGTH_LINKR(tLENGTH_NAMEt_posix_split_namet_create_headerR�(RzR�((s/usr/lib64/python2.7/tarfile.pyR��s
$cCs�t|d<d}t|d�tkrC||j|dt�7}nt|d�tkrv||j|dt�7}n||j|t�S(s:Return the object as a GNU header block sequence.
        R�R0R�R{(	t	GNU_MAGICRR�t_create_gnu_long_headertGNUTYPE_LONGLINKR�tGNUTYPE_LONGNAMER�R1(RzR�RG((s/usr/lib64/python2.7/tarfile.pyR�s
cCs�t|d<|jj�}x�ddtfddtfddfD]�\}}}||kr_q>n||j||�}y|jd	�Wntk
r�|||<q>nXt||�|kr>|||<q>q>Wx�ddddfD]�\}}	||kr	d||<q�n||}d|ko2d|	dknsGt	|t
�r�t|�||<d||<q�q�W|r�|j|�}
nd}
|
|j
|t�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 RtasciiRiRRiRiiR0(RRi (RRi (Ri(Ri(Ri(Ri(R�R�tcopyR�R�tdecodeR:R;RR�tfloatR�t_create_pax_generic_headerR�R�(RzR�R>R?R�R{thnameR tvalR5RG((s/usr/lib64/python2.7/tarfile.pyR�s6




4cCs|j|dt�S(sAReturn the object as a pax global header block sequence.
        R�(R�tXGLTYPE(tclsR�((s/usr/lib64/python2.7/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_PREFIXRR�R((RzR{R�((s/usr/lib64/python2.7/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�t|jdt�d�t|jdd�d�t|jdd�d�t|jdd�d|�t|jdd�d|�t|jdd�d�g}tjdtdj|��}t	|t�d}|d d||d}|S(s�Return a header block. info is a dictionary with file
           information, format must be one of the *_FORMAT constants.
        R{R0idR_ii�iRRRiRs        R�R�R�Ri RR�R�R�i�s%dsi����s%06oi����(
R!tgetR7R�R�R2R4R�R=RJ(R�R6tpartsRGR�((s/usr/lib64/python2.7/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(RNRR�R(tpayloadRURV((s/usr/lib64/python2.7/tarfile.pyt_create_payloaduscCs[|t7}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�(RRR�R�R�R(RR{R�R�((s/usr/lib64/python2.7/tarfile.pyR�s



c
Csg}x�|j�D]�\}}|jd�}|jd�}t|�t|�d}d}}x6tr�|tt|��}||kr�Pn|}qdW|jd|||f�qWdj|�}i}	d|	d<||	d<t|�|	d	<t|	d
<|j|	t	�|j
|�S(s�Return a POSIX.1-2001 extended or global header sequence
           that contains a list of keyword, value pairs. The values
           must be unicode objects.
        R9iis	%d %s=%s
R0s././@PaxHeaderR{R�RR�(t	iteritemsR:RR�tstrR<R=R�R�R�R(
RR�R�trecordstkeywordtvalueR/R,R#R�((s/usr/lib64/python2.7/tarfile.pyR��s(
	



cCsKt|�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�|jjd�r�t|_n|j�r|jjd�|_n|rG|jtkrG|d|j|_n|S(sBConstruct a TarInfo object from a 512 byte string buffer.
        isempty headerstruncated headersend of file headeri�i�sbad checksumidiliti|i�i�ii	i)iIiQiYi�R�(RRmR�RntcountRRoR.RJR)RGR$R{R_RRRRR�R�R�RRR�R�tAREGTYPER�R�tisdirtrstript	GNU_TYPES(RRGR�tobjR�((s/usr/lib64/python2.7/tarfile.pytfrombuf�s@			!cCsD|jjt�}|j|�}|jj�t|_|j|�S(sOReturn the next TarInfo object from TarFile object
           tarfile.
        (R�ROR�RR�R�t_proc_member(RR�RGR((s/usr/lib64/python2.7/tarfile.pytfromtarfile�scCst|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_gnulongtGNUTYPE_SPARSEt_proc_sparsetXHDTYPERtSOLARIS_XHDTYPEt	_proc_paxt
_proc_builtin(RzR�((s/usr/lib64/python2.7/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?(RzR�R�((s/usr/lib64/python2.7/tarfile.pyRs		cCs�|jj|j|j��}y|j|�}Wntk
rPtd��nX|j|_|jt	kr~t
|�|_n!|jtkr�t
|�|_
n|S(sSProcess the blocks that hold a GNU longname
           or longlink member.
        s missing or bad subsequent header(R�ROR RRRlRpR�R�R�R$R{R�R�(RzR�RGtnext((s/usr/lib64/python2.7/tarfile.pyRs
cCss|j}t�}d}d}d}x�td�D]�}y6t|||d!�}t||d|d!�}	Wntk
r�PnX||kr�|jt|||��n|jt||	|��||	7}||	}|d7}q1Wt|d�}
t|dd!�}x�|
d	kr|j	j
t�}d
}x�td�D]�}y6t|||d!�}t||d|d!�}	Wntk
r�PnX||kr�|jt|||��n|jt||	|��||	7}||	}|d7}q=Wt|d�}
qW||kr/|jt|||��n||_|j	j
�|_|j|j|j�|_||_|S(
s8Process a GNU sparse header plus extra headers.
        i�liiii�i�i�iiii�(RGt_ringbufferR*R.R(R<t_holeR�R+R�ROR�R�R�R�R RR�(RzR�RGtspR�tlastposR�R-R�tnumbytest
isextendedtorigsize((s/usr/lib64/python2.7/tarfile.pyR'sT		





		cCs�|jj|j|j��}|jtkr9|j}n|jj�}tj	dtj
�}d}x�tr!|j||�}|s�Pn|j
�\}}t|�}|dkr�td��n||jd�d|jd�|d!}	|jd�}|	jd�}	|	||<||7}qfWy|j|�}
Wntk
rTtd��nX|jttfkr�|
j||j|j�|j|
_d|kr�|
j}|
j�s�|
jtkr�||
j|
j�7}n||_q�n|
S(	sVProcess an extended or global header as described in
           POSIX.1-2001.
        s(\d+) ([^=]+)=isinvalid headeriiR9s missing or bad subsequent headerR(R�ROR RR�RR�R�tretcompiletUR�tmatchtgroupsR&R)tendtstartR�RRlRpRRR!R>R?R�R�RR(RzR�RGR�tregexR�R-R RR
R"R�((s/usr/lib64/python2.7/tarfile.pyR_s@	+

	cCs�x�|j�D]�\}}|tkr+q
n|dkrI|jd�}n|tkr�yt||�}Wq�tk
r�d}q�Xnt|||�}t|||�q
W|j�|_dS(soReplace fields with supplemental information from a previous
           pax extended or global header.
        RR�iN(	R	t
PAX_FIELDSRtPAX_NUMBER_FIELDSR(RAtsetattrR�R�(RzR�R>R?RR
((s/usr/lib64/python2.7/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(RNR�(RzRRURV((s/usr/lib64/python2.7/tarfile.pyR �s
cCs
|jtkS(N(R�t
REGULAR_TYPES(Rz((s/usr/lib64/python2.7/tarfile.pyR�scCs
|j�S(N(R(Rz((s/usr/lib64/python2.7/tarfile.pytisfile�scCs
|jtkS(N(R�R�(Rz((s/usr/lib64/python2.7/tarfile.pyR�scCs
|jtkS(N(R�tSYMTYPE(Rz((s/usr/lib64/python2.7/tarfile.pytissym�scCs
|jtkS(N(R�tLNKTYPE(Rz((s/usr/lib64/python2.7/tarfile.pytislnk�scCs
|jtkS(N(R�tCHRTYPE(Rz((s/usr/lib64/python2.7/tarfile.pytischr�scCs
|jtkS(N(R�tBLKTYPE(Rz((s/usr/lib64/python2.7/tarfile.pytisblk�scCs
|jtkS(N(R�tFIFOTYPE(Rz((s/usr/lib64/python2.7/tarfile.pytisfifo�scCs
|jtkS(N(R�R(Rz((s/usr/lib64/python2.7/tarfile.pytissparse�scCs|jtttfkS(N(R�R;R=R?(Rz((s/usr/lib64/python2.7/tarfile.pytisdev�s(/ReRfRgR|R�R�tpropertyRR�R�RR�R�tDEFAULT_FORMATtENCODINGR�R�R�R�tclassmethodRR�tstaticmethodR�RR�RR�RRRRRRRR!R RR6RR8R:R<R>R@RARB(((s/usr/lib64/python2.7/tarfile.pyR�sP							
		3	
.	
			8	<												c
BsHeZdZdZeZeZdZeZ	e
Zd2Z
eZeZd2dd2d2d2d2d2d2d2d2d2d2d�Zd�Zd�Zeee�Zed2dd2ed��Zedd2d��Zedd2d	d
��Zedd2d	d��Zidd
6dd6dd6Zd�Zd�Zd�Z d�Z!d2d2d2d�Z"e#d�Z$d2e#d2d2d�Z%d2d�Z&dd2d�Z'dd�Z(d�Z)d�Z*d �Z+d!�Z,d"�Z-d#�Z.d$�Z/d%�Z0d&�Z1d'�Z2d(�Z3d)�Z4d2ed*�Z5d+�Z6d2d,�Z7d-�Z8d.�Z9d/�Z:d0�Z;d1�Z<RS(3s=The TarFile Class provides an interface to tar archives.
    iiRZc
Cs�idd6dd6dd6}
||
kr6td��n||_|
||_|s�|jdkr�tjj|�r�d|_d|_nt||j�}t|_nN|d
kr�t
|d�r�|j}nt
|d	�r�|j|_nt|_|r
tjj
|�nd
|_||_|d
k	r7||_n|d
k	rO||_n|d
k	rg||_n|d
k	r||_n|d
k	r�||_n|	d
k	r�|	|_n!|dkr�d
|_n	d|_|
d
k	r�|jtkr�|
|_n	i|_|d
k	r||_n|d
k	r0||_nt|_g|_t|_|jj�|_i|_y9|jdkr�d
|_|j �|_n|jdkr7x�tr3|jj!|j�y&|jj"|�}|jj#|�Wq�t$k
r|jj!|j�Pq�t%k
r/}t&t'|���q�Xq�Wn|jdkr�t|_|jr�|jj(|jj)��}|jj*|�|jt+|�7_q�nWn,|js�|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.
        trbRZsr+btatwbR[smode must be 'r', 'a' or 'w'R{R_sutf-8R8tawN(-R(R_t_modeRsRtexistst	bltn_openR�R�RKRxR{R�tabspathR�R6R�tdereferencetignore_zerosR>R?R�R�tdebugt
errorlevelR�tmemberst_loadedR�R�tinodestfirstmemberR"R�RR<RoRlRiR
RR�RQRR}(RzR{R_R�R6R�RPRQR>R?R�RRRStmodesteRG((s/usr/lib64/python2.7/tarfile.pyR|�s�	
"		!									
				cCs
|jtkS(N(R6R�(Rz((s/usr/lib64/python2.7/tarfile.pyt	_getposixRscCs>ddl}|jdtd�|r1t|_n	t|_dS(Ni����s use the format attribute insteadi(twarningstwarntDeprecationWarningR�R6R1(RzR
R[((s/usr/lib64/python2.7/tarfile.pyt	_setposixTscsO|r|rtd��n|dkr��fd�}x�t�jd|�D]�}t��j|�}|dk	r�|j�}	ny||d||�SWqNttfk
r�}
|dk	rN|j|	�qNqNqNXqNWtd��nUd|krq|j	dd�\}}|pd}|p#d	}|�jkrNt��j|�}ntd
|��|||||�Sd|kr|j	dd�\}}|p�d}|p�d	}|dkr�td
��nt
|||||�}y�||||�}
Wn|j��nXt|
_
|
S|dkr?�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 openRZsr:*cs�j|dkS(Nttaropen(t	OPEN_METH(R�(R(s/usr/lib64/python2.7/tarfile.pytnot_compressed�sR�s%file could not be opened successfullyt:iR�sunknown compression type %rt|R[smode must be 'r' or 'w'RIsundiscernible modeN(RZsr:*(RZR[(RIR[(R(tsortedR`R�RKR�RiRjR�tsplitR~R}R�R�R_(RR{R_R�R�tkwargsRaR�tfunct	saved_posRYRdtstreamR\((Rs/usr/lib64/python2.7/tarfile.pyRisP
	cKs.|dkrtd��n|||||�S(sCOpen uncompressed tar archive name for reading or writing.
        RZRIR[smode must be 'r', 'a' or 'w'(RZRIR[(R((RR{R_R�Rf((s/usr/lib64/python2.7/tarfile.pyR_�si	cKs*|dkrtd��nyddl}|jWn#ttfk
rWtd��nXy|j||||�}Wn;tk
r�|dk	r�|dkr�td��n�nXy|j	||||�}WnLt
k
r	|j�|dkrtd��n�n|j��nXt|_
|S(	skOpen gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        RZR[smode must be 'r' or 'w'i����Nsgzip module is not availablesnot a gzip file(RZR[(R(tgziptGzipFileR�tAttributeErrorRjtOSErrorRKRiR_RPR}R�R�(RR{R_R�t
compresslevelRfRjR\((s/usr/lib64/python2.7/tarfile.pytgzopen�s2



	cKs�|d	krtd��nyddl}Wntk
rJtd��nX|dk	rit||�}n|j||d|�}y|j||||�}WnRtt	fk
r�|j
�|dkr�td��n�n|j
��nXt|_
|S(
slOpen bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
        RZR[smode must be 'r' or 'w'.i����Nsbz2 module is not availableRnsnot a bzip2 file(RZR[(R(R�R�RjRKR�tBZ2FileR_RPtEOFErrorR}RiR�R�(RR{R_R�RnRfR�R\((s/usr/lib64/python2.7/tarfile.pytbz2open�s*


	R_R�RoR�RrR�cCs�|jr
dSt|_z�|jdkr�|jjttd�|jtd7_t|jt	�\}}|dkr�|jjtt	|�q�nWd|j
s�|jj�nXdS(slClose the TarFile. In write-mode, two finishing zero blocks are
           appended to the archive.
        NRKii(R�R�R_R�RQRR�R�RNt
RECORDSIZER�R}(RzRURV((s/usr/lib64/python2.7/tarfile.pyR}
s		"	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(RzR{R�((s/usr/lib64/python2.7/tarfile.pyt	getmembers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_checkRUt_loadRT(Rz((s/usr/lib64/python2.7/tarfile.pyt
getmembers*s
	
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().
        (RyR{(RzR�((s/usr/lib64/python2.7/tarfile.pytgetnames4scCs\|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(s�Create a TarInfo object from the result of os.stat or equivalent
           on an existing file. The file is either named by `name', or
           specified as a file object `fileobj' with a file descriptor. If
           given, `arcname' specifies an alternative name for the file in the
           archive, otherwise, the name is taken from the 'name' attribute of
           'fileobj', or the 'name' argument.
        RKR�tlstatR0iiltmajortminorN(;RwRKR{RsRt
splitdriveR�tseptlstripR�R�RxRPR{tstattfstattfilenotst_modetS_ISREGtst_inotst_devtst_nlinkRVR9R�tS_ISDIRR�tS_ISFIFOR?tS_ISLNKR7treadlinktS_ISCHRR;tS_ISBLKR=R_tst_uidRtst_gidRtst_sizeRtst_mtimeRR�R�tpwdtgetpwuidRRutgrptgetgrgidRR|tst_rdevR�R}R�(RzR{tarcnameR�tdrvR�tstatresR�tstmdtinodeR�((s/usr/lib64/python2.7/tarfile.pyt
gettarinfo:s~
			"
									

cCs|j�x�|D]�}|r�t|j�Gd|jp<|j|jpK|jfG|j�sh|j�r�dd|j	|j
fGnd|jGdtj
|j�d Gn|j|j�r�dndG|r|j�r�d	G|jGn|j�rd
G|jGqnHqWdS(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.
        s%s/%ss%10ss%d,%ds%10ds%d-%02d-%02d %02d:%02d:%02diR�R0s->slink toN(RwRdR_RRRRR<R>R�R�RR�t	localtimeRR{RR8R�R:(RztverboseR�((s/usr/lib64/python2.7/tarfile.pytlist�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�rrt|d
��}|j
||�WdQXn�|j�r�|j
|�|r�xQtj|�D]=}|jtjj||�tjj||�|||�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.
        RKi����Nsuse the filter argument insteadistarfile: Excluded %rstarfile: Skipped %ristarfile: Unsupported type %rRH(RwRKR[R\R]t_dbgR{RsRROR�RRNtaddfileRtlistdirtaddR=(	RzR{R�t	recursivetexcludetfilterR[R�tf((s/usr/lib64/python2.7/tarfile.pyR��sB
		
*
*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(smAdd 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 directly, or by using gettarinfo().
           On Windows platforms, `fileobj' should always be opened with mode
           'rb' to avoid irritation about the file size.
        RKiiN(RwR�R�R6R>R?R�RQR�RRKRMRRNR�RRTR<(RzR�R�RGRURV((s/usr/lib64/python2.7/tarfile.pyR��s

t.cCs3g}|dkr|}nxR|D]J}|j�r\|j|�tj|�}d|_n|j||�q"W|jdtjd��|j	�x�|D]�}t
jj||j
�}y4|j||�|j||�|j||�Wq�tk
r*}|jdkr�q+|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�R�R{istarfile: %sN(RKRR<R�R_textracttsorttoperatort
attrgettertreverseRsRR=R{tchowntutimetchmodRhRSR�(RzRRTtdirectoriesR�tdirpathRY((s/usr/lib64/python2.7/tarfile.pyt
extractalls*	



R0cCs7|jd�t|t�r.|j|�}n|}|j�r^tjj||j�|_	ny&|j
|tjj||j��Wn�tk
r�}|j
dkr��q3|jdkr�|jdd|j�q3|jdd|j|jf�n<tk
r2}|j
dkr�q3|jdd|�nXdS(s#Extract 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'.
        RZiistarfile: %sstarfile: %s %rN(RwR�t
basestringRvR:RsRR=R�t_link_targett_extract_memberR{tEnvironmentErrorRStfilenameRKR�tstrerrorRh(RztmemberRR�RY((s/usr/lib64/python2.7/tarfile.pyR�6s$
&#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()
        RZs'cannot extract (sym)link as file objectN(RwR�R�RvRt
fileobjectR�RR:R8R�R~Rktextractfilet_find_link_targetRK(RzR�R�((s/usr/lib64/python2.7/tarfile.pyR�Ws	
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||�|j||�|j	�s�|j||�|j||�ndS(s\Extract the TarInfo object tarinfo to a physical
           file called targetpath.
        R�is%s -> %sN(RR�RsRRtdirnameRMtmakedirsR:R8R�R{R�RtmakefileRtmakedirR@tmakefifoR<R>tmakedevtmakelinkR�RtmakeunknownR�R�R�(RzR�t
targetpatht	upperdirs((s/usr/lib64/python2.7/tarfile.pyR�}s2#cCsFytj|d�Wn+tk
rA}|jtjkrB�qBnXdS(s,Make a directory called targetpath.
        i�N(RstmkdirR�terrnotEEXIST(RzR�R�RY((s/usr/lib64/python2.7/tarfile.pyR��s
cCsJ|j|�}z)t|d��}t||�WdQXWd|j�XdS(s'Make a file called targetpath.
        RJN(R�RNRMR}(RzR�R�tsourcettarget((s/usr/lib64/python2.7/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�(RzR�R�((s/usr/lib64/python2.7/tarfile.pyR��scCs/ttd�rtj|�ntd��dS(s'Make a fifo called targetpath.
        tmkfifosfifo not supported by systemN(RxRsR�Rh(RzR�R�((s/usr/lib64/python2.7/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(RxRsRhR_R>R�tS_IFBLKtS_IFCHRR�R�R�R�(RzR�R�R_((s/usr/lib64/python2.7/tarfile.pyR��s 	
cCsttd�r�ttd�r�|j�rbtjj|�rLtj|�ntj|j|�qtjj|j	�r�tjj|�r�tj|�ntj
|j	|�q|j|j|�|�n=y|j|j|�|�Wnt
k
rtd��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.
        tsymlinktlinks%unable to resolve link inside archiveN(RxRsR8RtlexiststunlinkR�R�RMR�R�R�R�RuRh(RzR�R�((s/usr/lib64/python2.7/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�RxRsR�R�tgetgrnamRRuRtgetpwnamRRR8R�tsystplatformR�R�Rh(RzR�R�RtuRY((s/usr/lib64/python2.7/tarfile.pyR��s '



cCsOttd�rKytj||j�WqKtk
rG}td��qKXndS(sASet file permissions of targetpath according to tarinfo.
        R�scould not change modeN(RxRsR�R_R�Rh(RzR�R�RY((s/usr/lib64/python2.7/tarfile.pyR�	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(RxRsR�RR�Rh(RzR�R�RY((s/usr/lib64/python2.7/tarfile.pyR�	s cCs%|jd�|jdk	r2|j}d|_|S|j|jj�kr�|jj|jd�|jjd�s�td��q�nd}xkt	r�y|j
j|�}WnGtk
r�}|j
r�|jdd|j|f�|jt7_q�q�n�tk
rk}|j
rD|jdd|j|f�|jt7_q�q�|jdkr�tt|���q�n�tk
r�|jdkr�td��q�n[tk
r�}|jdkr�tt|���q�n%tk
r�}tt|���nXPq�W|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.
        traisunexpected end of datais0x%X: %sis
empty fileN(RwRWRKR�R�R�R�RORiR�R�RRoRQR�R�R)R
RmRnRpRTR<RU(RztmR�RY((s/usr/lib64/python2.7/tarfile.pyR"#	sL
						
	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(RyRKtindexRsRtnormpathtreversedR{(RzR{R�t	normalizeRTR�tmember_name((s/usr/lib64/python2.7/tarfile.pyRtY	s	cCs6x&tr(|j�}|dkrPqqWt|_dS(sWRead through the entire archive file and look for readable
           members.
        N(R�R"RKRU(RzR�((s/usr/lib64/python2.7/tarfile.pyRxp	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�ReRKR_(RzR_((s/usr/lib64/python2.7/tarfile.pyRwz	s	cCs�|j�rEdjtdtjj|j�|jf��}d}n|j}|}|j	|d|dt
�}|dkr�td|��n|S(sZFind the target member of a symlink or hardlink member in the
           archive.
        R�R�R�slinkname %r not foundN(R8R=R�RKRsRR�R{R�RtR�Ru(RzR�R�tlimitR�((s/usr/lib64/python2.7/tarfile.pyR��	s0		cCs$|jrt|j�St|�SdS(s$Provide an iterator object.
        N(RUtiterRTtTarIter(Rz((s/usr/lib64/python2.7/tarfile.pyR��	s	
cCs#||jkrtj|IJndS(s.Write debugging output to sys.stderr.
        N(RRR�tstderr(Rztleveltmsg((s/usr/lib64/python2.7/tarfile.pyR��	scCs|j�|S(N(Rw(Rz((s/usr/lib64/python2.7/tarfile.pyt	__enter__�	s
cCs?|dkr|j�n"|js2|jj�nt|_dS(N(RKR}R�R�R�R�(RzR�R
t	traceback((s/usr/lib64/python2.7/tarfile.pyt__exit__�	s

	N(=ReRfRgRRR�RPRQRSRDR6RER>RKR?RR�R�R�R|RZR^RCtposixRFRsRR_RoRrR`R}RvRyRzR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R"RtRxRwR�R�R�R�R�(((s/usr/lib64/python2.7/tarfile.pyR�ste		
M!
			
	c=%!	&	/		
									6	
					R�cBs)eZdZd�Zd�Zd�ZRS(sMIterator Class.

       for tarinfo in TarFile(...):
           suite...
    cCs||_d|_dS(s$Construct a TarIter object.
        iN(R�R�(RzR�((s/usr/lib64/python2.7/tarfile.pyR|�	s	cCs|S(s Return iterator object.
        ((Rz((s/usr/lib64/python2.7/tarfile.pyR��	scCs�|jdkr3|jjdk	r3|jj�}np|jt|jj�krd|jj|j}n?|jjs�|jj�}|s�t|j_t	�q�nt	�|jd7_|S(s�Return the next item using TarFile's next() method.
           When all members have been read, set TarFile as _loaded.
        iiN(
R�R�RWRKR"RRTRUR�t
StopIteration(RzR�((s/usr/lib64/python2.7/tarfile.pyR"�	s!(ReRfRgR|R�R"(((s/usr/lib64/python2.7/tarfile.pyR��	s		t_sectioncBs eZdZd�Zd�ZRS(s$Base class for _data and _hole.
    cCs||_||_dS(N(R�R(RzR�R((s/usr/lib64/python2.7/tarfile.pyR|�	s	cCs%|j|ko"|j|jkSS(N(R�R(RzR�((s/usr/lib64/python2.7/tarfile.pyt__contains__�	s(ReRfRgR|R�(((s/usr/lib64/python2.7/tarfile.pyR��	s	R�cBseZdZd�ZRS(s/Represent a data section in a sparse file.
    cCs tj|||�||_dS(N(R�R|R�(RzR�RR�((s/usr/lib64/python2.7/tarfile.pyR|�	s(ReRfRgR|(((s/usr/lib64/python2.7/tarfile.pyR��	sR$cBseZdZRS(s/Represent a hole section in a sparse file.
    (ReRfRg(((s/usr/lib64/python2.7/tarfile.pyR$�	sR#cBs eZdZd�Zd�ZRS(sMRingbuffer class which increases performance
       over a regular list.
    cCs
d|_dS(Ni(tidx(Rz((s/usr/lib64/python2.7/tarfile.pyR|�	scCsu|j}x\trg||}||kr,Pn|d7}|t|�krQd}n||jkrdSqW||_|S(Nii(R�R�RRK(RzR�R�titem((s/usr/lib64/python2.7/tarfile.pyR"�	s		

		(ReRfRgR|R"(((s/usr/lib64/python2.7/tarfile.pyR#�	s	t
TarFileCompatcBsteZdZded�Zd�Zd�Zd�Zd�Zd�Z	d�Z
ddd	�Zd
�Z
d�ZRS(
sRTarFile class compatible with standard module zipfile's
       ZipFile class.
    RZcCs�ddlm}|ddd�|tkrDtj||�|_n0|tkrhtj||�|_ntd��|dd!d	kr�|jj	�}xB|D]7}|j
|_|j|_
tj|j�d
 |_q�WndS(Ni����(twarnpy3ks6the TarFileCompat class has been removed in Python 3.0t
stacklevelisunknown compression constantiiRZi(R[R�t	TAR_PLAINRR_R�tTAR_GZIPPEDRoR(RyR{R�Rt	file_sizeR�tgmtimeRt	date_time(RztfileR_tcompressionR�RTR�((s/usr/lib64/python2.7/tarfile.pyR|
s	
cCstd�|j��S(NcSs|jS(N(R{(R�((s/usr/lib64/python2.7/tarfile.pyt<lambda>
R0(tmaptinfolist(Rz((s/usr/lib64/python2.7/tarfile.pytnamelist
scCstd�|jj��S(NcSs
|jtkS(N(R�R5(R�((s/usr/lib64/python2.7/tarfile.pyR� 
R0(R�R�Ry(Rz((s/usr/lib64/python2.7/tarfile.pyR
s	cCs|jj�dS(N(R�R�(Rz((s/usr/lib64/python2.7/tarfile.pytprintdir"
scCsdS(N((Rz((s/usr/lib64/python2.7/tarfile.pyttestzip$
scCs|jj|�S(N(R�Rv(RzR{((s/usr/lib64/python2.7/tarfile.pytgetinfo&
scCs"|jj|jj|��j�S(N(R�R�RvRO(RzR{((s/usr/lib64/python2.7/tarfile.pyRO(
scCs|jj||�dS(N(R�R�(RzR�R�t
compress_type((s/usr/lib64/python2.7/tarfile.pyRQ*
scCs�yddlm}Wn!tk
r7ddlm}nXddl}t|j�}t|�|_|j|j	�|_
|jj|||��dS(Ni����(tStringIO(
t	cStringIORR�tcalendarRR�RRttimegmR�RR�R�(RztzinfotbytesRRttinfo((s/usr/lib64/python2.7/tarfile.pytwritestr,
s
cCs|jj�dS(N(R�R}(Rz((s/usr/lib64/python2.7/tarfile.pyR}6
sN(ReRfRgR�R|RRRRRRORKRQR
R}(((s/usr/lib64/python2.7/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(RR}R�RR�(R{R\((s/usr/lib64/python2.7/tarfile.pyR=
s

(xRgt__version__tversiont
__author__t__date__t	__cvsid__t__credits__t__builtin__RRNR�RsRLR�R�R�R2R�R*R�R�R�R�RKt__all__RR�RsR�R�R�R�RR�RR9R7R;R=R�R?tCONTTYPER�R�RRRRR�R1R�RDRR5RR2R�R&R3tS_IFLNKtS_IFREGR�tS_IFDIRR�tS_IFIFOtTSUIDtTSGIDtTSVTXtTUREADtTUWRITEtTUEXECtTGREADtTGWRITEtTGEXECtTOREADtTOWRITEtTOEXECtgetfilesystemencodingREtgetdefaultencodingR!R$R.R7RARJRMR^Rdt	ExceptionRRhRiRjRkRlRmRnRoR)RpRqR~tobjectR�R�R�R�RRR�R�R�R$R�R#R�R�R�R(((s/usr/lib64/python2.7/tarfile.pyt<module>s.

					
						
					
	
	
		�AR���7����'	4