Your IP : 3.145.2.137


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

�
�mec
@s=dZdZdZdZdZdZdZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZyddlZddlZWnek
r�eZZnXd	d
ddgZd
ZdZedZdZdZdZdZdZdZd
ZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*d Z+d!Z,d"Z-d#Z.d$Z/e.Z0eee e!e$e%e&e"e#e'e(e)fZ1eee&e)fZ2e'e(e)fZ3d%d&d'd(d)d*d+d,fZ4ie5d-6e5d.6e5d(6e6d)6e6d*6e6d'6Z7d/Z8d0Z9d1Z:d2Z;d3Z<d4Z=d5Z>d6Z?dZ@d7ZAd8ZBd9ZCd:ZDd;ZEd<ZFd=ZGd$ZHd#ZIejJ�ZKeKekr�ejL�ZKnd>�ZMd?�ZNd@�ZOd<e0dA�ZPdB�ZQdC�ZRedD�ZSe8dEfe9dFfe:dGfe;dHfe<dIfe=dJffeAdKffeBdLffeCe>BdMfe>dfeCdffeDdKffeEdLffeFe?BdMfe?dfeFdffeGdKffeHdLffeIe@BdNfe@dOfeIdfff
ZTdP�ZUdeVfdQ��YZWdReWfdS��YZXdTeWfdU��YZYdVeWfdW��YZZdXeWfdY��YZ[dZeWfd[��YZ\d\e\fd]��YZ]d^e\fd_��YZ^d`e\fda��YZ_dbe\fdc��YZ`dde\fde��YZadffdg��YZbdhfdi��YZcdjedfdk��YZedledfdm��YZfdnedfdo��YZgdpedfdq��YZhd
edfdr��YZid	edfds��YZjdtfdu��YZkdvfdw��YZldxelfdy��YZmdzelfd{��YZnd|eofd}��YZpd"Zqd<Zrd~fd��YZsd��ZteuZvejjuZudS(�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����NtTarFiletTarInfot
is_tarfiletTarErrortiisustar  tustar00idi�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.
    Ri����(tfind(R tp((s/usr/lib64/python2.7/tarfile.pytnts�scCs�|dtd�krXytt|�p+dd�}Wq�tk
rTtd��q�XnId}x@tt|�d�D](}|dK}|t||d�7}quW|S(s/Convert a number field to a python number.
    ii�Risinvalid headerli(tchrtintR%t
ValueErrortInvalidHeaderErrortxrangeRtord(R tnti((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 fieldRtlti�i�(Rt
GNU_FORMATR(tstructtunpacktpackR*R&(R,tdigitstformatR R-((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(R tencodingterrorsRtc((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$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()
    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 unreadble 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_TRUNCthasattrRrtopentfd(tselftnameR_((s/usr/lib64/python2.7/tarfile.pyt__init__qs
cCstj|j�dS(N(RstcloseRz(R{((s/usr/lib64/python2.7/tarfile.pyR~zscCstj|j|�S(N(RsRORz(R{R((s/usr/lib64/python2.7/tarfile.pyRO}scCstj|j|�dS(N(RsRQRz(R{R ((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|_|dkr&yddl}Wntk
r�td��nX||_|jd�d@|_|d	kr|j�q&|j�n|d
kr�yddl}Wntk
ratd��nX|d	kr�d|_|j�|_q�|j�|_ndS(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
BZ2Compressor(R{R|R_R�R�R�R�R�((s/usr/lib64/python2.7/tarfile.pyR}�sD								
	


	cCs*t|d�r&|jr&|j�ndS(NR�(RxR�R~(R{((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(R{t	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�(R{R ((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(R{R ((s/usr/lib64/python2.7/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�R0R�s<Ll��(R�R_R�RGR�tflushR�RQR2R4R�R�R�R~R�(R{((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(R{tflagtxlenR ((s/usr/lib64/python2.7/tarfile.pyR��s.	

,
	
	
cCs|jS(s3Return the stream's file pointer position.
        (R�(R{((s/usr/lib64/python2.7/tarfile.pyttellsicCs|||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(R{R�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(R{RR\RG((s/usr/lib64/python2.7/tarfile.pyRO/s	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=(R{RR@R\RG((s/usr/lib64/python2.7/tarfile.pyR�As"



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=(R{RR@R\RG((s/usr/lib64/python2.7/tarfile.pyt__readWs

N(ReRfRgR}R�R�RQR�R~R�R�R�RKROR�R�(((s/usr/lib64/python2.7/tarfile.pyR�s		.			
					
	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(R{R�((s/usr/lib64/python2.7/tarfile.pyR}ms	cCs|jj|_|jS(N(R�RORG(R{R((s/usr/lib64/python2.7/tarfile.pyROqscCsJ|jjd�rdS|jdd!dkrF|jdd!dkrFd	Sd
S(Ns�R�iitBZhii
s1AY&SYR�R�(RGt
startswith(R{((s/usr/lib64/python2.7/tarfile.pyR�us
,cCs|jj�dS(N(R�R~(R{((s/usr/lib64/python2.7/tarfile.pyR~|s(ReRfRgR}ROR�R~(((s/usr/lib64/python2.7/tarfile.pyR�hs
			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(R{R�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�(R{R�((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�(R{RRWRtrawtdataRG((s/usr/lib64/python2.7/tarfile.pyRO�s

cCs4||jkr|j�n|j||j�dS(N(R�R�RO(R{R�((s/usr/lib64/python2.7/tarfile.pyR��s
cCs|jS(N(R�(R{((s/usr/lib64/python2.7/tarfile.pyR��scCs;|jt|�7_|jj|�}|jj|�dS(N(R�RR�R�R�RQ(R{R�R�((s/usr/lib64/python2.7/tarfile.pyRQ�scCs5|jdkr1|jj�}|jj|�ndS(NR[(R_R�R�R�RQ(R{R�((s/usr/lib64/python2.7/tarfile.pyR~�si@(ReRfRgR�R}R�ROR�R�RQR~(((s/usr/lib64/python2.7/tarfile.pyR��s		
				t_FileInFilecBsSeZdZdd�Zd�Zd�Zdd�Zd�Zd�Z	d�Z
RS(	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(R{R�R�RR�((s/usr/lib64/python2.7/tarfile.pyR}�s
				cCs|jS(s*Return the current file position.
        (R�(R{((s/usr/lib64/python2.7/tarfile.pyR��scCs
||_dS(s(Seek to a position in the file.
        N(R�(R{R�((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(R{R((s/usr/lib64/python2.7/tarfile.pyRO�s
cCs9|jj|j|j�|j|7_|jj|�S(s*Read operation for regular files.
        (R�R�R�R�RO(R{R((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=(R{RR�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
j|�S|j|7_t
|SdS(s0Read a single section of a sparse file.
        R0N(R�R#R�RKR�R�Rt
isinstancet_datatrealposR�R�ROR(R{RtsectionR�((s/usr/lib64/python2.7/tarfile.pyR��s N(ReRfRgRKR}R�R�ROR�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(R{ttarfilettarinfo((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�(R{RRG((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�(R{RR�tbuffersRG((s/usr/lib64/python2.7/tarfile.pytreadline8s(		

cCs:g}x-tr5|j�}|s%Pn|j|�q	W|S(s0Return a list with all remaining lines.
        (R�R�R<(R{tresulttline((s/usr/lib64/python2.7/tarfile.pyt	readlinesWs	cCs|jrtd��n|jS(s*Return the current file position.
        sI/O operation on closed file(R�R(R�(R{((s/usr/lib64/python2.7/tarfile.pyR�as	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�(R{R�twhence((s/usr/lib64/python2.7/tarfile.pyR�is	!(	cCs
t|_dS(sClose the file object.
        N(R�R�(R{((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�(R{R�((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(R{R|((s/usr/lib64/python2.7/tarfile.pyR}�s 															cCs|jS(N(R|(R{((s/usr/lib64/python2.7/tarfile.pyt_getpath�scCs
||_dS(N(R|(R{R|((s/usr/lib64/python2.7/tarfile.pyt_setpath�scCs|jS(N(R�(R{((s/usr/lib64/python2.7/tarfile.pyt_getlinkpath�scCs
||_dS(N(R�(R{R�((s/usr/lib64/python2.7/tarfile.pyt_setlinkpath�scCs d|jj|jt|�fS(Ns<%s %r at %#x>(t	__class__ReR|tid(R{((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/(snameslinknamesunamesgname(R|R_RRRRR�R�R�RRR�R�tDIRTYPER�R�R:(R{R>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((R{R6R>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�(R{R�((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(R{R�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(sunamesunamei (sgnamesgnamei (suidi(sgidi(ssizei(smtimei(R�R�tcopyR�R�tdecodeR:R;RR�tfloatR�t_create_pax_generic_headerR�R�(R{R�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_header8scCs�|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((R{R|R�((s/usr/lib64/python2.7/tarfile.pyR�>s
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�Ms&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_payloadis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�ss



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(R{R�((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?(R{R�R�((s/usr/lib64/python2.7/tarfile.pyR�s		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�(R{R�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�(R{R�RGtspR�tlastposR�R-R�tnumbytest
isextendedtorigsize((s/usr/lib64/python2.7/tarfile.pyRsT		





		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(R{R�RGR�tregexR�R-R!RR
R"R�((s/usr/lib64/python2.7/tarfile.pyRSs@	+

	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�(R{R�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�(R{RRURV((s/usr/lib64/python2.7/tarfile.pyR �s
cCs
|jtkS(N(R�t
REGULAR_TYPES(R{((s/usr/lib64/python2.7/tarfile.pyR�scCs
|j�S(N(R(R{((s/usr/lib64/python2.7/tarfile.pytisfile�scCs
|jtkS(N(R�R�(R{((s/usr/lib64/python2.7/tarfile.pyR�scCs
|jtkS(N(R�tSYMTYPE(R{((s/usr/lib64/python2.7/tarfile.pytissym�scCs
|jtkS(N(R�tLNKTYPE(R{((s/usr/lib64/python2.7/tarfile.pytislnk�scCs
|jtkS(N(R�tCHRTYPE(R{((s/usr/lib64/python2.7/tarfile.pytischr�scCs
|jtkS(N(R�tBLKTYPE(R{((s/usr/lib64/python2.7/tarfile.pytisblk�scCs
|jtkS(N(R�tFIFOTYPE(R{((s/usr/lib64/python2.7/tarfile.pytisfifo�scCs
|jtkS(N(R�R(R{((s/usr/lib64/python2.7/tarfile.pytissparse�scCs|jtttfkS(N(R�R;R=R?(R{((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�t|�dks|dkr-td��n||_idd6dd6dd	6||_|s�|jdkr�tjj|�r�d	|_d|_nt||j�}t|_	nN|dkr�t|d
�r�|j}nt|d�r�|j|_nt
|_	|rtjj|�nd|_||_|dk	rC||_n|dk	r[||_n|dk	rs||_n|dk	r�||_n|dk	r�||_n|	dk	r�|	|_n!|dkr�d|_n	d
|_|
dk	r|jtkr|
|_n	i|_|dk	r$||_n|dk	r<||_nt|_g|_t|_|jj�|_i|_y9|jdkr�d|_ |j!�|_ n|jdkrCx�t
r?|jj"|j�y&|jj#|�}|jj$|�Wq�t%k
r|jj"|j�Pq�t&k
r;}
t't(|
���q�Xq�Wn|jdkr�t
|_|jr�|jj)|jj*��}|jj+|�|jt|�7_q�nWn,|j	s�|jj,�nt
|_�nXdS(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'trbRZsr+btatwbR[R|R_sutf-8R8tawN(-RR(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�RQR~(R{R|R_R�R6R�RPRQR>R?R�RRRSteRG((s/usr/lib64/python2.7/tarfile.pyR}�s�	""		!									
				cCs
|jtkS(N(R6R�(R{((s/usr/lib64/python2.7/tarfile.pyt	_getposixEscCs>ddl}|jdtd�|r1t|_n	t|_dS(Ni����s use the format attribute insteadi(twarningstwarntDeprecationWarningR�R6R1(R{R
RZ((s/usr/lib64/python2.7/tarfile.pyt	_setposixGscKs|r|rtd��n|dkr�x�|jD]�}t||j|�}|dk	rj|j�}ny||d||�SWq3ttfk
r�}	|dk	r3|j|�q3q3q3Xq3Wtd��n4d|krV|jdd�\}
}|
p�d}
|pd}||jkr3t||j|�}ntd|��|||
||�Sd	|kr�|jd	d�\}
}|
p�d}
|p�d}|
d
kr�td��n|||
t	||
|||�|�}t
|_|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 openRZsr:*s%file could not be opened successfullyt:iR�sunknown compression type %rt|trwsmode must be 'r' or 'w'RKsundiscernible modeN(RZsr:*(
R(t	OPEN_METHR�RKR�RiRjR�tsplitRR�R�ttaropen(RR|R_R�R�tkwargsR�tfunct	saved_posRXRdR\((s/usr/lib64/python2.7/tarfile.pyRy\sH			cKs@t|�dks|dkr-td��n|||||�S(sCOpen uncompressed tar archive name for reading or writing.
        iR�smode must be 'r', 'a' or 'w'(RR((RR|R_R�Rd((s/usr/lib64/python2.7/tarfile.pyRc�si	c	Ks�t|�dks|dkr-td��nyddl}|jWn#ttfk
ritd��nX|dkr�t||d�}ny.|j	|||j||||�|�}Wnt
k
r�td��nXt|_
|S(	skOpen gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        iR`smode must be 'r' or 'w'i����Nsgzip module is not availableRWsnot a gzip file(RR(tgziptGzipFileR�tAttributeErrorRjRKRNRcRPRiR�R�(RR|R_R�t
compresslevelRdRgR\((s/usr/lib64/python2.7/tarfile.pytgzopen�s"

	cKs�t|�dks|dkr-td��nyddl}Wntk
r\td��nX|dk	r{t||�}n|j||d|�}y|j||||�}Wn#t	t
fk
r�td��nXt|_
|S(	slOpen bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
        iR`smode must be 'r' or 'w'.i����Nsbz2 module is not availableRjsnot a bzip2 file(RR(R�R�RjRKR�tBZ2FileRcRPtEOFErrorRiR�R�(RR|R_R�RjRdR�R\((s/usr/lib64/python2.7/tarfile.pytbz2open�s
	RcR�RkR�RnR�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.
        NRKii(R�R_R�RQRR�R�RNt
RECORDSIZER�R~R�(R{RURV((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(R{R|R�((s/usr/lib64/python2.7/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_checkRUt_loadRT(R{((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().
        (RuR|(R{R�((s/usr/lib64/python2.7/tarfile.pytgetnamessc	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.
        RKR�tlstatR0iiltmajortminorN(;RsRKR|RsRt
splitdriveR�tseptlstripR�R�RxRPRwtstattfstattfilenotst_modetS_ISREGtst_inotst_devtst_nlinkRVR9R�tS_ISDIRR�tS_ISFIFOR?tS_ISLNKR7treadlinktS_ISCHRR;tS_ISBLKR=R_tst_uidRtst_gidRtst_sizeRtst_mtimeRR�R�tpwdtgetpwuidRRqtgrptgetgrgidRRxtst_rdevR�RyR�(R{R|tarcnameR�tdrvR�tstatresR�tstmdtinodeR�((s/usr/lib64/python2.7/tarfile.pyt
gettarinfos~
			"
									

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(RsRdR_RRRRR<R>R�R�RR�t	localtimeRR|RR8R�R:(R{tverboseR�((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(RsRKRZR[R\t_dbgR|RsRROR�RRNtaddfileRtlistdirtaddR=(	R{R|R�t	recursivetexcludetfilterRZR�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(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.
        RKiiN(RsR�R�R6R>R?R�RQR�RRKRMRRNR�RRTR<(R{R�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�(R{RRTtdirectoriesR�tdirpathRX((s/usr/lib64/python2.7/tarfile.pyt
extractall�s*	



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(RsR�t
basestringRrR:RsRR=R�t_link_targett_extract_memberR|tEnvironmentErrorRStfilenameRKR�tstrerrorRh(R{tmemberRR�RX((s/usr/lib64/python2.7/tarfile.pyR�s$
&#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(RsR�R�RrRt
fileobjectR�RR:R8R�RRktextractfilet_find_link_targetRK(R{R�R�((s/usr/lib64/python2.7/tarfile.pyR�5s	
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�RsR{RtdirnameRMtmakedirsR:R8R�R|R�RtmakefileRtmakedirR@tmakefifoR<R>tmakedevtmakelinkR�RtmakeunknownR�R�R�(R{R�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(R{R�R�RX((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~(R{R�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�(R{R�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(R{R�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�(R{R�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�RqRh(R{R�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�tgetgrnamRRqRtgetpwnamRRR8R�tsystplatformR�R�Rh(R{R�R�RtuRX((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(R{R�R�RX((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(R{R�R�RX((s/usr/lib64/python2.7/tarfile.pyR��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(RsRWRKR�R�R�R�R�RRoRQR�R�R)RiR
RmRnRpRTR<RU(R{tmR�RX((s/usr/lib64/python2.7/tarfile.pyR"	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(RuRKtindexRsRtnormpathtreversedR|(R{R|R�t	normalizeRTR�tmember_name((s/usr/lib64/python2.7/tarfile.pyRp2	s	cCs6x&tr(|j�}|dkrPqqWt|_dS(sWRead through the entire archive file and look for readable
           members.
        N(R�R"RKRU(R{R�((s/usr/lib64/python2.7/tarfile.pyRtI	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_(R{R_((s/usr/lib64/python2.7/tarfile.pyRsS	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�RpR�Rq(R{R�R�tlimitR�((s/usr/lib64/python2.7/tarfile.pyR�\	s0		cCs$|jrt|j�St|�SdS(s$Provide an iterator object.
        N(RUtiterRTtTarIter(R{((s/usr/lib64/python2.7/tarfile.pyR�o	s	
cCs#||jkrtj|IJndS(s.Write debugging output to sys.stderr.
        N(RRR�tstderr(R{tleveltmsg((s/usr/lib64/python2.7/tarfile.pyR�w	scCs|j�|S(N(Rs(R{((s/usr/lib64/python2.7/tarfile.pyt	__enter__}	s
cCs?|dkr|j�n"|js2|jj�nt|_dS(N(RKR~R�R�R�R�(R{R�R
t	traceback((s/usr/lib64/python2.7/tarfile.pyt__exit__�	s

	N(=ReRfRgRRR�RPRQRSRDR6RER>RKR?RR�R�R�R}RYR]RCtposixRFRoRyRcRkRnRaR~RrRuRvR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R"RpRtRsR�R�R�R�R�(((s/usr/lib64/python2.7/tarfile.pyR�std		
H
			
	b=%!	&	/		
									1	
					R�cBs)eZdZd�Zd�Zd�ZRS(sMIterator Class.

       for tarinfo in TarFile(...):
           suite...
    cCs||_d|_dS(s$Construct a TarIter object.
        iN(R�R�(R{R�((s/usr/lib64/python2.7/tarfile.pyR}�	s	cCs|S(s Return iterator object.
        ((R{((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(R{R�((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(R{R�R((s/usr/lib64/python2.7/tarfile.pyR}�	s	cCs%|j|ko"|j|jkSS(N(R�R(R{R�((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�(R{R�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(R{((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(R{R�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(RZR�t	TAR_PLAINRRcR�tTAR_GZIPPEDRkR(RuR|R�Rt	file_sizeR�tgmtimeRt	date_time(R{tfileR_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>�	s(tmaptinfolist(R{((s/usr/lib64/python2.7/tarfile.pytnamelist�	scCstd�|jj��S(NcSs
|jtkS(N(R�R5(R�((s/usr/lib64/python2.7/tarfile.pyR��	s(R�R�Ru(R{((s/usr/lib64/python2.7/tarfile.pyR��	s	cCs|jj�dS(N(R�R�(R{((s/usr/lib64/python2.7/tarfile.pytprintdir�	scCsdS(N((R{((s/usr/lib64/python2.7/tarfile.pyttestzip�	scCs|jj|�S(N(R�Rr(R{R|((s/usr/lib64/python2.7/tarfile.pytgetinfo�	scCs"|jj|jj|��j�S(N(R�R�RrRO(R{R|((s/usr/lib64/python2.7/tarfile.pyRO
scCs|jj||�dS(N(R�R�(R{R�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�(R{tzinfotbytesRRttinfo((s/usr/lib64/python2.7/tarfile.pytwritestr
s
cCs|jj�dS(N(R�R~(R{((s/usr/lib64/python2.7/tarfile.pyR~
sN(ReRfRgR�R}R�R�R�R�RRORKRQR	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(RyR~R�RR�(R|R\((s/usr/lib64/python2.7/tarfile.pyR
s

(wRgt__version__tversiont
__author__t__date__t	__cvsid__t__credits__R�RsRLR}R�R�R2R�R*R�R�R�R�RKt__all__RR�RoR�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)RpRqRtobjectR�R�R�R�RRR�R�R�R$R�R#R�R�R�RRyRN(((s/usr/lib64/python2.7/tarfile.pyt<module>s.

					
						
					
	
	
		�AL���7����'	4