Viewing File: /usr/lib64/python2.7/tarfile.pyo


sjc
@s6dZdZdZdZdZdZdZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZyddlZddlZWnek
reZZnXd	d
ddgZd
ZdZedZdZdZdZdZdZdZd
Z dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+d Z,d!Z-d"Z.d#Z/d$Z0e/Z1ee e!e"e%e&e'e#e$e(e)e*fZ2ee e'e*fZ3e(e)e*fZ4d%d&d'd(d)d*d+d,fZ5ie6d-6e6d.6e6d(6e7d)6e7d*6e7d'6Z8d/Z9d0Z:d1Z;d2Z<d3Z=d4Z>d5Z?d6Z@dZAd7ZBd8ZCd9ZDd:ZEd;ZFd<ZGd=ZHd$ZId#ZJejKZLeLekrejMZLnd>ZNd?ZOd@ZPd<e1dAZQdBZRdCZSedDZTe9dEfe:dFfe;dGfe<dHfe=dIfe>dJffeBdKffeCdLffeDe?BdMfe?dfeDdffeEdKffeFdLffeGe@BdMfe@dfeGdffeHdKffeIdLffeJeABdNfeAdOfeJdfff
ZUdPZVdQZWdeXfdRYZYdSeYfdTYZZdUeYfdVYZ[dWeYfdXYZ\dYeYfdZYZ]d[eYfd\YZ^d]e^fd^YZ_d_e^fd`YZ`dae^fdbYZadce^fddYZbdee^fdfYZcdgfdhYZddifdjYZedkeffdlYZgdmeffdnYZhdoeffdpYZidqeffdrYZjdseYfdtYZkduekfdvYZldwekfdxYZmdyekfdzYZnd{ekfd|YZod}ekfd~YZpeqdZrdZsdZtdZuiesd6etd6eud6ZvefZwd
effdYZxejydejzZ{d	effdYZ|dfdYZ}dfdYZ~de~fdYZde~fdYZdefdYZd"Zd<ZdfdYZdZeZe|jZdS(s,Read from and write to tar format archives.
s$Revision: 85213 $s0.9.0s!Lars Gustbel (lars@gustaebel.de)s$Date$s$Id$s3Gustavo Niemeyer, Niels Gustbel, Richard Townsend.iNtTarFiletTarInfot
is_tarfiletTarErrortiisustar  tustar00idit0t1t2t3t4t5t6t7tLtKtStxtgtXiiitpathtlinkpathtsizetmtimetuidtgidtunametgnametatimetctimeiii`i@i iiiiii@i iiicCs5|dkrtdn|| |t|tS(s@Convert a python string to a null-terminated string buffer.
    smetadata cannot contain NoneN(tNonet
ValueErrortlentNUL(tstlength((s/usr/lib64/python2.7/tarfile.pytstnscCs'|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.pytntsscCs|dtdkrXytt|p+dd}Wqtk
rTtdqXnId}x@tt|dD](}|dK}|t||d7}quW|S(s/Convert a number field to a python number.
    iiRisinvalid headerli(tchrtintR'RtInvalidHeaderErrortxrangeR tord(R"tnti((s/usr/lib64/python2.7/tarfile.pytntis

cCsd|kod|dknr?d|d|ft}n|tks_|d|dkrntdn|dkrtjdtjd|d}nd	}x6t|dD]$}t|d
@|}|dL}qWtd|}|S(s/Convert a python number to a number field.
    iiis%0*oisoverflow in number fieldRtltii(R!t
GNU_FORMATRtstructtunpacktpackR+R((R-tdigitstformatR"R.((s/usr/lib64/python2.7/tarfile.pytitns	$ %cCs|dkry|j|dSWqtk
rg}xU|D]M}y|j|j|dWq=tk
r|j|jdq=Xq=Wdj|SXn|j||SdS(s*Convert a unicode object to a string.
    sutf-8tstricttutf8R1N(tencodetUnicodeEncodeErrortappendtjoin(R"tencodingterrorsRtc((s/usr/lib64/python2.7/tarfile.pytutss


cCsxdttjd|d tjd|dd!}dttjd|d tjd|dd!}||fS(	sCalculate 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.
    it148Bit356Biit148bt356b(tsumR3R4(tbuftunsigned_chksumt
signed_chksum((s/usr/lib64/python2.7/tarfile.pytcalc_chksumss	77cCs|dkrdS|dkr0tj||dSd}t||\}}xQt|D]C}|j|}t||krtdn|j|qXW|dkr|j|}t||krtdn|j|ndS(sjCopy length bytes from fileobj src to fileobj dst.
       If length is None, copy the entire content.
    iNiisend of file reachedi@(	RtshutiltcopyfileobjtdivmodR+treadR tIOErrortwrite(tsrctdstR#tBUFSIZEtblockst	remaindertbRH((s/usr/lib64/python2.7/tarfile.pyRMs$R0t-RWtdRAR&trtwR"tttTcCsig}xStD]K}xB|D]-\}}||@|kr|j|PqqW|jdq
Wdj|S(scConvert a file's mode to a string of the form
       -rwxrwxrwx.
       Used by TarFile.list()
    RXR1(tfilemode_tableR=R>(tmodetpermttabletbittchar((s/usr/lib64/python2.7/tarfile.pytfilemode:s

c
sn|stdnttt|}dd}t}y#tfd|D\}Wntk
rxt}nX|rtdng|D]}|j^q}g|D]1}g|D]}|r||kr|^q^q}t|}t	|}	|}
x8t
|D]*\}}||	|kr|| }
PqqW|rSnd }|j|
S(sDGiven a sequence of path names, returns the longest common sub-path.s&_commonpath() arg is an empty sequencet/t.c3s|]}|d kVqdS(iN((t.0R&(tsep(s/usr/lib64/python2.7/tarfile.pys	<genexpr>[ss%Can't mix absolute and relative pathsi(RttupletmaptstrtFalsetsettTruetsplittmintmaxt	enumerateR>(
tpathstcurdirtraised_exceptiontisabsRtsplit_pathsR"RAts1ts2tcommonR.tprefix((Rhs/usr/lib64/python2.7/tarfile.pyt_commonpathOs.#

">
cBseZdZRS(sBase exception.(t__name__t
__module__t__doc__(((s/usr/lib64/python2.7/tarfile.pyRostExtractErrorcBseZdZRS(s%General exception for extract errors.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRrst	ReadErrorcBseZdZRS(s%Exception for unreadble tar archives.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRustCompressionErrorcBseZdZRS(s.Exception for unavailable compression methods.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRxstStreamErrorcBseZdZRS(s=Exception for unsupported operations on stream-like TarFiles.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyR{stHeaderErrorcBseZdZRS(s!Base exception for header errors.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyR~stEmptyHeaderErrorcBseZdZRS(sException for empty headers.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRstTruncatedHeaderErrorcBseZdZRS(s Exception for truncated headers.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRstEOFHeaderErrorcBseZdZRS(s"Exception for end of file headers.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRsR*cBseZdZRS(sException for invalid headers.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyR*stSubsequentHeaderErrorcBseZdZRS(s3Exception for missing and invalid extended headers.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRst
_LowLevelFilecBs2eZdZdZdZdZdZRS(sLow-level file object. Supports reading and writing.
       It is used instead of a regular file object for streaming
       access.
    cCsgitjd6tjtjBtjBd6|}ttdrK|tjO}ntj||d|_dS(NRZR[tO_BINARYi(	tostO_RDONLYtO_WRONLYtO_CREATtO_TRUNCthasattrRtopentfd(tselftnameR_((s/usr/lib64/python2.7/tarfile.pyt__init__s
cCstj|jdS(N(RtcloseR(R((s/usr/lib64/python2.7/tarfile.pyRscCstj|j|S(N(RROR(RR((s/usr/lib64/python2.7/tarfile.pyROscCstj|j|dS(N(RRQR(RR"((s/usr/lib64/python2.7/tarfile.pyRQs(R}R~RRRRORQ(((s/usr/lib64/python2.7/tarfile.pyRs
				t_StreamcBseZdZdZdZdZdZdZdZdZ	dZ
d	d
ZddZ
dZd
ZRS(sClass 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.
    cCst|_|dkr0t||}t|_n|dkrWt|}|j}n|p`d|_||_||_	||_
