%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/tarfile.pyc


Mac
@sGdZdZdZdZdZdZdZddlmZ	dd	l
Z
dd	lZdd	lZdd	l
Z
dd	lZdd	lZdd	lZdd	lZdd	lZdd	lZydd	lZdd	lZWnek
reZZnXd
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
jMZNeNekre
jOZNnd?ZPd@ZQdAZRd=e3dBZSdCZTdDZUedEZVe;dFfe<dGfe=dHfe>dIfe?dJfe@dKffeDdLffeEdMffeFeABdNfeAdfeFd ffeGdLffeHdMffeIeBBdNfeBdfeId ffeJdLffeKdMffeLeCBdOfeCdPfeLd fff
ZWdQZXd
eYfdRYZZdSeZfdTYZ[dUeZfdVYZ\dWeZfdXYZ]dYeZfdZYZ^d[eZfd\YZ_d]e_fd^YZ`d_e_fd`YZadae_fdbYZbdce_fddYZcdee_fdfYZddgfdhYZedifdjYZfdkegfdlYZhdmegfdnYZidoegfdpYZjdqegfdrYZkdegfdsYZld
egfdtYZmdufdvYZndwfdxYZodyeofdzYZpd{eofd|YZqd}erfd~YZsd#Ztd=ZudfdYZvdZwemjZd	S(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.i(topenNtTarFiletTarInfot
is_tarfiletTarErrorsiisustar  sustar00idit0t1t2t3t4t5t6t7tLtKtStxtgtXiiitpathtlinkpathtsizetmtimetuidtgidtunametgnametatimetctimeiii`i@i iiiiii@i iiicCs|| |t|tS(s@Convert a python string to a null-terminated string buffer.
    (tlentNUL(tstlength((s#/usr/local/lib/python2.7/tarfile.pytstnscCs'|jd}|dkr|S|| S(s?Convert a null-terminated string field to a python string.
    si(tfind(Rtp((s#/usr/local/lib/python2.7/tarfile.pytntsscCs|dtdkr^y%tt|jp1dd}Wqtk
rZtdqXnId}x@tt|dD](}|dK}|t||d7}q{W|S(s/Convert a number field to a python number.
    iiRisinvalid headerli(	tchrtintR$tstript
ValueErrortInvalidHeaderErrortxrangeRtord(Rtnti((s#/usr/local/lib/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 fieldR
tltii(Rt
GNU_FORMATR(tstructtunpacktpackR*R%(R,tdigitstformatRR-((s#/usr/local/lib/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-8tstricttutf8R0N(tencodetUnicodeEncodeErrortappendtjoin(RtencodingterrorsRtc((s#/usr/local/lib/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(tsumR2R3(tbuftunsigned_chksumt
signed_chksum((s#/usr/local/lib/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@(	tNonetshutiltcopyfileobjtdivmodR*treadRtIOErrortwrite(tsrctdstR tBUFSIZEtblockst	remaindertbRG((s#/usr/local/lib/python2.7/tarfile.pyRMs$R/t-RWtdR@R#trtwRtttTcCsig}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()
    RXR0(tfilemode_tableR<R=(tmodetpermttabletbittchar((s#/usr/local/lib/python2.7/tarfile.pytfilemode7s

cBseZdZRS(sBase exception.(t__name__t
__module__t__doc__(((s#/usr/local/lib/python2.7/tarfile.pyRFstExtractErrorcBseZdZRS(s%General exception for extract errors.(ReRfRg(((s#/usr/local/lib/python2.7/tarfile.pyRhIst	ReadErrorcBseZdZRS(s&Exception for unreadable tar archives.(ReRfRg(((s#/usr/local/lib/python2.7/tarfile.pyRiLstCompressionErrorcBseZdZRS(s.Exception for unavailable compression methods.(ReRfRg(((s#/usr/local/lib/python2.7/tarfile.pyRjOstStreamErrorcBseZdZRS(s=Exception for unsupported operations on stream-like TarFiles.(ReRfRg(((s#/usr/local/lib/python2.7/tarfile.pyRkRstHeaderErrorcBseZdZRS(s!Base exception for header errors.(ReRfRg(((s#/usr/local/lib/python2.7/tarfile.pyRlUstEmptyHeaderErrorcBseZdZRS(sException for empty headers.(ReRfRg(((s#/usr/local/lib/python2.7/tarfile.pyRmXstTruncatedHeaderErrorcBseZdZRS(s Exception for truncated headers.(ReRfRg(((s#/usr/local/lib/python2.7/tarfile.pyRn[stEOFHeaderErrorcBseZdZRS(s"Exception for end of file headers.(ReRfRg(((s#/usr/local/lib/python2.7/tarfile.pyRo^sR)cBseZdZRS(sException for invalid headers.(ReRfRg(((s#/usr/local/lib/python2.7/tarfile.pyR)astSubsequentHeaderErrorcBseZdZRS(s3Exception for missing and invalid extended headers.(ReRfRg(((s#/usr/local/lib/python2.7/tarfile.pyRpdst
_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_TRUNCthasattrRrRtfd(tselftnameR_((s#/usr/local/lib/python2.7/tarfile.pyt__init__qs
cCstj|jdS(N(RstcloseRy(Rz((s#/usr/local/lib/python2.7/tarfile.pyR}zscCstj|j|S(N(RsRORy(RzR((s#/usr/local/lib/python2.7/tarfile.pyRO}scCstj|j|dS(N(RsRQRy(RzR((s#/usr/local/lib/python2.7/tarfile.pyRQs(ReRfRgR|R}RORQ(((s#/usr/local/lib/python2.7/tarfile.pyRqks
				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|_y|dkr)yddl}Wntk
rtdnX||_|jdd@|_|d	kr|jq|jnu|d
kryddl}Wntk
rdtdnX|d	krd|_|j|_q|j|_nWn,|js|j
jnt|_nXdS(s$Construct a _Stream object.
        t*R0ltgziNszlib module is not availablelRZtbz2sbz2 module is not available(tTruet_extfileobjRKRqtFalset_StreamProxytgetcomptypeR{R_tcomptypetfileobjtbufsizeRGtpostclosedtzlibtImportErrorRjtcrc32tcrct
_init_read_gzt_init_write_gzRtdbuftBZ2Decompressortcmpt
BZ2CompressorR}(RzR{R_RRRRR((s#/usr/local/lib/python2.7/tarfile.pyR|sP								
	


			cCs*t|dr&|jr&|jndS(NR(RxRR}(Rz((s#/usr/local/lib/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_LEVELRR2R4tlongttimet_Stream__writettypeR{tunicodeR:tendswithR(Rzt	timestamp((s#/usr/local/lib/python2.7/tarfile.pyRs
	cCs{|jdkr1|jj||jd@|_n|jt|7_|jdkrj|jj|}n|j|dS(s&Write string s to the stream.
        RlttarN(	RRRRRRRtcompressR(RzR((s#/usr/local/lib/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(RGRRRRQ(RzR((s#/usr/local/lib/python2.7/tarfile.pyt__writescCs|jr
dSt|_z|jdkrR|jdkrR|j|jj7_n|jdkr|jr|jj|jd|_|jdkr|jjt	j
d|jd@|jjt	j
d|jd@qnWd|j
s|jjnXdS(s[Close the _Stream object. No operation should be
           done on it afterwards.
        NR[RR0Rs<Ll(RRR_RRGRtflushRRQR2R4RRRR}(Rz((s#/usr/local/lib/python2.7/tarfile.pyR}s			#-	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.
        R0issnot a gzip fileissunsupported compression methodiiiiiN(Rt
decompressobjRRRt
_Stream__readRiRjR+RORR(RztflagtxlenR((s#/usr/local/lib/python2.7/tarfile.pyRs.	

,
	
	
cCs|jS(s3Return the stream's file pointer position.
        (R(Rz((s#/usr/local/lib/python2.7/tarfile.pyttell#sicCs|||jdkrit||j|j\}}x$t|D]}|j|jq?W|j|ntd|jS(sXSet the stream's file pointer to pos. Negative seeking
           is forbidden.
        is seeking backwards is not allowed(RRNRR*RORk(RzRRURVR-((s#/usr/local/lib/python2.7/tarfile.pytseek(s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.
        R0N(RKRt_readRR<R=RR(RzRR\RG((s#/usr/local/lib/python2.7/tarfile.pyRO5s	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 dataR0(RRRRRRt
decompressRPRiR<R=(RzRR@R\RG((s#/usr/local/lib/python2.7/tarfile.pyRGs"



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.
        R0(RRGRRORR<R=(RzRR@R\RG((s#/usr/local/lib/python2.7/tarfile.pyt__read]s

N(ReRfRgR|RRRQRR}RRRRKRORR(((s#/usr/local/lib/python2.7/tarfile.pyR~s		4			
					
	RcBs2eZdZdZdZdZdZRS(ssSmall proxy class that enables transparent compression
       detection for the Stream interface (mode 'r|*').
    cCs"||_|jjt|_dS(N(RROt	BLOCKSIZERG(RzR((s#/usr/local/lib/python2.7/tarfile.pyR|ss	cCs|jj|_|jS(N(RRORG(RzR((s#/usr/local/lib/python2.7/tarfile.pyROwscCsJ|jjdrdS|jdd!dkrF|jdd!dkrFd	Sd
S(NsRiitBZhii
s1AY&SYRR(RGt
startswith(Rz((s#/usr/local/lib/python2.7/tarfile.pyR{s
,cCs|jjdS(N(RR}(Rz((s#/usr/local/lib/python2.7/tarfile.pyR}s(ReRfRgR|RORR}(((s#/usr/local/lib/python2.7/tarfile.pyRns
			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_tgetattrRKR{tinit(RzRR_((s#/usr/local/lib/python2.7/tarfile.pyR|s		cCsbddl}d|_|jdkrO|j|_|jjdd|_n|j|_dS(NiiRZR0(	RRR_Rtbz2objRRRGR(RzR((s#/usr/local/lib/python2.7/tarfile.pyRs	cCs|jg}t|j}x^||kr{|jj|j}|sIPn|jj|}|j||t|7}qWdj||_|j| }|j||_|j	t|7_	|S(NR0(
RGRRROt	blocksizeRRR<R=R(RzRRWRtrawtdataRG((s#/usr/local/lib/python2.7/tarfile.pyROs

cCs4||jkr|jn|j||jdS(N(RRRO(RzR((s#/usr/local/lib/python2.7/tarfile.pyRs
cCs|jS(N(R(Rz((s#/usr/local/lib/python2.7/tarfile.pyRscCs;|jt|7_|jj|}|jj|dS(N(RRRRRRQ(RzRR((s#/usr/local/lib/python2.7/tarfile.pyRQscCs5|jdkr1|jj}|jj|ndS(NR[(R_RRRRQ(RzR((s#/usr/local/lib/python2.7/tarfile.pyR}si@(ReRfRgRR|RRORRRQR}(((s#/usr/local/lib/python2.7/tarfile.pyRs		
				t_FileInFilecBs\eZdZd	dZdZdZd	dZdZdZ	dZ
dZRS(
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(RzRRRR((s#/usr/local/lib/python2.7/tarfile.pyR|s
				cCs|jS(s*Return the current file position.
        (R(Rz((s#/usr/local/lib/python2.7/tarfile.pyRscCs
||_dS(s(Seek to a position in the file.
        N(R(RzR((s#/usr/local/lib/python2.7/tarfile.pyRscCse|dkr|j|j}nt||j|j}|jdkrT|j|S|j|SdS(s!Read data from the file.
        N(RKRRtminRt
readnormalt
readsparse(RzR((s#/usr/local/lib/python2.7/tarfile.pyROs
cCs7|jj|}t||kr3tdn|S(Nsunexpected end of data(RRORRi(RzRRG((s#/usr/local/lib/python2.7/tarfile.pyRscCs6|jj|j|j|j|7_|j|S(s*Read operation for regular files.
        (RRRRt_FileInFile__read(RzR((s#/usr/local/lib/python2.7/tarfile.pyRscCs\g}xF|dkrN|j|}|s.Pn|t|8}|j|q	Wdj|S(s)Read operation for sparse files.
        iR0(treadsparsesectionRR<R=(RzRRRG((s#/usr/local/lib/python2.7/tarfile.pyRscCs|jj|j}|dkr%dSt||j|j|j}t|tr|j	|j|j}|j
j|j||j|7_|j|S|j|7_t
|SdS(s0Read a single section of a sparse file.
        R0N(RR"RRKRRRt
isinstancet_datatrealposRRRR(RzRtsectionR((s#/usr/local/lib/python2.7/tarfile.pyRs 
N(ReRfRgRKR|RRRORRRR(((s#/usr/local/lib/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(NRRZiR0(RRtoffset_dataRRRKR{R_RRRtbuffer(Rzttarfilettarinfo((s#/usr/local/lib/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 fileR0N(RR(RRKRRORR(RzRRG((s#/usr/local/lib/python2.7/tarfile.pyRO,s			
 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
iR0ii(
RR(RR"RRRORR<R=RRR(RzRRtbuffersRG((s#/usr/local/lib/python2.7/tarfile.pytreadlineDs(		

cCs:g}x-tr5|j}|s%Pn|j|q	W|S(s0Return a list with all remaining lines.
        (RRR<(Rztresulttline((s#/usr/local/lib/python2.7/tarfile.pyt	readlinescs	cCs|jrtdn|jS(s*Return the current file position.
        sI/O operation on closed file(RR(R(Rz((s#/usr/local/lib/python2.7/tarfile.pyRms	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 argumentR0N(
RR(RstSEEK_SETRtmaxRRtSEEK_CURtSEEK_ENDRRR(RzRtwhence((s#/usr/local/lib/python2.7/tarfile.pyRus	!(	cCs
t|_dS(sClose the file object.
        N(RR(Rz((s#/usr/local/lib/python2.7/tarfile.pyR}sccs,x%tr'|j}|sPn|VqWdS(s/Get an iterator over the file's lines.
        N(RR(RzR((s#/usr/local/lib/python2.7/tarfile.pyt__iter__s
	N(ReRfRgRR|RKRORRRRsRRR}R(((s#/usr/local/lib/python2.7/tarfile.pyRs	
	
		cBseZdZddZdZdZeeeZdZdZ	eee	Z
dZdZe
ed	d
ZdZdZd
ZedZdZedZedZedZeedZedZedZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'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.
        iiR0N(R{R_RRRRtchksumtREGTYPERtlinknameRRtdevmajortdevminorRRtpax_headers(RzR{((s#/usr/local/lib/python2.7/tarfile.pyR|s 															cCs|jS(N(R{(Rz((s#/usr/local/lib/python2.7/tarfile.pyt_getpathscCs
||_dS(N(R{(RzR{((s#/usr/local/lib/python2.7/tarfile.pyt_setpathscCs|jS(N(R(Rz((s#/usr/local/lib/python2.7/tarfile.pyt_getlinkpathscCs
||_dS(N(R(RzR((s#/usr/local/lib/python2.7/tarfile.pyt_setlinkpathscCs d|jj|jt|fS(Ns<%s %r at %#x>(t	__class__ReR{tid(Rz((s#/usr/local/lib/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||||<qqW|S(s9Return the TarInfo's attributes as a dictionary.
        R{iR_RRRRRRRRRRRt/(R{RRR(R{R_RRRRRRRRRRRtDIRTYPERRR:(RzR>R?tinfotkey((s#/usr/local/lib/python2.7/tarfile.pytget_infos(











$
!R8cCss|j||}|tkr+|j|S|tkrD|j|S|tkrc|j|||StddS(s<Return a tar header as a string of 512 byte blocks.
        sinvalid formatN(RtUSTAR_FORMATtcreate_ustar_headerR1tcreate_gnu_headert
PAX_FORMATtcreate_pax_headerR((RzR6R>R?R((s#/usr/local/lib/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 longR{tprefix(tPOSIX_MAGICRtLENGTH_LINKR(tLENGTH_NAMEt_posix_split_namet_create_headerR(RzR((s#/usr/local/lib/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.
        RR0RR{(	t	GNU_MAGICRRt_create_gnu_long_headertGNUTYPE_LONGLINKRtGNUTYPE_LONGNAMERR1(RzRRG((s#/usr/local/lib/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.
        RR{RRRRi RtasciiRiRRiRiiR0(RRi (RRi (Ri(Ri(Ri(Ri(RRtcopyRRtdecodeR:R;RRtfloatRt_create_pax_generic_headerRR(RzRR>R?RR{thnameR tvalR5RG((s#/usr/local/lib/python2.7/tarfile.pyRs6




4cCs|j|dtS(sAReturn the object as a pax global header block sequence.
        R(RtXGLTYPE(tclsR((s#/usr/local/lib/python2.7/tarfile.pytcreate_pax_global_headerDscCs|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.
        iiRsname is too long(t
LENGTH_PREFIXRRR((RzR{R((s#/usr/local/lib/python2.7/tarfile.pyRJs
cCst|jdddt|jddd@d|t|jddd|t|jd	dd|t|jd
dd|t|jddd|d
|jdtt|jdddt|jdtdt|jdddt|jdddt|jddd|t|jddd|t|jdddg}tjdtdj|}t	|td}|d d||d}|S(sReturn a header block. info is a dictionary with file
           information, format must be one of the *_FORMAT constants.
        R{R0idR_iiiRRRiRs        RRRRi RRRRis%dsis%06oi(
R!tgetR7RRR2R4RR=RJ(RR6tpartsRGR((s#/usr/local/lib/python2.7/tarfile.pyRYs&cCs@tt|t\}}|dkr<|t|t7}n|S(sdReturn the string payload filled with zero bytes
           up to the next 512 byte border.
        i(RNRRR(tpayloadRURV((s#/usr/local/lib/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{RRR(RRRRRR(RR{RR((s#/usr/local/lib/python2.7/tarfile.pyRs



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.
        R9iis	%d %s=%s
R0s././@PaxHeaderR{RRR(t	iteritemsR:RRtstrR<R=RRRR(
RRRtrecordstkeywordtvalueR/R,R#R((s#/usr/local/lib/python2.7/tarfile.pyRs(
	



cCsKt|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!}|jtkr|jjdrt|_n|jr|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 headeriisbad checksumidiliti|iiii	i)iIiQiYiR(RRmRRntcountRRoR.RJR)RGR$R{R_RRRRRRRRRRRtAREGTYPERRtisdirtrstript	GNU_TYPES(RRGRtobjR((s#/usr/local/lib/python2.7/tarfile.pytfrombufs@			!cCsD|jjt}|j|}|jjt|_|j|S(sOReturn the next TarInfo object from TarFile object
           tarfile.
        (RRORRRRt_proc_member(RRRGR((s#/usr/local/lib/python2.7/tarfile.pytfromtarfilescCst|jttfkr"|j|S|jtkr>|j|S|jtttfkrc|j	|S|j
|SdS(sYChoose the right processing method depending on
           the type and call it.
        N(RRRt
_proc_gnulongtGNUTYPE_SPARSEt_proc_sparsetXHDTYPERtSOLARIS_XHDTYPEt	_proc_paxt
_proc_builtin(RzR((s#/usr/local/lib/python2.7/tarfile.pyRs


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.
        (
RRRtisregRtSUPPORTED_TYPESt_blockRRt_apply_pax_infoRR>R?(RzRR((s#/usr/local/lib/python2.7/tarfile.pyRs		cCs|jj|j|j}y|j|}Wntk
rPtdnX|j|_|jt	kr~t
||_n!|jtkrt
||_
n|S(sSProcess the blocks that hold a GNU longname
           or longlink member.
        s missing or bad subsequent header(RROR RRRlRpRRRR$R{RR(RzRRGtnext((s#/usr/local/lib/python2.7/tarfile.pyRs
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(RGt_ringbufferR*R.R(R<t_holeRR+RRORRRRR RR(RzRRGtspRtlastposRR-Rtnumbytest
isextendedtorigsize((s#/usr/local/lib/python2.7/tarfile.pyR'sT		





		cCs|jj|j|j}|jtkr9|j}n|jj}tj	dtj
}d}xtr|j||}|sPn|j
\}}t|}||jdd|jd|d!}	|jd}|	jd}	|	||<||7}qfWy|j|}
Wntk
r9tdnX|jttfkr|
j||j|j|j|
_d|kr|
j}|
js|
jtkr||
j|
j7}n||_qn|
S(sVProcess an extended or global header as described in
           POSIX.1-2001.
        s(\d+) ([^=]+)=iiiR9s missing or bad subsequent headerR(RROR RRRRRtretcompiletURtmatchtgroupsR&tendtstartRRRlRpRRR!R>R?RRRR(RzRRGRtregexRR-R RR
R"R((s#/usr/local/lib/python2.7/tarfile.pyR_s<	+

	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.
        RRiN(	R	t
PAX_FIELDSRtPAX_NUMBER_FIELDSR(RAtsetattrRR(RzRR>R?RR
((s#/usr/local/lib/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/local/lib/python2.7/tarfile.pyR s
cCs
|jtkS(N(Rt
REGULAR_TYPES(Rz((s#/usr/local/lib/python2.7/tarfile.pyRscCs
|jS(N(R(Rz((s#/usr/local/lib/python2.7/tarfile.pytisfilescCs
|jtkS(N(RR(Rz((s#/usr/local/lib/python2.7/tarfile.pyRscCs
|jtkS(N(RtSYMTYPE(Rz((s#/usr/local/lib/python2.7/tarfile.pytissymscCs
|jtkS(N(RtLNKTYPE(Rz((s#/usr/local/lib/python2.7/tarfile.pytislnkscCs
|jtkS(N(RtCHRTYPE(Rz((s#/usr/local/lib/python2.7/tarfile.pytischrscCs
|jtkS(N(RtBLKTYPE(Rz((s#/usr/local/lib/python2.7/tarfile.pytisblkscCs
|jtkS(N(RtFIFOTYPE(Rz((s#/usr/local/lib/python2.7/tarfile.pytisfifoscCs
|jtkS(N(RR(Rz((s#/usr/local/lib/python2.7/tarfile.pytissparsescCs|jtttfkS(N(RR;R=R?(Rz((s#/usr/local/lib/python2.7/tarfile.pytisdevs(/ReRfRgR|RRtpropertyRRRRRRtDEFAULT_FORMATtENCODINGRRRRtclassmethodRRtstaticmethodRRRRRRRRRRRRR!R RR6RR8R:R<R>R@RARB(((s#/usr/local/lib/python2.7/tarfile.pyRsP							
		3	
.	
			8	:												c
BsHeZdZdZeZeZdZeZ	e
Zd2Z
eZeZd2dd2d2d2d2d2d2d2d2d2d2dZdZdZeeeZed2dd2edZedd2dZedd2d	d
Zedd2d	dZidd
6dd6dd6ZdZdZdZ dZ!d2d2d2dZ"e#dZ$d2e#d2d2dZ%d2dZ&dd2dZ'ddZ(dZ)dZ*d Z+d!Z,d"Z-d#Z.d$Z/d%Z0d&Z1d'Z2d(Z3d)Z4d2ed*Z5d+Z6d2d,Z7d-Z8d.Z9d/Z:d0Z;d1Z<RS(3s=The TarFile Class provides an interface to tar archives.
    iiRZc
Csidd6dd6dd6}
||
kr6tdn||_|
||_|s|jdkrtjj|rd|_d|_nt||j}t|_nN|d
krt
|dr|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!|dkrd
|_n	d|_|
d
k	r|jtkr|
|_n	i|_|d
k	r||_n|d
k	r0||_nt|_g|_t|_|jj|_i|_y9|jdkrd
|_|j |_n|jdkr7xtr3|jj!|jy&|jj"|}|jj#|Wqt$k
r|jj!|jPqt%k
r/}t&t'|qXqWn|jdkrt|_|jr|jj(|jj)}|jj*||jt+|7_qnWn,|js|jj,nt|_nXd
S(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.
        trbRZsr+btatwbR[smode must be 'r', 'a' or 'w'R{R_sutf-8R8tawN(-R(R_t_modeRsRtexistst	bltn_openRRRKRxR{RtabspathRR6Rtdereferencetignore_zerosR>R?RRtdebugt
errorlevelRtmemberst_loadedRRtinodestfirstmemberR"RRR<RoRlRiR
RRRQRR}(RzR{R_RR6RRPRQR>R?RRRRStmodesteRG((s#/usr/local/lib/python2.7/tarfile.pyR|s	
"		!									
				cCs
|jtkS(N(R6R(Rz((s#/usr/local/lib/python2.7/tarfile.pyt	_getposixPscCs>ddl}|jdtd|r1t|_n	t|_dS(Nis use the format attribute insteadi(twarningstwarntDeprecationWarningRR6R1(RzR
R[((s#/usr/local/lib/python2.7/tarfile.pyt	_setposixRscsO|r|rtdn|dkrfd}xtjd|D]}tj|}|dk	r|j}	ny||d||SWqNttfk
r}
|dk	rN|j|	qNqNqNXqNWtdnUd|krq|j	dd\}}|pd}|p#d	}|jkrNtj|}ntd
||||||Sd|kr|j	dd\}}|pd}|pd	}|dkrtd
nt
|||||}y||||}
Wn|jnXt|
_
|
S|dkr?j||||StddS(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:*csj|dkS(Nttaropen(t	OPEN_METH(R(R(s#/usr/local/lib/python2.7/tarfile.pytnot_compressedsRs%file could not be opened successfullyt:iRsunknown compression type %rt|R[smode must be 'r' or 'w'RIsundiscernible modeN(RZsr:*(RZR[(RIR[(R(tsortedR`RRKRRiRjRtsplitR~R}RRR_(RR{R_RRtkwargsRaRtfunct	saved_posRYRdtstreamR\((Rs#/usr/local/lib/python2.7/tarfile.pyRgsP
	cKs.|dkrtdn|||||S(sCOpen uncompressed tar archive name for reading or writing.
        RZRIR[smode must be 'r', 'a' or 'w'(RZRIR[(R((RR{R_RRf((s#/usr/local/lib/python2.7/tarfile.pyR_si	cKs*|dkrtdnyddl}|jWn#ttfk
rWtdnXy|j||||}Wn;tk
r|dk	r|dkrtdnnXy|j	||||}WnLt
k
r	|j|dkrtdnn|jnXt|_
|S(	skOpen gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        RZR[smode must be 'r' or 'w'iNsgzip module is not availablesnot a gzip file(RZR[(R(tgziptGzipFileRtAttributeErrorRjtOSErrorRKRiR_RPR}RR(RR{R_Rt
compresslevelRfRjR\((s#/usr/local/lib/python2.7/tarfile.pytgzopens2



	cKs|d	krtdnyddl}Wntk
rJtdnX|dk	rit||}n|j||d|}y|j||||}WnRtt	fk
r|j
|dkrtdnn|j
nXt|_
|S(
slOpen bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
        RZR[smode must be 'r' or 'w'.iNsbz2 module is not availableRnsnot a bzip2 file(RZR[(R(RRRjRKRtBZ2FileR_RPtEOFErrorR}RiRR(RR{R_RRnRfRR\((s#/usr/local/lib/python2.7/tarfile.pytbz2opens*


	R_RRoRRrRcCs|jr
dSt|_z|jdkr|jjttd|jtd7_t|jt	\}}|dkr|jjtt	|qnWd|j
s|jjnXdS(slClose the TarFile. In write-mode, two finishing zero blocks are
           appended to the archive.
        NRKii(RRR_RRQRRRRNt
RECORDSIZERR}(RzRURV((s#/usr/local/lib/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/local/lib/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_checkRUt_loadRT(Rz((s#/usr/local/lib/python2.7/tarfile.pyt
getmembers(s
	
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().
        (RyR{(RzR((s#/usr/local/lib/python2.7/tarfile.pytgetnames2scCs\|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(sCreate 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.
        RKRtlstatR0iiltmajortminorN(;RwRKR{RsRt
splitdriveRtseptlstripRRRxRPR{tstattfstattfilenotst_modetS_ISREGtst_inotst_devtst_nlinkRVR9RtS_ISDIRRtS_ISFIFOR?tS_ISLNKR7treadlinktS_ISCHRR;tS_ISBLKR=R_tst_uidRtst_gidRtst_sizeRtst_mtimeRRRtpwdtgetpwuidRRutgrptgetgrgidRR|tst_rdevRR}R(RzR{tarcnameRtdrvRtstatresRtstmdtinodeR((s#/usr/local/lib/python2.7/tarfile.pyt
gettarinfo8s~
			"
									

cCs|jx|D]}|rt|jGd|jp<|j|jpK|jfG|jsh|jrdd|j	|j
fGnd|jGdtj
|jd Gn|j|jrdndG|r|jrd	G|jGn|jrd
G|jGqnHqWdS(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/%ss%10ss%d,%ds%10ds%d-%02d-%02d %02d:%02d:%02diRR0s->slink toN(RwRdR_RRRRR<R>RRRRt	localtimeRR{RR8RR:(RztverboseR((s#/usr/local/lib/python2.7/tarfile.pytlists&


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.
        RKiNsuse the filter argument insteadistarfile: Excluded %rstarfile: Skipped %ristarfile: Unsupported type %rRH(RwRKR[R\R]t_dbgR{RsRRORRRNtaddfileRtlistdirtaddR=(	RzR{Rt	recursivetexcludetfilterR[Rtf((s#/usr/local/lib/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(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(RwRRR6R>R?RRQRRRKRMRRNRRRTR<(RzRRRGRURV((s#/usr/local/lib/python2.7/tarfile.pyRs

t.cCs3g}|dkr|}nxR|D]J}|jr\|j|tj|}d|_n|j||q"W|jdtjd|j	x|D]}t
jj||j
}y4|j|||j|||j||Wqtk
r*}|jdkrq+|jdd|qXqWdS(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().
        iRR{istarfile: %sN(RKRR<RR_textracttsorttoperatort
attrgettertreverseRsRR=R{tchowntutimetchmodRhRSR(RzRRTtdirectoriesRtdirpathRY((s#/usr/local/lib/python2.7/tarfile.pyt
extractalls*	



R0cCs7|jdt|tr.|j|}n|}|jr^tjj||j|_	ny&|j
|tjj||jWntk
r}|j
dkrq3|jdkr|jdd|jq3|jdd|j|jfn<tk
r2}|j
dkrq3|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(RwRt
basestringRvR:RsRR=Rt_link_targett_extract_memberR{tEnvironmentErrorRStfilenameRKRtstrerrorRh(RztmemberRRRY((s#/usr/local/lib/python2.7/tarfile.pyR4s$
&#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(RwRRRvRt
fileobjectRRR:R8RR~Rktextractfilet_find_link_targetRK(RzRR((s#/usr/local/lib/python2.7/tarfile.pyRUs	
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|||j|||j	s|j|||j||ndS(s\Extract the TarInfo object tarinfo to a physical
           file called targetpath.
        Ris%s -> %sN(RRRsRRtdirnameRMtmakedirsR:R8RR{RRtmakefileRtmakedirR@tmakefifoR<R>tmakedevtmakelinkRRtmakeunknownRRR(RzRt
targetpatht	upperdirs((s#/usr/local/lib/python2.7/tarfile.pyR{s2#cCsFytj|dWn+tk
rA}|jtjkrBqBnXdS(s,Make a directory called targetpath.
        iN(RstmkdirRterrnotEEXIST(RzRRRY((s#/usr/local/lib/python2.7/tarfile.pyRs
cCsJ|j|}z)t|d}t||WdQXWd|jXdS(s'Make a file called targetpath.
        RJN(RRNRMR}(RzRRtsourcettarget((s#/usr/local/lib/python2.7/tarfile.pyRs
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(RzRR((s#/usr/local/lib/python2.7/tarfile.pyRscCs/ttdrtj|ntddS(s'Make a fifo called targetpath.
        tmkfifosfifo not supported by systemN(RxRsRRh(RzRR((s#/usr/local/lib/python2.7/tarfile.pyRscCsttds ttdr/tdn|j}|jrT|tjO}n
|tjO}tj||tj	|j
|jdS(s<Make a character or block device called targetpath.
        tmknodRs'special devices not supported by systemN(RxRsRhR_R>RtS_IFBLKtS_IFCHRRRRR(RzRRR_((s#/usr/local/lib/python2.7/tarfile.pyRs 	
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(RxRsR8RtlexiststunlinkRRRMRRRRRuRh(RzRR((s#/usr/local/lib/python2.7/tarfile.pyRs
cCstrttdrtjdkrytj|jd}Wntk
r]|j}nXytj	|j
d}Wntk
r|j}nXyZ|jrttdrtj
|||n%tjdkrtj|||nWqtk
r}tdqXndS(s6Set owner of targetpath according to tarinfo.
        tgeteuidiitlchowntos2emxscould not change ownerN(RRxRsRRtgetgrnamRRuRtgetpwnamRRR8RtsystplatformRRRh(RzRRRtuRY((s#/usr/local/lib/python2.7/tarfile.pyRs '



cCsOttdrKytj||jWqKtk
rG}tdqKXndS(sASet file permissions of targetpath according to tarinfo.
        Rscould not change modeN(RxRsRR_RRh(RzRRRY((s#/usr/local/lib/python2.7/tarfile.pyR
	s
cCsYttdsdSy tj||j|jfWntk
rT}tdnXdS(sBSet modification time of targetpath according to tarinfo.
        RNs"could not change modification time(RxRsRRRRh(RzRRRY((s#/usr/local/lib/python2.7/tarfile.pyR	s cCs%|jd|jdk	r2|j}d|_|S|j|jjkr|jj|jd|jjdstdqnd}xkt	ry|j
j|}WnGtk
r}|j
r|jdd|j|f|jt7_qqntk
rk}|j
rD|jdd|j|f|jt7_qq|jdkrtt|qntk
r|jdkrtdqn[tk
r}|jdkrtt|qn%tk
r}tt|nXPqW|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.
        traisunexpected end of datais0x%X: %sis
empty fileN(RwRWRKRRRRRORiRRRRoRQRRR)R
RmRnRpRTR<RU(RztmRRY((s#/usr/local/lib/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{Rt	normalizeRTRtmember_name((s#/usr/local/lib/python2.7/tarfile.pyRtW	s	cCs6x&tr(|j}|dkrPqqWt|_dS(sWRead through the entire archive file and look for readable
           members.
        N(RR"RKRU(RzR((s#/usr/local/lib/python2.7/tarfile.pyRxn	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(RRPRReRKR_(RzR_((s#/usr/local/lib/python2.7/tarfile.pyRwx	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.
        RRRslinkname %r not foundN(R8R=RRKRsRRR{RRtRRu(RzRRtlimitR((s#/usr/local/lib/python2.7/tarfile.pyR	s0		cCs$|jrt|jSt|SdS(s$Provide an iterator object.
        N(RUtiterRTtTarIter(Rz((s#/usr/local/lib/python2.7/tarfile.pyR	s	
cCs#||jkrtj|IJndS(s.Write debugging output to sys.stderr.
        N(RRRtstderr(Rztleveltmsg((s#/usr/local/lib/python2.7/tarfile.pyR	scCs|j|S(N(Rw(Rz((s#/usr/local/lib/python2.7/tarfile.pyt	__enter__	s
cCs?|dkr|jn"|js2|jjnt|_dS(N(RKR}RRRR(RzRR
t	traceback((s#/usr/local/lib/python2.7/tarfile.pyt__exit__	s

	N(=ReRfRgRRRRPRQRSRDR6RER>RKR?RRRRR|RZR^RCtposixRFRsRR_RoRrR`R}RvRyRzRRRRRRRRRRRRRRRRRRR"RtRxRwRRRRR(((s#/usr/local/lib/python2.7/tarfile.pyRste		
M!
			
	c=%!	&	/		
									6	
					RcBs)eZdZdZdZdZRS(sMIterator Class.

       for tarinfo in TarFile(...):
           suite...
    cCs||_d|_dS(s$Construct a TarIter object.
        iN(RR(RzR((s#/usr/local/lib/python2.7/tarfile.pyR|	s	cCs|S(s Return iterator object.
        ((Rz((s#/usr/local/lib/python2.7/tarfile.pyR	scCs|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(
RRRWRKR"RRTRURt
StopIteration(RzR((s#/usr/local/lib/python2.7/tarfile.pyR"	s!(ReRfRgR|RR"(((s#/usr/local/lib/python2.7/tarfile.pyR	s		t_sectioncBs eZdZdZdZRS(s$Base class for _data and _hole.
    cCs||_||_dS(N(RR(RzRR((s#/usr/local/lib/python2.7/tarfile.pyR|	s	cCs%|j|ko"|j|jkSS(N(RR(RzR((s#/usr/local/lib/python2.7/tarfile.pyt__contains__	s(ReRfRgR|R(((s#/usr/local/lib/python2.7/tarfile.pyR	s	RcBseZdZdZRS(s/Represent a data section in a sparse file.
    cCs tj|||||_dS(N(RR|R(RzRRR((s#/usr/local/lib/python2.7/tarfile.pyR|	s(ReRfRgR|(((s#/usr/local/lib/python2.7/tarfile.pyR	sR$cBseZdZRS(s/Represent a hole section in a sparse file.
    (ReRfRg(((s#/usr/local/lib/python2.7/tarfile.pyR$	sR#cBs eZdZdZdZRS(sMRingbuffer class which increases performance
       over a regular list.
    cCs
d|_dS(Ni(tidx(Rz((s#/usr/local/lib/python2.7/tarfile.pyR|	scCsu|j}x\trg||}||kr,Pn|d7}|t|krQd}n||jkrdSqW||_|S(Nii(RRRRK(RzRRtitem((s#/usr/local/lib/python2.7/tarfile.pyR"	s		

		(ReRfRgR|R"(((s#/usr/local/lib/python2.7/tarfile.pyR#	s	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(R[Rt	TAR_PLAINRR_RtTAR_GZIPPEDRoR(RyR{RRt	file_sizeRtgmtimeRt	date_time(RztfileR_tcompressionRRTR((s#/usr/local/lib/python2.7/tarfile.pyR|
s	
cCstd|jS(NcSs|jS(N(R{(R((s#/usr/local/lib/python2.7/tarfile.pyt<lambda>
R0(tmaptinfolist(Rz((s#/usr/local/lib/python2.7/tarfile.pytnamelist
scCstd|jjS(NcSs
|jtkS(N(RR5(R((s#/usr/local/lib/python2.7/tarfile.pyR
R0(RRRy(Rz((s#/usr/local/lib/python2.7/tarfile.pyR
s	cCs|jjdS(N(RR(Rz((s#/usr/local/lib/python2.7/tarfile.pytprintdir 
scCsdS(N((Rz((s#/usr/local/lib/python2.7/tarfile.pyttestzip"
scCs|jj|S(N(RRv(RzR{((s#/usr/local/lib/python2.7/tarfile.pytgetinfo$
scCs"|jj|jj|jS(N(RRRvRO(RzR{((s#/usr/local/lib/python2.7/tarfile.pyRO&
scCs|jj||dS(N(RR(RzRRt
compress_type((s#/usr/local/lib/python2.7/tarfile.pyRQ(
scCsyddlm}Wn!tk
r7ddlm}nXddl}t|j}t||_|j|j	|_
|jj|||dS(Ni(tStringIO(
t	cStringIORRtcalendarRRRRttimegmRRRR(RztzinfotbytesRRttinfo((s#/usr/local/lib/python2.7/tarfile.pytwritestr*
s
cCs|jjdS(N(RR}(Rz((s#/usr/local/lib/python2.7/tarfile.pyR}4
sN(ReRfRgRR|RRRRRRORKRQR
R}(((s#/usr/local/lib/python2.7/tarfile.pyR
s							
cCs7yt|}|jtSWntk
r2tSXdS(sfReturn True if name points to a tar archive that we
       are able to handle, else return False.
    N(RR}RRR(R{R\((s#/usr/local/lib/python2.7/tarfile.pyR;
s

(xRgt__version__tversiont
__author__t__date__t	__cvsid__t__credits__t__builtin__RRNRRsRLRRRR2RR*RRRRRKt__all__RRRsRRRRRRRR9R7R;R=RR?tCONTTYPERRRRRRRR1RRDRR5RR2RR&R3tS_IFLNKtS_IFREGRtS_IFDIRRtS_IFIFOtTSUIDtTSGIDtTSVTXtTUREADtTUWRITEtTUEXECtTGREADtTGWRITEtTGEXECtTOREADtTOWRITEtTOEXECtgetfilesystemencodingREtgetdefaultencodingR!R$R.R7RARJRMR^Rdt	ExceptionRRhRiRjRkRlRmRnRoR)RpRqR~tobjectRRRRRRRRRR$RR#RRRR(((s#/usr/local/lib/python2.7/tarfile.pyt<module>s.

					
						
					
	
	
		AR5'	4	

Zerion Mini Shell 1.0