||_d|_d|_
t|_|dkr&yddl}Wntk
rtdnX||_|jdd@|_|d	kr|jq&|jn|d
kryddl}Wntk
ratdnX|d	krd|_|j|_q|j|_ndS(s$Construct a _Stream object.
        t*R1ltgziNszlib module is not availablelRZtbz2sbz2 module is not available(Rnt_extfileobjRRRlt_StreamProxytgetcomptypeRR_tcomptypetfileobjtbufsizeRHtpostclosedtzlibtImportErrorRtcrc32tcrct
_init_read_gzt_init_write_gzRtdbuftBZ2Decompressortcmpt
BZ2Compressor(RRR_RRRRR((s/usr/lib64/python2.7/tarfile.pyRsD								
	


	cCs*t|dr&|jr&|jndS(NR(RRR(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jdr|jd |_n|j
|jtd	S(
s6Initialize for writing with gzip compression.
        i	is<Ls%ss
iso-8859-1treplaces.gziN(RtcompressobjtDEFLATEDt	MAX_WBITSt
DEF_MEM_LEVELRR3R5tlongttimet_Stream__writettypeRtunicodeR;tendswithR!(Rt	timestamp((s/usr/lib64/python2.7/tarfile.pyRs
	cCs{|jdkr1|jj||jd@|_n|jt|7_|jdkrj|jj|}n|j|dS(s&Write string s to the stream.
        RlttarN(	RRRRRR RtcompressR(RR"((s/usr/lib64/python2.7/tarfile.pyRQs"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(RHR RRRQ(RR"((s/usr/lib64/python2.7/tarfile.pyt__writescCs|jr
dS|jdkrF|jdkrF|j|jj7_n|jdkr|jr|jj|jd|_|jdkr|jjtj	d|j
d@|jjtj	d|jd@qn|js|jj
nt|_dS(s[Close the _Stream object. No operation should be
           done on it afterwards.
        NR[RR1Rs<Ll(RR_RRHRtflushRRQR3R5RRRRRn(R((s/usr/lib64/python2.7/tarfile.pyRs		#)	cCss|jj|jj|_d|_|jddkrItdn|jddkrmtdnt|jd}|jd|d	@rt|jdd
t|jd}|j	|n|d@rx3t
r|jd}|s
|tkrPqqWn|d@rUx3t
rQ|jd}|sJ|tkr"Pq"q"Wn|d@ro|jdnd
S(s:Initialize for reading a gzip compressed fileobj.
        R1issnot a gzip fileissunsupported compression methodiiiiiN(Rt
decompressobjRRRt
_Stream__readRRR,RORnR!(RtflagtxlenR"((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.pyttellFsicCs||jdkrut||j|j\}}x0t|D]"}|j|j}|s?Pq?q?W|j|ntd|jS(sXSet the stream's file pointer to pos. Negative seeking
           is forbidden.
        is seeking backwards is not allowed(RRNRR+ROR(RRRURVR.tdata((s/usr/lib64/python2.7/tarfile.pytseekKscCs|dkrZg}x3trG|j|j}|s7Pn|j|qWdj|}n|j|}|jt|7_|S(sReturn the next size number of bytes from the stream.
           If size is not defined, return all bytes of the stream
           up to EOF.
        R1N(RRnt_readRR=R>RR (RRR\RH((s/usr/lib64/python2.7/tarfile.pyROZs	cCs|jdkr|j|St|j}|jg}x||kr|j|j}|sbPny|jj|}Wntk
rtdnX|j	||t|7}q:Wdj
|}|||_|| S(s+Return size bytes from the stream.
        Rsinvalid compressed dataR1(RRR RRRt
decompressRPRR=R>(RRRAR\RH((s/usr/lib64/python2.7/tarfile.pyRls"



cCst|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.
        R1(R RHRRORR=R>(RRRAR\RH((s/usr/lib64/python2.7/tarfile.pyt__reads

N(R}R~RRRRRQRRRRRRRORR(((s/usr/lib64/python2.7/tarfile.pyRs		.			
						RcBs2eZdZdZdZdZdZRS(ssSmall proxy class that enables transparent compression
       detection for the Stream interface (mode 'r|*').
    cCs"||_|jjt|_dS(N(RROt	BLOCKSIZERH(RR((s/usr/lib64/python2.7/tarfile.pyRs	cCs|jj|_|jS(N(RRORH(RR((s/usr/lib64/python2.7/tarfile.pyROscCsJ|jjdrdS|jdd!dkrF|jdd!dkrFd	Sd
S(NsRiitBZhii
s1AY&SYRR(RHt
startswith(R((s/usr/lib64/python2.7/tarfile.pyRs
,cCs|jjdS(N(RR(R((s/usr/lib64/python2.7/tarfile.pyRs(R}R~RRRORR(((s/usr/lib64/python2.7/tarfile.pyRs
			t	_BZ2ProxycBsSeZdZd
ZdZdZdZdZdZdZ	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|_|jdS(NR(RR_tgetattrRRtinit(RRR_((s/usr/lib64/python2.7/tarfile.pyRs		cCsbddl}d|_|jdkrO|j|_|jjdd|_n|j|_dS(NiiRZR1(	RRR_Rtbz2objRRRHR(RR((s/usr/lib64/python2.7/tarfile.pyRs	cCs|jg}t|j}x^||kr{|jj|j}|sIPn|jj|}|j||t|7}qWdj||_|j| }|j||_|j	t|7_	|S(NR1(
RHR RROt	blocksizeRRR=R>R(RRRWRtrawRRH((s/usr/lib64/python2.7/tarfile.pyROs

cCs4||jkr|jn|j||jdS(N(RRRO(RR((s/usr/lib64/python2.7/tarfile.pyRs
cCs|jS(N(R(R((s/usr/lib64/python2.7/tarfile.pyRscCs;|jt|7_|jj|}|jj|dS(N(RR RRRRQ(RRR((s/usr/lib64/python2.7/tarfile.pyRQscCs5|jdkr1|jj}|jj|ndS(NR[(R_RRRRQ(RR((s/usr/lib64/python2.7/tarfile.pyRsi@(R}R~RRRRRORRRQR(((s/usr/lib64/python2.7/tarfile.pyRs		
				t_FileInFilecBsSeZdZddZdZdZddZdZdZ	dZ
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(RtoffsetRtsparsetposition(RRRRR((s/usr/lib64/python2.7/tarfile.pyRs
				cCs|jS(s*Return the current file position.
        (R(R((s/usr/lib64/python2.7/tarfile.pyRscCs
||_dS(s(Seek to a position in the file.
        N(R(RR((s/usr/lib64/python2.7/tarfile.pyRscCse|dkr|j|j}nt||j|j}|jdkrT|j|S|j|SdS(s!Read data from the file.
        N(RRRRpRt
readnormalt
readsparse(RR((s/usr/lib64/python2.7/tarfile.pyROs
cCs9|jj|j|j|j|7_|jj|S(s*Read operation for regular files.
        (RRRRRO(RR((s/usr/lib64/python2.7/tarfile.pyRscCs\g}xF|dkrN|j|}|s.Pn|t|8}|j|q	Wdj|S(s)Read operation for sparse files.
        iR1(treadsparsesectionR R=R>(RRRRH((s/usr/lib64/python2.7/tarfile.pyRscCs|jj|j}|dkr%dSt||j|j|j}t|tr|j	|j|j}|j
j|j||j|7_|j
j|S|j|7_t
|SdS(s0Read a single section of a sparse file.
        R1N(RR%RRRpRRt
isinstancet_datatrealposRRROR!(RRtsectionR((s/usr/lib64/python2.7/tarfile.pyR#s N(R}R~RRRRRRORRR(((s/usr/lib64/python2.7/tarfile.pyRs		
		tExFileObjectcBsheZdZdZdZddZddZdZdZ	e
jdZ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(NRRZiR1(RRtoffset_dataRRRRR_RlRRtbuffer(Rttarfilettarinfo((s/usr/lib64/python2.7/tarfile.pyR>s				cCs|jrtdnd}|jrh|dkrH|j}d|_qh|j| }|j||_n|dkr||jj7}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 fileR1N(RRRRRROR R(RRRH((s/usr/lib64/python2.7/tarfile.pyROKs			
 icCs,|jrtdnd|jkr@|jjdd}n|jg}xtr|jj|j}|j||sd|krOdj	||_|jjdd}|dkrt
|j}nPqOqOW|dkrt||}n|j| }|j||_|jt
|7_|S(sRead 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
iR1ii(
RRRR%RnRRORR=R>R RpR(RRRtbuffersRH((s/usr/lib64/python2.7/tarfile.pytreadlinecs(		

cCs:g}x-tr5|j}|s%Pn|j|q	W|S(s0Return a list with all remaining lines.
        (RnRR=(Rtresulttline((s/usr/lib64/python2.7/tarfile.pyt	readliness	cCs|jrtdn|jS(s*Return the current file position.
        sI/O operation on closed file(RRR(R((s/usr/lib64/python2.7/tarfile.pyRs	cCs|jrtdn|tjkrHtt|d|j|_n|tjkr|dkrt|j|d|_qt|j||j|_nC|tj	krtt|j||jd|_ntdd|_
|jj|jdS(s(Seek to a position in the file.
        sI/O operation on closed fileisInvalid argumentR1N(
RRRtSEEK_SETRpRqRRtSEEK_CURtSEEK_ENDRRR(RRtwhence((s/usr/lib64/python2.7/tarfile.pyRs	!(	cCs
t|_dS(sClose the file object.
        N(RnR(R((s/usr/lib64/python2.7/tarfile.pyRsccs,x%tr'|j}|sPn|VqWdS(s/Get an iterator over the file's lines.
        N(RnR(RR((s/usr/lib64/python2.7/tarfile.pyt__iter__s
	N(R}R~RRRRRORRRRRRRR(((s/usr/lib64/python2.7/tarfile.pyR8s	
	
		tFilterErrorcBseZRS((R}R~(((s/usr/lib64/python2.7/tarfile.pyRstAbsolutePathErrorcBseZdZRS(cCs0||_tt|jdt|jdS(Nsmember %s has an absolute path(RtsuperRRtreprR(RR((s/usr/lib64/python2.7/tarfile.pyRs	(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRstOutsideDestinationErrorcBseZdZRS(cCsI||_||_tt|jdt|jt|fddS(Ns%s would be extracted to %s, s which is outside the destination(Rt_pathRRRRR(RRR((s/usr/lib64/python2.7/tarfile.pyRs		+(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRstSpecialFileErrorcBseZdZRS(cCs0||_tt|jdt|jdS(Ns%s is a special file(RRRRRR(RR((s/usr/lib64/python2.7/tarfile.pyRs	(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRstAbsoluteLinkErrorcBseZdZRS(cCs0||_tt|jdt|jdS(Ns %s is a link to an absolute path(RRRRRR(RR((s/usr/lib64/python2.7/tarfile.pyRs	(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRstLinkOutsideDestinationErrorcBseZdZRS(cCsI||_||_tt|jdt|jt|fddS(Ns%s would link to %s, s which is outside the destination(RRRRRRR(RRR((s/usr/lib64/python2.7/tarfile.pyRs		+(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRscCsi}|j}tjj|}|jdtjfr]|jjdtj}|d<ntjj|r~t|ntjjtjj	||}t
||g|krt||n|j}|dk	ry|d@}|rZ|js|jr*|d@s|dM}n|dO}qZ|jsB|jrKd}qZt|n||jkry||d<qyn|r|jdk	rd|d<n|jdk	rd|d	<n|jdk	rd|d
<n|jdk	rd|d<n|js|jrtjj|jr+t|n|jratjj	|tjj||j}ntjj	||j}tjj|}t
||g|krt||qqn|S(
NReRii@iIiR_RRRRi(RRRtrealpathRRhtlstripRvRR>R|RR_RtisregtislnktisdirtissymRRRRRtlinknameRtdirnameR(tmembert	dest_pathtfor_datat	new_attrsRttarget_pathR_((s/usr/lib64/python2.7/tarfile.pyt_get_filtered_attrssZ	$!	



	



cCs|S(N((RR((s/usr/lib64/python2.7/tarfile.pytfully_trusted_filterscCs=t||t}|r9|jitd6|j|S|S(Ntdeep(RRltupdateR(RRR((s/usr/lib64/python2.7/tarfile.pyt
tar_filters

cCs=t||t}|r9|jitd6|j|S|S(NR(RRnRRlR(RRR((s/usr/lib64/python2.7/tarfile.pytdata_filter&s

t
fully_trustedRRcBseZdZddZdZdZeeeZdZdZ	eee	Z
dZeeeeeeeee
ed
Zd	Zeed
dZdZd
ZdZedZdZedZedZedZeedZedZee
dZ edZ!ee
dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)d Z*d!Z+d"Z,d#Z-d$Z.d%Z/d&Z0d'Z1d(Z2d)Z3RS(*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.
    R1cCs||_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.
        iiR1N(RR_RRRRtchksumtREGTYPERRRRtdevmajortdevminorRRtpax_headers(RR((s/usr/lib64/python2.7/tarfile.pyRBs 															cCs|jS(N(R(R((s/usr/lib64/python2.7/tarfile.pyt_getpath[scCs
||_dS(N(R(RR((s/usr/lib64/python2.7/tarfile.pyt_setpath]scCs|jS(N(R(R((s/usr/lib64/python2.7/tarfile.pyt_getlinkpathascCs
||_dS(N(R(RR((s/usr/lib64/python2.7/tarfile.pyt_setlinkpathcscCs d|jj|jt|fS(Ns<%s %r at %#x>(t	__class__R}Rtid(R((s/usr/lib64/python2.7/tarfile.pyt__repr__gscCs|	rtj|}ntj|}||
k	r?||_n||
k	rW||_n||
k	ro||_n||
k	r||_n||
k	r||_n||
k	r||_n||
k	r||_n||
k	r||_	n|S(sGReturn a deep copy of self with the given attributes replaced.
        (
tcopytdeepcopyRRR_RRRRR(RRRR_RRRRRRt_KEEPR((s/usr/lib64/python2.7/tarfile.pyRjs(cCs)|jdkrd}n
|jd@}i
|jd6|d6|jd6|jd6|jd6|jd6|jd6|jd	6|j	d
6|j
d6|jd6|jd
6|j
d6}|d	tkr|djdr|dcd7<nxAdD]9}t||tkr||j||||<qqW|S(s9Return the TarInfo's attributes as a dictionary.
        iRR_RRRRRRRRRR
RReN(snameslinknamesunamesgname(R_RRRRRRRRRRRR
RtDIRTYPERRR;(RR?R@R_tinfotkey((s/usr/lib64/python2.7/tarfile.pytget_infos.	












$
!R9cCs|j||}x9|jD]+\}}|dkrtd|qqW|tkrg|j|S|tkr|j|S|tkr|j	|||StddS(s<Return a tar header as a string of 512 byte blocks.
        s%s may not be Nonesinvalid formatN(
RtitemsRRtUSTAR_FORMATtcreate_ustar_headerR2tcreate_gnu_headert
PAX_FORMATtcreate_pax_header(RR7R?R@RRtvalue((s/usr/lib64/python2.7/tarfile.pyttobufs

cCsyt|d<t|dtkr/tdnt|dtkri|j|d\|d<|d<n|j|tS(s3Return the object as a ustar header block.
        tmagicRslinkname is too longRR{(tPOSIX_MAGICR tLENGTH_LINKRtLENGTH_NAMEt_posix_split_namet_create_headerR(RR((s/usr/lib64/python2.7/tarfile.pyRs
$cCst|d<d}t|dtkrC||j|dt7}nt|dtkrv||j|dt7}n||j|tS(s:Return the object as a GNU header block sequence.
        R#R1RR(	t	GNU_MAGICR R%t_create_gnu_long_headertGNUTYPE_LONGLINKR&tGNUTYPE_LONGNAMER(R2(RRRH((s/usr/lib64/python2.7/tarfile.pyRs
cCst|d<|jj}xddtfddtfddfD]\}}}||kr_q>n||j||}y|jd	Wntk
r|||<q>nXt|||kr>|||<q>q>WxddddfD]\}}	||kr	d||<qn||}d|ko2d|	dknsGt	|t
rt|||<d||<qqW|r|j|}
nd}
|
|j
|tS(sReturn the object as a ustar header block. If it cannot be
           represented this way, prepend a pax extended header sequence
           with supplement information.
        R#RRRRRi RtasciiRiRRiRiiR1(sunamesunamei (sgnamesgnamei (suidi(sgidi(ssizei(smtimei(R$RRR&R%tdecodeR;R<R RtfloatRt_create_pax_generic_headerR(R(RRR?R@RRthnameR#tvalR6RH((s/usr/lib64/python2.7/tarfile.pyR s6




4cCs|j|dtS(sAReturn the object as a pax global header block sequence.
        R(R0tXGLTYPE(tclsR((s/usr/lib64/python2.7/tarfile.pytcreate_pax_global_headerscCs|td }x$|r4|ddkr4|d }qW|t|}|d }|sht|tkrwtdn||fS(sUSplit a name longer than 100 chars into a prefix
           and a name part.
        iiResname is too long(t
LENGTH_PREFIXR R&R(RRR{((s/usr/lib64/python2.7/tarfile.pyR's
cCs|jdt}|dkr-tdnt|jdddt|jddd@d	|t|jd
dd	|t|jddd	|t|jddd
|t|jddd
|d|t|jdddt|jdtd	t|jdddt|jdddt|jddd	|t|jddd	|t|jdddg}tjdt	dj
|}t|t	d}|d d||d}|S(sReturn a header block. info is a dictionary with file
           information, format must be one of the *_FORMAT constants.
        RsTarInfo.type must not be NoneRR1idR_iiiRRRiRs        RR#Ri RR
RR{is%dsis%06oiN(tgetR	RRR$R8R$R3R5RR>RK(RR7tfiletypetpartsRHR((s/usr/lib64/python2.7/tarfile.pyR(s,cCs@tt|t\}}|dkr<|t|t7}n|S(sdReturn the string payload filled with zero bytes
           up to the next 512 byte border.
        i(RNR RR!(tpayloadRURV((s/usr/lib64/python2.7/tarfile.pyt_create_payload<s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
././@LongLinkRRRR#(R!R R)R(RR;(R4RRR((s/usr/lib64/python2.7/tarfile.pyR*Fs



c
Csg}x|jD]\}}|jd}|jd}t|t|d}d}}x6tr|tt|}||krPn|}qdW|jd|||fqWdj|}i}	d|	d<||	d<t||	d	<t|	d
<|j|	t	|j
|S(sReturn a POSIX.1-2001 extended or global header sequence
           that contains a list of keyword, value pairs. The values
           must be unicode objects.
        R:iis	%d %s=%s
R1s././@PaxHeaderRRRR#(t	iteritemsR;R RnRkR=R>R$R(RR;(
R4RRtrecordstkeywordR!R0R-R&R((s/usr/lib64/python2.7/tarfile.pyR0Ws(
	



cCs
|j|S(sConstruct a TarInfo object from a 512 byte string buffer.

        To support the old v7 tar format AREGTYPE headers are
        transformed to DIRTYPE headers if their name ends in '/'.
        (t_frombuf(R4RH((s/usr/lib64/python2.7/tarfile.pytfrombufwscCsQt|dkr!tdnt|tkrBtdn|jttkrftdnt|dd!}|t|krt	dn|}||_
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!}|r|jtkr|jjdrt|_n|jr!|jjd|_n|rM|jtkrM|d|j|_n|S(s]Construct a TarInfo object from a 512 byte string buffer.

        If ``dircheck`` is set to ``True`` then ``AREGTYPE`` headers will
        be normalized to ``DIRTYPE`` if the name ends in a trailing slash.
        ``dircheck`` must be set to ``False`` if this function is called
        on a follow-up header such as ``GNUTYPE_LONGNAME``.
        isempty headerstruncated headersend of file headeriisbad checksumidiliti|iiii	i)iIiQiYiRe(R RRRtcountR!RR/RKR*RHR'RR_RRRRRRRRRR
RtAREGTYPERRRtrstript	GNU_TYPES(R4RHtdircheckRtobjR{((s/usr/lib64/python2.7/tarfile.pyR?s@				'cCs
|j|S(sOReturn the next TarInfo object from TarFile object
           tarfile.
        (t_fromtarfile(R4R((s/usr/lib64/python2.7/tarfile.pytfromtarfilescCsJ|jjt}|j|d|}|jjt|_|j|S(s;
        See dircheck documentation in _frombuf().
        RE(RRORR?RRt_proc_member(R4RRERHRF((s/usr/lib64/python2.7/tarfile.pyRGscCst|jttfkr"|j|S|jtkr>|j|S|jtttfkrc|j	|S|j
|SdS(sYChoose the right processing method depending on
           the type and call it.
        N(RR,R+t
_proc_gnulongtGNUTYPE_SPARSEt_proc_sparsetXHDTYPER3tSOLARIS_XHDTYPEt	_proc_paxt
_proc_builtin(RR((s/usr/lib64/python2.7/tarfile.pyRIs


cCsx|jj|_|j}|js6|jtkrO||j|j7}n||_|j	|j
|j|j|S(sfProcess a builtin type or an unknown type which
           will be treated as a regular file.
        (
RRRRRtSUPPORTED_TYPESt_blockRRt_apply_pax_infoRR?R@(RRR((s/usr/lib64/python2.7/tarfile.pyRPs		cCs|jj|j|j}y|j|dt}Wntk
rVtdnX|j|_|j	t
krt||_n!|j	t
krt||_n|S(sSProcess the blocks that hold a GNU longname
           or longlink member.
        REs missing or bad subsequent header(RRORRRRGRlRRRRR,R'RR+R(RRRHtnext((s/usr/lib64/python2.7/tarfile.pyRJs
cCss|j}t}d}d}d}xtdD]}y6t|||d!}t||d|d!}	Wntk
rPnX||kr|jt|||n|jt||	|||	7}||	}|d7}q1Wt|d}
t|dd!}x|
d	kr|j	j
t}d
}xtdD]}y6t|||d!}t||d|d!}	Wntk
rPnX||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.
        iliiiiiiiiii(RHt_ringbufferR+R/RR=t_holeRR,RRORRRRRRRR(RRRHtspRtlastposRR.Rtnumbytest
isextendedtorigsize((s/usr/lib64/python2.7/tarfile.pyRLsT		





		cCs|jj|j|j}|jtkr9|j}n|jj}d}xst||kr||dkrt	j
||}|stdnyt|j
d}Wntk
rtdnX|dkrtdn||t|krtdn|jd|d}||jdd|!}|jd\}	}
}|	s|
dks||dkrtdn|	jd}|jd}
|
||<||7}qQWy|j|d	t}Wntk
rtd
nX|jttfkr|j||j|j|j|_d|kr|j}|jsg|jtkr||j|j7}n||_qn|S(sVProcess an extended or global header as described in
           POSIX.1-2001.
        iRsinvalid headeriit=s
R:REs missing or bad subsequent headerR( RRORRRRR3RRR t_header_length_prefix_retmatchR*R)tgroupRtstarttendt	partitionR.RGRlRRRMRNRSR?R@RRRRQ(RRRHRRR^R#theader_value_end_offsettkeyword_and_valuetraw_keywordtequalst	raw_valueR>R!RTR((s/usr/lib64/python2.7/tarfile.pyRO;sN%
#

	cCsx|jD]\}}|tkr+q
n|dkrI|jd}n|tkryt||}Wqtk
rd}qXnt|||}t|||q
W|j|_dS(soReplace fields with supplemental information from a previous
           pax extended or global header.
        RReiN(	R<t
PAX_FIELDSRCtPAX_NUMBER_FIELDSRRBtsetattrRR(RRR?R@R>R!((s/usr/lib64/python2.7/tarfile.pyRSs

cCsK|dkrtdnt|t\}}|rC|d7}n|tS(s_Round up a byte count by BLOCKSIZE and return it,
           e.g. _block(834) => 1024.
        isinvalid offseti(R*RNR(RRARURV((s/usr/lib64/python2.7/tarfile.pyRRs
cCs
|jtkS(N(Rt
REGULAR_TYPES(R((s/usr/lib64/python2.7/tarfile.pyRscCs
|jS(N(R(R((s/usr/lib64/python2.7/tarfile.pytisfilescCs
|jtkS(N(RR(R((s/usr/lib64/python2.7/tarfile.pyRscCs
|jtkS(N(RtSYMTYPE(R((s/usr/lib64/python2.7/tarfile.pyRscCs
|jtkS(N(RtLNKTYPE(R((s/usr/lib64/python2.7/tarfile.pyRscCs
|jtkS(N(RtCHRTYPE(R((s/usr/lib64/python2.7/tarfile.pytischrscCs
|jtkS(N(RtBLKTYPE(R((s/usr/lib64/python2.7/tarfile.pytisblkscCs
|jtkS(N(RtFIFOTYPE(R((s/usr/lib64/python2.7/tarfile.pytisfifoscCs
|jtkS(N(RRK(R((s/usr/lib64/python2.7/tarfile.pytissparsescCs|jtttfkS(N(RRoRqRs(R((s/usr/lib64/python2.7/tarfile.pytisdevs(4R}R~RRR
RtpropertyRRRRRRRnRRtDEFAULT_FORMATtENCODINGR"RRR tclassmethodR5R'tstaticmethodR(R;R*RMR0R@R?RHRGRIRPRJRLRORSRRRRlRRRRpRrRtRuRv(((s/usr/lib64/python2.7/tarfile.pyR:s^						 	
		3	"
	2	
			8	I											s([0-9]{1,20}) c
BseZdZdZeZeZdZeZ	e
Zd7Z
eZeZd7Zd7dd7d7d7d7d7d7d7d7d7d7dZdZdZeeeZed7dd7edZedd7dZedd7d	d
Zedd7d	dZidd
6dd6dd6ZdZdZ dZ!dZ"d7d7d7dZ#e$dZ%d7e$d7d7dZ&d7dZ'dZ(dd7d7dZ)dd7dZ*dZ+e$d Z,d!Z-d"Z.d#Z/e$d$Z0d%Z1d&Z2d'Z3d(Z4d)Z5d*Z6d+Z7d,Z8d-Z9d.Z:d7ed/Z;d0Z<d7d1Z=d2Z>d3Z?d4Z@d5ZAd6ZBRS(8s=The TarFile Class provides an interface to tar archives.
    iiRZc
Cst|dks|dkr-tdn||_idd6dd6dd	6||_|s|jdkrtjj|rd	|_d|_nt||j}t|_	nN|dkrt|d
r|j}nt|dr|j|_nt
|_	|rtjj|nd|_||_|dk	rC||_n|dk	r[||_n|dk	rs||_n|dk	r||_n|dk	r||_n|	dk	r|	|_n!|dkrd|_n	d
|_|
dk	r|jtkr|
|_n	i|_|dk	r$||_n|dk	r<||_nt|_g|_t|_|jj|_i|_y9|jdkrd|_ |j!|_ n|jdkrCxt
r?|jj"|jy&|jj#|}|jj$|Wqt%k
r|jj"|jPqt&k
r;}
t't(|
qXqWn|jdkrt
|_|jr|jj)|jj*}|jj+||jt|7_qnWn,|j	s|jj,nt
|_nXdS(sOpen 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.
        iRsmode must be 'r', 'a' or 'w'trbRZsr+btatwbR[RR_sutf-8R9tawN(-R RR_t_modeRRtexistst	bltn_openRlRRRRRntabspathRR7Rtdereferencetignore_zerosR?R@RRtdebugt
errorlevelRtmemberst_loadedRRtinodestfirstmemberRTRRHR=RRRRkR5RRQR(RRR_RR7RRRR?R@RRRteRH((s/usr/lib64/python2.7/tarfile.pyRs	""		!									
				cCs
|jtkS(N(R7R(R((s/usr/lib64/python2.7/tarfile.pyt	_getposixBscCs>ddl}|jdtd|r1t|_n	t|_dS(Nis use the format attribute insteadi(twarningstwarntDeprecationWarningRR7R2(RR!R((s/usr/lib64/python2.7/tarfile.pyt	_setposixDscKs|r|rtdn|dkrx|jD]}t||j|}|dk	rj|j}ny||d||SWq3ttfk
r}	|dk	r3|j|q3q3q3Xq3Wtdn4d|krV|jdd\}
}|
pd}
|pd}||jkr3t||j|}ntd||||
||Sd	|kr|jd	d\}
}|
pd}
|pd}|
d
krtdn|||
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:iRsunknown compression type %rt|trwsmode must be 'r' or 'w'Rsundiscernible modeN(RZsr:*(
Rt	OPEN_METHRRRRRRRoRRlRttaropen(R4RR_RRtkwargsRtfunct	saved_posRRdR\((s/usr/lib64/python2.7/tarfile.pyRYsH			cKs@t|dks|dkr-tdn|||||S(sCOpen uncompressed tar archive name for reading or writing.
        iRsmode must be 'r', 'a' or 'w'(R R(R4RR_RR((s/usr/lib64/python2.7/tarfile.pyRsi	c	Kst|dks|dkr-tdnyddl}|jWn#ttfk
ritdnX|dkrt||d}ny.|j	|||j|||||}Wnt
k
rtdnXt|_
|S(	skOpen gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        iRsmode must be 'r' or 'w'iNsgzip module is not availableRWsnot a gzip file(R RtgziptGzipFileRtAttributeErrorRRRRRPRRlR(R4RR_Rt
compresslevelRRR\((s/usr/lib64/python2.7/tarfile.pytgzopens"

	cKst|dks|dkr-tdnyddl}Wntk
r\tdnX|dk	r{t||}n|j||d|}y|j||||}Wn#t	t
fk
rtdnXt|_
|S(	slOpen bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
        iRsmode must be 'r' or 'w'.iNsbz2 module is not availableRsnot a bzip2 file(R RRRRRRtBZ2FileRRPtEOFErrorRRlR(R4RR_RRRRR\((s/usr/lib64/python2.7/tarfile.pytbz2opens
	RRRRRRcCs|jr
dS|jdkr|jjttd|jtd7_t|jt\}}|dkr|jjtt|qn|j	s|jj
nt|_dS(slClose the TarFile. In write-mode, two finishing zero blocks are
           appended to the archive.
        NRii(RR_RRQR!RRRNt
RECORDSIZERRRn(RRURV((s/usr/lib64/python2.7/tarfile.pyRs		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
_getmemberRtKeyError(RRR((s/usr/lib64/python2.7/tarfile.pyt	getmemberscCs'|j|js |jn|jS(sReturn the members of the archive as a list of TarInfo objects. The
           list has the same order as the members in the archive.
        (t_checkRt_loadR(R((s/usr/lib64/python2.7/tarfile.pyt
getmemberss
	
cCs g|jD]}|j^q
S(sReturn the members of the archive as a list of their names. It has
           the same order as the list returned by getmembers().
        (RR(RR((s/usr/lib64/python2.7/tarfile.pytgetnamessc	Cs\|jd|d
k	r%|j}n|d
kr:|}ntjj|\}}|jtjd}|jd}|j	}||_
|d
krttdr|jrtj
|}qtj|}ntj|j}d}|j}tj|r|j|jf}	|jrj|jdkrj|	|jkrj||j|	krjt}
|j|	}qt}
|	dr||j|	<qntj|rt}
nstj|rt}
n[tj|rt}
tj|}n4tj |rt!}
ntj"|rt#}
nd
S||_||_$|j%|_&|j'|_(|
tkr]|j)|_*n	d|_*|j+|_,|
|_-||_.t/ryt/j0|j&d|_1Wqt2k
rqXnt3ryt3j4|j(d|_5Wqt2k
rqXn|
t!t#fkrXttdrXttd	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.
        RRetlstatR1iiltmajortminorN(;RRRRRt
splitdriveRRhRRRRRRtstattfstattfilenotst_modetS_ISREGtst_inotst_devtst_nlinkRRnR	tS_ISDIRRtS_ISFIFORstS_ISLNKRmtreadlinktS_ISCHRRotS_ISBLKRqR_tst_uidRtst_gidRtst_sizeRtst_mtimeRRRtpwdtgetpwuidRRtgrptgetgrgidRRtst_rdevR
RR(RRtarcnameRtdrvRtstatresRtstmdtinodeR((s/usr/lib64/python2.7/tarfile.pyt
gettarinfos~
			"
									

cCs8|jx'|D]}|r|jd
kr3dGn
t|jGd|jpR|j|jpa|jfG|js~|j	rdd|j
|jfGnd|jG|j
d
krdGqdtj|j
d Gn|j|jrd	nd
G|r/|jrdG|jGn|jr/dG|jGq/nHqWd
S(sPrint 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%s/%ss%10ss%d,%ds%10ds????-??-?? ??:??:??s%d-%02d-%02d %02d:%02d:%02diReR1s->slink toN(RR_RRdRRRRRpRrR
RRRRt	localtimeRRRRR(RtverboseR((s/usr/lib64/python2.7/tarfile.pytlistxs.


c	Cs|jd|dkr"|}n|dk	rtddl}|jdtd||rt|jdd|dSn|jdk	rtjj	||jkr|jdd|dS|jd||j
||}|dkr|jdd	|dS|dk	r;||}|dkr;|jdd|dSn|jrrt|d
}|j
||WdQXn|jr|j
||rxQtj|D]=}|jtjj||tjj|||||qWqn
|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.
        RiNsuse the filter argument insteadistarfile: Excluded %rstarfile: Skipped %ristarfile: Unsupported type %rR|(RRRRRt_dbgRRRRRRRtaddfileRtlistdirtaddR>(	RRRt	recursivetexcludetfilterRRtf((s/usr/lib64/python2.7/tarfile.pyRsB
		
*
*cCs|jdtj|}|j|j|j|j}|jj||jt	|7_|dk	rt||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.
        RiiN(RRR"R7R?R@RRQRR RRMRRNRR!RR=(RRRRHRURV((s/usr/lib64/python2.7/tarfile.pyRs

cCs|dkrO|j}|dkr%tSt|trKtdddn|St|r_|Syt|SWn'tk
rt	dt
|nXdS(Ns#String names are not supported for s2TarFile.extraction_filter. Use a function such as starfile.data_filter directly.sfilter %s not found(Rtextraction_filterRRRkt	TypeErrortcallablet_NAMED_FILTERSRRR(RR((s/usr/lib64/python2.7/tarfile.pyt_get_filter_functions	
Rfc
CsAg}|j|}|dkr*|}nxw|D]o}|j|||}|dkr^q1n|jr|j||j||dtq1|j||q1W|jdddtx}|D]u}t	j
j||j}y4|j
|||j|||j||Wqtk
r8}	|j|	qXqWdS(s/Extract 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().

           The `filter` function will be called on each member just
           before extraction.
           It can return a changed TarInfo or None to skip the member.
           String names of common filters are accepted.
        t	set_attrsRcSs|jS(N(R(R}((s/usr/lib64/python2.7/tarfile.pyt<lambda>&	streverseN(RRt_get_extract_tarinfoRR=t_extract_oneRltsortRnRRR>RtchowntutimetchmodRt_handle_nonfatal_error(
RRRRtdirectoriestfilter_functionRRtdirpathR((s/usr/lib64/python2.7/tarfile.pyt
extractall	s*	


R1cCsG|j|}|j|||}|dk	rC|j||ndS(sExtract 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'.

           The `filter` function will be called before extraction.
           It can return a changed TarInfo or None to skip the member.
           String names of common filters are accepted.
        N(RRRR(RRRRRR((s/usr/lib64/python2.7/tarfile.pytextract2	s
cCst|tr!|j|}n|}|}y|||}WnEttfk
rh}|j|n tk
r}|j|nX|dkr|j	dd|j
dS|jrtj|}t
jj||j|_n|S(s@Get filtered TarInfo (or None) from member, which might be a stristarfile: Excluded %rN(Rt
basestringRtOSErrorRt_handle_fatal_errorRRRRRRRRRR>Rt_link_target(RRRRRt
unfilteredR((s/usr/lib64/python2.7/tarfile.pyRA	s"cCs||jdy)|j|tjj||j|Wn?tk
rX}|j|n tk
rw}|j	|nXdS(s%Extract from filtered tarinfo to diskRZN(
Rt_extract_memberRRR>RRRRR(RRRRR((s/usr/lib64/python2.7/tarfile.pyRX	s
)cCsNt|jtr>|jdkr'qJ|jdd|ntddS(s=Handle non-fatal error (ExtractError) according to errorlevelistarfile: %sserror level is not an integerN(RRR)RR(RR((s/usr/lib64/python2.7/tarfile.pyRc	s
cCst|jtr|jdkr'qt|jttgkr|jdkrk|j	dd|j
q|j	dd||j	dd|j
|jfq|j	ddt|j|fntddS(s1Handle "fatal" error according to self.errorleveliistarfile: %sstarfile: %s %rstarfile: %s %sserror level is not an integerN(RRR)RR}tEnvironmentErrorRtfilenameRRtstrerrorR(RR((s/usr/lib64/python2.7/tarfile.pyRm	s#&cCs|jdt|tr.|j|}n|}|jrP|j||S|jtkro|j||S|js|j	rt|j
trtdq|j
|j|SndSdS(sExtract 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(RRRRRt
fileobjectRRQRRRRRtextractfilet_find_link_targetR(RRR((s/usr/lib64/python2.7/tarfile.pyR}	s	
cCs|jd}|jdtj}tjj|}|r_tjj|r_tj|n|jsw|j	r|j
dd|j|jfn|j
d|j|j
r|j||n|jr|j||n|jr
|j||n|js"|jr5|j||n]|jsM|j	r`|j||n2|jtkr|j||n|j|||r|j|||j	s|j|||j||qndS(s\Extract the TarInfo object tarinfo to a physical
           file called targetpath.
        Reis%s -> %sN(RCRRRhRRRtmakedirsRRRRRRtmakefileRtmakedirRttmakefifoRpRrtmakedevtmakelinkRRQtmakeunknownRRR(RRt
targetpathRt	upperdirs((s/usr/lib64/python2.7/tarfile.pyR	s4#cCsey3|jdkr"tj|ntj|dWn+tk
r`}|jtjkraqanXdS(s,Make a directory called targetpath.
        iN(R_RRtmkdirRterrnotEEXIST(RRRR((s/usr/lib64/python2.7/tarfile.pyR	scCsJ|j|}z)t|d}t||WdQXWd|jXdS(s'Make a file called targetpath.
        R~N(RRRMR(RRRtsourcettarget((s/usr/lib64/python2.7/tarfile.pyR	s
cCs+|j|||jdd|jdS(sYMake a file from a TarInfo object with an unknown type
           at targetpath.
        is9tarfile: Unknown file type %r, extracted as regular file.N(RRR(RRR((s/usr/lib64/python2.7/tarfile.pyR	scCs/ttdrtj|ntddS(s'Make a fifo called targetpath.
        tmkfifosfifo not supported by systemN(RRRR(RRR((s/usr/lib64/python2.7/tarfile.pyR	scCsttds ttdr/tdn|j}|dkrMd}n|jri|tjO}n
|tjO}tj	||tj
|j|jdS(s<Make a character or block device called targetpath.
        tmknodRs'special devices not supported by systemiN(
RRRR_RRrRtS_IFBLKtS_IFCHRRRR
R(RRRR_((s/usr/lib64/python2.7/tarfile.pyR	s 		
cCsttdrttdr|jrbtjj|rLtj|ntj|j|qtjj|j	rtjj|rtj|ntj
|j	|q|j|j||n=y|j|j||Wnt
k
rtdnXdS(sMake 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(RRRRtlexiststunlinkRRRRR	RRRR(RRR((s/usr/lib64/python2.7/tarfile.pyR
s
cCsHtrDttdrDtjdkrD|j}|j}ytj|jd}Wnt	k
rfnXytj
|jd}Wnt	tfk
rnX|dkrd}n|dkrd}nyZ|jrttdrtj|||n%tjdkrtj|||nWqDtk
r@}tdqDXndS(	s6Set owner of targetpath according to tarinfo.
        tgeteuidiiitlchowntos2emxscould not change ownerN(RRRRRRRtgetgrnamRRtgetpwnamRRRRR
tsystplatformRRR(RRRRtuR((s/usr/lib64/python2.7/tarfile.pyR&
s,'		
		cCsb|jdkrdSttdr^ytj||jWq^tk
rZ}tdq^XndS(sASet file permissions of targetpath according to tarinfo.
        NRscould not change mode(R_RRRRRR(RRRR((s/usr/lib64/python2.7/tarfile.pyRD
scCsl|j}|dkrdSttds,dSytj|||fWntk
rg}tdnXdS(sBSet modification time of targetpath according to tarinfo.
        NRs"could not change modification time(RRRRRRR(RRRRR((s/usr/lib64/python2.7/tarfile.pyRO
s	cCs|jd|jdk	r2|j}d|_|S|jj|jd}xktry|jj|}WnGt	k
r}|j
r|jdd|j|f|jt7_qNqnt
k
r+}|j
r|jdd|j|f|jt7_qNq|jdkrtt|qntk
rY|jdkrtdqn[tk
r}|jdkrtt|qn%tk
r}tt|nXPqNW|dk	r|jj|n	t|_|S(sReturn 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(RRRRRRRnRRHRRRRR*RRkRRRRR=R(RtmRR((s/usr/lib64/python2.7/tarfile.pyRT]
sF
						
	c	Cs|j}t}|dk	rXy|j|}Wntk
rJt}qXX|| }n|rstjj|}nxrt	|D]d}|r|j
|j
krt}qqn|rtjj|j}n	|j}||kr|SqW|rt|ndS(s}Find an archive member by name from bottom to top.
           If tarinfo is given, it is used as the starting point.
        N(RRlRtindexRRnRRtnormpathtreversedRR(	RRRt	normalizeRtskippingRRtmember_name((s/usr/lib64/python2.7/tarfile.pyR
s,


		cCs6x&tr(|j}|dkrPqqWt|_dS(sWRead through the entire archive file and look for readable
           members.
        N(RnRTRR(RR((s/usr/lib64/python2.7/tarfile.pyR
s
	cCsW|jr"td|jjn|dk	rS|j|krStd|jndS(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(RRPRR}RR_(RR_((s/usr/lib64/python2.7/tarfile.pyR
s	cCs|jrEdjtdtjj|j|jf}d}n|j}|}|j	|d|dt
}|dkrtd|n|S(sZFind the target member of a symlink or hardlink member in the
           archive.
        ReRRslinkname %r not foundN(RR>RRRRRRRRRnR(RRRtlimitR((s/usr/lib64/python2.7/tarfile.pyR
s0		cCs$|jrt|jSt|SdS(s$Provide an iterator object.
        N(RtiterRtTarIter(R((s/usr/lib64/python2.7/tarfile.pyR
s	
cCs#||jkrtj|IJndS(s.Write debugging output to sys.stderr.
        N(RRtstderr(Rtleveltmsg((s/usr/lib64/python2.7/tarfile.pyR
scCs|j|S(N(R(R((s/usr/lib64/python2.7/tarfile.pyt	__enter__
s
cCs?|dkr|jn"|js2|jjnt|_dS(N(RRRRRnR(RRR!t	traceback((s/usr/lib64/python2.7/tarfile.pyt__exit__
s

	N(CR}R~RRRlRRRRxR7RyR?RR@RRRRRRRRRwtposixRzRRRRRRRRRRRRnRRRRRRRRRRRRRRRRRRRRRRTRRRRRRR"R$(((s/usr/lib64/python2.7/tarfile.pyRsd		
H
			
	b%=	,		
		&0		
								1(	
					RcBs)eZdZdZdZdZRS(sMIterator Class.

       for tarinfo in TarFile(...):
           suite...
    cCs||_d|_dS(s$Construct a TarIter object.
        iN(RR(RR((s/usr/lib64/python2.7/tarfile.pyRs	cCs|S(s Return iterator object.
        ((R((s/usr/lib64/python2.7/tarfile.pyRscCs|jdkr3|jjdk	r3|jj}np|jt|jjkrd|jj|j}n?|jjs|jj}|st|j_t	qnt	|jd7_|S(sReturn the next item using TarFile's next() method.
           When all members have been read, set TarFile as _loaded.
        iiN(
RRRRRTR RRRnt
StopIteration(RR((s/usr/lib64/python2.7/tarfile.pyRT	s!(R}R~RRRRT(((s/usr/lib64/python2.7/tarfile.pyR
s		t_sectioncBs eZdZdZdZRS(s$Base class for _data and _hole.
    cCs||_||_dS(N(RR(RRR((s/usr/lib64/python2.7/tarfile.pyR#s	cCs%|j|ko"|j|jkSS(N(RR(RR((s/usr/lib64/python2.7/tarfile.pyt__contains__&s(R}R~RRR((((s/usr/lib64/python2.7/tarfile.pyR' s	RcBseZdZdZRS(s/Represent a data section in a sparse file.
    cCs tj|||||_dS(N(R'RR(RRRR((s/usr/lib64/python2.7/tarfile.pyR,s(R}R~RR(((s/usr/lib64/python2.7/tarfile.pyR)sRVcBseZdZRS(s/Represent a hole section in a sparse file.
    (R}R~R(((s/usr/lib64/python2.7/tarfile.pyRV0sRUcBs eZdZdZdZRS(sMRingbuffer class which increases performance
       over a regular list.
    cCs
d|_dS(Ni(tidx(R((s/usr/lib64/python2.7/tarfile.pyR9scCsu|j}x\trg||}||kr,Pn|d7}|t|krQd}n||jkrdSqW||_|S(Nii(R)RnR R(RRR)titem((s/usr/lib64/python2.7/tarfile.pyR%;s		

		(R}R~RRR%(((s/usr/lib64/python2.7/tarfile.pyRU5s	t
TarFileCompatcBsteZdZdedZdZdZdZdZdZ	dZ
ddd	Zd
Z
dZRS(
sRTarFile class compatible with standard module zipfile's
       ZipFile class.
    RZcCsddlm}|ddd|tkrDtj|||_n0|tkrhtj|||_ntd|dd!d	kr|jj	}xB|D]7}|j
|_|j|_
tj|jd
 |_qWndS(Ni(twarnpy3ks6the TarFileCompat class has been removed in Python 3.0t
stacklevelisunknown compression constantiiRZi(RR,t	TAR_PLAINRRRtTAR_GZIPPEDRRRRRRt	file_sizeRtgmtimeRt	date_time(RtfileR_tcompressionR,RR((s/usr/lib64/python2.7/tarfile.pyRSs	
cCstd|jS(NcSs|jS(N(R(R((s/usr/lib64/python2.7/tarfile.pyRds(Rjtinfolist(R((s/usr/lib64/python2.7/tarfile.pytnamelistcscCstd|jjS(NcSs
|jtkS(N(RRk(R((s/usr/lib64/python2.7/tarfile.pyRfs(RRR(R((s/usr/lib64/python2.7/tarfile.pyR5es	cCs|jjdS(N(RR(R((s/usr/lib64/python2.7/tarfile.pytprintdirhscCsdS(N((R((s/usr/lib64/python2.7/tarfile.pyttestzipjscCs|jj|S(N(RR(RR((s/usr/lib64/python2.7/tarfile.pytgetinfolscCs"|jj|jj|jS(N(RRRRO(RR((s/usr/lib64/python2.7/tarfile.pyROnscCs|jj||dS(N(RR(RRRt
compress_type((s/usr/lib64/python2.7/tarfile.pyRQpscCsyddlm}Wn!tk
r7ddlm}nXddl}t|j}t||_|j|j	|_
|jj|||dS(Ni(tStringIO(
t	cStringIOR;RtcalendarRRR RttimegmR2RRR(RtzinfotbytesR;R=ttinfo((s/usr/lib64/python2.7/tarfile.pytwritestrrs
cCs|jjdS(N(RR(R((s/usr/lib64/python2.7/tarfile.pyR|sN(R}R~RR.RR6R5R7R8R9RORRQRBR(((s/usr/lib64/python2.7/tarfile.pyR+Os							
cCs7yt|}|jtSWntk
r2tSXdS(sfReturn True if name points to a tar archive that we
       are able to handle, else return False.
    N(RRRnRRl(RR\((s/usr/lib64/python2.7/tarfile.pyRs

(Rt__version__tversiont
__author__t__date__t	__cvsid__t__credits__RRRLRRRR3RtretoperatorRRRRRt__all__R!RRR)R$R&R%R6R	RBRnRmRoRqRRstCONTTYPER,R+RKRMR3RNRR2RRxRQRkRDRhR/R)RitS_IFLNKtS_IFREGRtS_IFDIRRtS_IFIFOtTSUIDtTSGIDtTSVTXtTUREADtTUWRITEtTUEXECtTGREADtTGWRITEtTGEXECtTOREADtTOWRITEtTOEXECtgetfilesystemencodingRytgetdefaultencodingR$R'R/R8RBRKRMR^RdR|t	ExceptionRRRRRRRRRR*RRRtobjectRRRRRRRRRRRnRRRRRRRtcompiletUR]RRR'RRVRRUR.R/R+RRR(((s/usr/lib64/python2.7/tarfile.pyt<module>sT

					
						
					
	
	
			 AL?			
	='	4	
Back to Directory File Manager