ó ›˜Çjc @s[dZdZdZdZdZdZdZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZyddlZddlZWnek rçeZZnXd d d d 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#ZJejKƒZLeLekrÌejMƒZLnd>„ZNd?„ZOd@„ZPd<e1dA„ZQdB„ZRdC„ZSedD„ZTe9dEfe:dFfe;dGfe<dHfe=dIfe>dJffeBdKffeCdLffeDe?BdMfe?dfeDdffeEdKffeFdLffeGe@BdMfe@dfeGdffeHdKffeIdLffeJeABdNfeAdOfeJdfff ZUdP„ZVdQ„ZWd eXfdR„ƒYZYdSeYfdT„ƒYZZdUeYfdV„ƒYZ[dWeYfdX„ƒYZ\dYeYfdZ„ƒYZ]d[eYfd\„ƒYZ^d]e^fd^„ƒYZ_d_e^fd`„ƒYZ`dae^fdb„ƒYZadce^fdd„ƒYZbdee^fdf„ƒYZcdgfdh„ƒYZddifdj„ƒYZedkeffdl„ƒYZgdmeffdn„ƒYZhdoeffdp„ƒYZidqeffdr„ƒYZjdseYfdt„ƒYZkduekfdv„ƒYZldwekfdx„ƒYZmdyekfdz„ƒYZnd{ekfd|„ƒYZod}ekfd~„ƒYZpdekfd€„ƒYZqekereZfZsetd�„Zud‚„Zvdƒ„Zwd„„Zxievd…6ewd†6exd‡6ZyefƒZzd effdˆ„ƒYZ{ej|d‰ej}ƒZ~d effdŠ„ƒYZd‹fdŒ„ƒYZ€d�fdŽ„ƒYZ�d�e�fd�„ƒYZ‚d‘e�fd’„ƒYZƒd“e„fd”„ƒYZ…d"Z†d<Z‡d•fd–„ƒYZˆd—„Z‰eŠZ‹ejŠZŠdS(˜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 iiicCs5|dkrtdƒ‚n|| |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.pytstn©s 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.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'RtInvalidHeaderErrortxrangeR tord(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€(R!t GNU_FORMATRtstructtunpacktpackR+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-8tstricttutf8R1N(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(tsumR3R4(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@( Rtshutilt copyfileobjtdivmodR+treadR tIOErrortwrite(tsrctdstR#tBUFSIZEtblockst remaindertbRH((s/usr/lib64/python2.7/tarfile.pyRMs$   R0t-RWtdRAR&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() RXR1(tfilemode_tableR=R>(tmodetpermttabletbittchar((s/usr/lib64/python2.7/tarfile.pytfilemode:s  c sn|stdƒ‚nttt|ƒƒ}d‰d}t}y#t‡fd†|Dƒƒ\}Wntk rxt}nX|rŽtdƒ‚ng|D]}|jˆƒ^q•}g|D]1}g|D]}|rÄ||krÄ|^qÄ^q·}t|ƒ}t |ƒ} |} x8t |ƒD]*\} }|| | kr|| } PqqW|rSˆnˆd } | ˆ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 [ss%Can't mix absolute and relative pathsi( RttupletmaptstrtFalsetsettTruetsplittmintmaxt enumerateR>( tpathstcurdirtraised_exceptiontisabsRt split_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.pyR€rst ReadErrorcBseZdZRS(s%Exception for unreadble tar archives.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyR�ustCompressionErrorcBseZdZRS(s.Exception for unavailable compression methods.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyR‚xst StreamErrorcBseZdZRS(s=Exception for unsupported operations on stream-like TarFiles.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyRƒ{st HeaderErrorcBseZdZRS(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.pyR…�stTruncatedHeaderErrorcBseZdZRS(s Exception for truncated headers.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyR†„stEOFHeaderErrorcBseZdZRS(s"Exception for end of file headers.(R}R~R(((s/usr/lib64/python2.7/tarfile.pyR‡‡sR*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.pyRˆ�st _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_TRUNCthasattrRŠtopentfd(tselftnameR_((s/usr/lib64/python2.7/tarfile.pyt__init__šs cCstj|jƒdS(N(R‹tcloseR’(R“((s/usr/lib64/python2.7/tarfile.pyR–£scCstj|j|ƒS(N(R‹ROR’(R“R((s/usr/lib64/python2.7/tarfile.pyRO¦scCstj|j|ƒdS(N(R‹RQR’(R“R"((s/usr/lib64/python2.7/tarfile.pyRQ©s(R}R~RR•R–RORQ(((s/usr/lib64/python2.7/tarfile.pyR‰”s   t_StreamcBs€eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d d „Z dd „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*R1ltgziÿÿÿÿNszlib module is not availablelÿÿRZtbz2sbz2 module is not available(Rnt _extfileobjRR‰Rlt _StreamProxyt getcomptypeR”R_tcomptypetfileobjtbufsizeRHtpostclosedtzlibt ImportErrorR‚tcrc32tcrct _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¢(R�R¢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 isR¡R (R“RR\RH((s/usr/lib64/python2.7/tarfile.pyROZs  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 dataR1( RžR¿R R©R R«t decompressRPR�R=R>(R“RRAR\RH((s/usr/lib64/python2.7/tarfile.pyRÅls"     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. R1(R RHRŸROR R=R>(R“RRAR\RH((s/usr/lib64/python2.7/tarfile.pyt__read‚s   N(R}R~RR•R­R¨RQRµR–R§RÂRÄRRORÅ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 BLOCKSIZERH(R“RŸ((s/usr/lib64/python2.7/tarfile.pyR•˜s cCs|jj|_|jS(N(RŸRORH(R“R((s/usr/lib64/python2.7/tarfile.pyROœscCsJ|jjdƒrdS|jdd!dkrF|jdd!dkrFd Sd S( Ns‹R™iitBZhii s1AY&SYRšRº(RHt startswith(R“((s/usr/lib64/python2.7/tarfile.pyR� s ,cCs|jjƒdS(N(RŸR–(R“((s/usr/lib64/python2.7/tarfile.pyR–§s(R}R~RR•ROR�R–(((s/usr/lib64/python2.7/tarfile.pyRœ“s    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_tgetattrRR”tinit(R“RŸR_((s/usr/lib64/python2.7/tarfile.pyR•µs  cCsbddl}d|_|jdkrO|jƒ|_|jjdƒd|_n|jƒ|_dS(NiÿÿÿÿiRZR1( RšR¡R_Rªtbz2objRŸRÄRHR¬(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(NR1( RHR RŸROt blocksizeRÎRÆR=R>R¡(R“RRWRtrawRÃRH((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¡R RÎ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@( R}R~RRÏ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(RRRÔRpRÓt readnormalt readsparse(R“R((s/usr/lib64/python2.7/tarfile.pyROs   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. iR1(treadsparsesectionR R=R>(R“RRÃRH((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. R1N(RÓR%RÔRRpRÒRt isinstancet_datatrealposRŸRÄROR!(R“RtsectionRÚ((s/usr/lib64/python2.7/tarfile.pyR×#s  N( R}R~RRR•RÂRÄRORÕRÖR×(((s/usr/lib64/python2.7/tarfile.pyRÑìs     t ExFileObjectcBsheZdZdZd„Zd d„Zdd„Zd„Zd„Z e j d„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ÓRZiR1( RÑRŸt offset_dataRRÌRR”R_RlR¢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 fileR1N(R¢RRÞRRŸROR RÔ(R“RRH((s/usr/lib64/python2.7/tarfile.pyROKs        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 iR1iiÿÿÿÿ( R¢RRÞR%RnRŸRORÏR=R>R RpRÔ(R“RR¡tbuffersRH((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. (RnRâR=(R“tresulttline((s/usr/lib64/python2.7/tarfile.pyt readlines‚s  cCs|jrtdƒ‚n|jS(s*Return the current file position. sI/O operation on closed file(R¢RRÔ(R“((s/usr/lib64/python2.7/tarfile.pyRÂŒs 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|_ |j j |jƒdS(s(Seek to a position in the file. sI/O operation on closed fileisInvalid argumentR1N( R¢RR‹tSEEK_SETRpRqRRÔtSEEK_CURtSEEK_ENDRÞRŸRÄ(R“R¡twhence((s/usr/lib64/python2.7/tarfile.pyRÄ”s ! (  cCs t|_dS(sClose the file object. N(RnR¢(R“((s/usr/lib64/python2.7/tarfile.pyR–©sccs,x%tr'|jƒ}|sPn|VqWdS(s/Get an iterator over the file's lines. N(RnRâ(R“Rä((s/usr/lib64/python2.7/tarfile.pyt__iter__®s   N(R}R~RRÏR•RRORâRåRÂR‹RæRÄR–Rê(((s/usr/lib64/python2.7/tarfile.pyRÜ8s    t FilterErrorcBseZRS((R}R~(((s/usr/lib64/python2.7/tarfile.pyRë½stAbsolutePathErrorcBseZd„ZRS(cCs0||_tt|ƒjdt|jƒƒdS(Nsmember %s has an absolute path(RàtsuperRìR•treprR”(R“Rà((s/usr/lib64/python2.7/tarfile.pyR•Ás (R}R~R•(((s/usr/lib64/python2.7/tarfile.pyRìÀstOutsideDestinationErrorcBseZd„ZRS(cCsI||_||_tt|ƒjdt|jƒt|ƒfdƒdS(Ns%s would be extracted to %s, s which is outside the destination(Ràt_pathRíRïR•RîR”(R“RàR((s/usr/lib64/python2.7/tarfile.pyR•Æs  +(R}R~R•(((s/usr/lib64/python2.7/tarfile.pyRïÅstSpecialFileErrorcBseZd„ZRS(cCs0||_tt|ƒjdt|jƒƒdS(Ns%s is a special file(RàRíRñR•RîR”(R“Rà((s/usr/lib64/python2.7/tarfile.pyR•Ís (R}R~R•(((s/usr/lib64/python2.7/tarfile.pyRñÌstAbsoluteLinkErrorcBseZd„ZRS(cCs0||_tt|ƒjdt|jƒƒdS(Ns %s is a link to an absolute path(RàRíRòR•RîR”(R“Rà((s/usr/lib64/python2.7/tarfile.pyR•Òs (R}R~R•(((s/usr/lib64/python2.7/tarfile.pyRòÑstLinkOutsideDestinationErrorcBseZd„ZRS(cCsI||_||_tt|ƒjdt|jƒt|ƒfdƒdS(Ns%s would link to %s, s which is outside the destination(RàRðRíRóR•RîR”(R“RàR((s/usr/lib64/python2.7/tarfile.pyR•×s  +(R}R~R•(((s/usr/lib64/python2.7/tarfile.pyRóÖstLinkFallbackErrorcBseZd„ZRS(cCsG||_||_tt|ƒjdt|jƒdt|ƒƒdS(Ns link %s would be extracted as a scopy of %s, which was rejected(RàRðRíRôR•RîR”(R“RàR((s/usr/lib64/python2.7/tarfile.pyR•Þs  (R}R~R•(((s/usr/lib64/python2.7/tarfile.pyRôÝscCs¿i}|j}tjj|ƒ}|jdtjfƒr]|jjdtjƒ}|dR|RïR_RtisregtislnktisdirtissymRñRRRRtlinknameRòtdirnameRó(tmembert dest_pathtfor_datat new_attrsR”t target_pathR_((s/usr/lib64/python2.7/tarfile.pyt_get_filtered_attrsésZ $!               cCs|S(N((RýRþ((s/usr/lib64/python2.7/tarfile.pytfully_trusted_filter(scCs=t||tƒ}|r9|jitd6ƒ|j|�S|S(Ntdeep(RRltupdateR®(RýRþR((s/usr/lib64/python2.7/tarfile.pyt tar_filter+s  cCs=t||tƒ}|r9|jitd6ƒ|j|�S|S(NR(RRnRRlR®(RýRþR((s/usr/lib64/python2.7/tarfile.pyt data_filter2s  t fully_trustedRºRÃc BsôeZdZdd„Zd„Zd„ZeeeƒZd„Zd„Z eee ƒZ d„Z e e e e e e e e e e d„ Zd „Zeed d „Zd „Zd „Zd„Zed„ƒZd„Zed„ƒZed„ƒZed„ƒZeed„ƒZed„ƒZee d„ƒZ ed„ƒZ!ee 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/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. i¤iR1N(R”R_RRRRtchksumtREGTYPER¶RûRRtdevmajortdevminorRÒRÝt pax_headers(R“R”((s/usr/lib64/python2.7/tarfile.pyR•Ns                cCs|jS(N(R”(R“((s/usr/lib64/python2.7/tarfile.pyt_getpathgscCs ||_dS(N(R”(R“R”((s/usr/lib64/python2.7/tarfile.pyt_setpathiscCs|jS(N(Rû(R“((s/usr/lib64/python2.7/tarfile.pyt _getlinkpathmscCs ||_dS(N(Rû(R“Rû((s/usr/lib64/python2.7/tarfile.pyt _setlinkpathoscCs d|jj|jt|ƒfS(Ns<%s %r at %#x>(t __class__R}R”tid(R“((s/usr/lib64/python2.7/tarfile.pyt__repr__ssc 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. ( tcopytdeepcopyR”RR_RûRRRR( R“R”RR_RûRRRRRt_KEEPRã((s/usr/lib64/python2.7/tarfile.pyR®vs(                cCs)|jdkrd}n |jd@}i |jd6|d6|jd6|jd6|jd6|jd6|jd6|jd 6|j d 6|j d 6|j d 6|j d 6|j d6}|d tkrá|djdƒ rá|dcd7n||j||ƒ}y|jd ƒWntk r¦|||nXt||ƒ|kr>|||q>Wx—ddddfD]ƒ\}} ||kr d||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 RÈR!(tpayloadRURV((s/usr/lib64/python2.7/tarfile.pyt_create_payloadHs cCs[|t7}i}d|d<||dR%R)RR<( R5R R¶trecordstkeywordR"R0R-R&R((s/usr/lib64/python2.7/tarfile.pyR1cs(       cCs |j|ƒS(sÃConstruct 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(R5RH((s/usr/lib64/python2.7/tarfile.pytfrombufƒscCsQt|ƒ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|d d !ƒ|_t|d d!ƒ|_||_|dd !|_t |d d!ƒ|_t |dd!ƒ|_t |dd!ƒ|_t|dd!ƒ|_t|dd!ƒ|_t |dd!ƒ}|rý|jtkrý|j jdƒrýt|_n|jƒr!|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 headeri”iœs bad checksumidiliti|iˆi�ii i)iIiQiYiôRe(R R…RÈR†tcountR!R‡R/RKR*RHR'R”R_RRRRR R¶RûRRR R tAREGTYPER¸RRùtrstript GNU_TYPES(R5RHtdircheckR tobjR{((s/usr/lib64/python2.7/tarfile.pyR@Œs@    '  cCs |j|ƒS(sOReturn the next TarInfo object from TarFile object tarfile. (t _fromtarfile(R5Rß((s/usr/lib64/python2.7/tarfile.pyt fromtarfile¿scCsJ|jjtƒ}|j|d|ƒ}|jjƒt|_|j|ƒS(s; See dircheck documentation in _frombuf(). RF(RŸRORÈR@RÂRÒt _proc_member(R5RßRFRHRG((s/usr/lib64/python2.7/tarfile.pyRHÆ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_sparsetXHDTYPER4tSOLARIS_XHDTYPEt _proc_paxt _proc_builtin(R“Rß((s/usr/lib64/python2.7/tarfile.pyRJÛ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ÝR÷R¶tSUPPORTED_TYPESt_blockRRÒt_apply_pax_infoR R?R@(R“RßRÒ((s/usr/lib64/python2.7/tarfile.pyRQès  cCs©|jj|j|jƒƒ}y|j|dtƒ}Wntk rVtdƒ‚nX|j|_|j t kr„t |ƒ|_ n!|j t kr¥t |ƒ|_n|S(sSProcess the blocks that hold a GNU longname or longlink member. RFs missing or bad subsequent header(RŸRORSRRHRlR„RˆRÒR¶R-R'R”R,Rû(R“RßRHtnext((s/usr/lib64/python2.7/tarfile.pyRKùs  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ø(RHt _ringbufferR+R/RR=t_holeRÙR,RŸRORÈRÓRÂRÝRSRRÒ( R“RßRHtspR¡tlastposRÚR.RÒtnumbytest isextendedtorigsize((s/usr/lib64/python2.7/tarfile.pyRMsT             cCs“|jj|j|jƒƒ}|jtkr9|j}n|jjƒ}d}xst|ƒ|krÃ||dkrÃt j ||ƒ}|sšt dƒ‚nyt |j dƒƒ}Wntk rÒt dƒ‚nX|dkrît dƒ‚n||t|ƒkrt dƒ‚n|jdƒ|d}||jdƒd|!}|jdƒ\} } } | s| dks||dkrŽt dƒ‚n| jdƒ} | jdƒ} | || <||7}qQWy|j|d tƒ}Wntk rütd ƒ‚nX|jttfkr�|j||j|jƒ|j|_d |kr�|j}|jƒsg|jtkr€||j|jƒ7}n||_q�n|S( sVProcess an extended or global header as described in POSIX.1-2001. iRsinvalid headeriit=s R:RFs missing or bad subsequent headerR( RŸRORSRR¶R4R RR t_header_length_prefix_retmatchR*R)tgroupRtstarttendt partitionR/RHRlR„RˆRNRORTR?R@RÒRÝR÷RR(R“RßRHR R¡R_R#theader_value_end_offsettkeyword_and_valuet raw_keywordtequalst raw_valueR?R"RURÒ((s/usr/lib64/python2.7/tarfile.pyRPGsN %  #     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. RReiN( R=t PAX_FIELDSRDtPAX_NUMBER_FIELDSRRBtsetattrRR (R“R R?R@R?R"((s/usr/lib64/python2.7/tarfile.pyRT�s     cCsK|dkrtdƒ‚nt|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È(R“RBRURV((s/usr/lib64/python2.7/tarfile.pyRS§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.pyRú¹scCs |jtkS(N(R¶tLNKTYPE(R“((s/usr/lib64/python2.7/tarfile.pyRø»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¶RL(R“((s/usr/lib64/python2.7/tarfile.pytissparseÃscCs|jtttfkS(N(R¶RpRrRt(R“((s/usr/lib64/python2.7/tarfile.pytisdevÅs(4R}R~RR•RRtpropertyRRRRRRRnR®RtDEFAULT_FORMATtENCODINGR#RRR!t classmethodR6R(t staticmethodR)R<R+RNR1RAR@RIRHRJRQRKRMRPRTRSR÷RmRùRúRøRqRsRuRvRw(((s/usr/lib64/python2.7/tarfile.pyRFs^           3 "  2   8 I          s([0-9]{1,20}) c Bs™eZdZdZeZeZdZeZ e Z d8Z eZeZd8Zd8dd8d8d8d8d8d8d8d8d8d8d„ Zd„Zd„ZeeeƒZed8dd8ed„ƒZedd8d„ƒZedd8d d „ƒZedd8d d „ƒZid d 6dd6dd6Zd„Zd„Z d„Z!d„Z"d8d8d8d„Z#e$d„Z%d8e$d8d8d„Z&d8d„Z'd„Z(dd8d8d„Z)dd8d„Z*d„Z+e$d8d „Z,d!„Z-d"„Z.d#„Z/e$d8d8d$„Z0d%„Z1d&„Z2d'„Z3d(„Z4d)„Z5d*„Z6d+„Z7d,„Z8d-„Z9d.„Z:d/„Z;d8ed0„Z<d1„Z=d8d2„Z>d3„Z?d4„Z@d5„ZAd6„ZBd7„ZCRS(9s=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-8R9tawN(-R RR_t_modeR‹Rtexistst bltn_openRlR›RR�R”RntabspathRŸR7Ràt dereferencet ignore_zerosR?R@R R tdebugt errorlevelR¢tmemberst_loadedRÂRÒtinodest firstmemberRURÄRIR=R‡R„R�RkR6RRQR–(R“R”R_RŸR7RàR…R†R?R@R R‡RˆteRH((s/usr/lib64/python2.7/tarfile.pyR•èsŒ  ""     !                                 cCs |jtkS(N(R7R(R“((s/usr/lib64/python2.7/tarfile.pyt _getposixNscCs>ddl}|jdtdƒ|r1t|_n t|_dS(Niÿÿÿÿs use the format attribute insteadi(twarningstwarntDeprecationWarningRR7R2(R“R"R�((s/usr/lib64/python2.7/tarfile.pyt _setposixPs    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'R€sundiscernible modeN(RZsr:*( Rt OPEN_METHRÌRRÂR�R‚RÄRoR—RlR›ttaropen( R5R”R_RŸR tkwargsRžtfunct saved_posR�RdR\((s/usr/lib64/python2.7/tarfile.pyR‘esH               cKs@t|ƒdks|dkr-tdƒ‚n|||||�S(sCOpen uncompressed tar archive name for reading or writing. iRÐsmode must be 'r', 'a' or 'w'(R R(R5R”R_RŸR˜((s/usr/lib64/python2.7/tarfile.pyR—®si c Ksçt|ƒdks|dkr-tdƒ‚nyddl}|jWn#ttfk ritdƒ‚nX|dkrŒt||dƒ}ny.|j |||j||||ƒ|�}Wnt k rÙt dƒ‚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(R RtgziptGzipFileR¤tAttributeErrorR‚RRƒR—RPR�RlR›(R5R”R_RŸt compresslevelR˜R›R\((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Ôt dƒ‚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 availableRžsnot a bzip2 file(R RRšR¤R‚RRËtBZ2FileR—RPtEOFErrorR�RlR›(R5R”R_RŸRžR˜RšR\((s/usr/lib64/python2.7/tarfile.pytbz2openÐs   R—RºRŸR™R¢RšcCs¯|jr dS|jdkr‰|jjttdƒ|jtd7_t|jtƒ\}}|dkr‰|jjtt|ƒq‰n|j s¢|jj ƒnt |_dS(slClose the TarFile. In write-mode, two finishing zero blocks are appended to the archive. NR€ii( R¢R_RŸRQR!RÈRÒRNt RECORDSIZER›R–Rn(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 _getmemberRtKeyError(R“R”Rà((s/usr/lib64/python2.7/tarfile.pyt getmembers cCs'|jƒ|js |jƒn|jS(sŽReturn the members of the archive as a list of TarInfo objects. The list has the same order as the members in the archive. (t_checkRŠt_loadR‰(R“((s/usr/lib64/python2.7/tarfile.pyt getmemberss   cCs g|jƒD]}|j^q S(s‹Return the members of the archive as a list of their names. It has the same order as the list returned by getmembers(). (R©R”(R“Rà((s/usr/lib64/python2.7/tarfile.pytgetnamessc Cs\|jdƒ|d k r%|j}n|d kr:|}ntjj|ƒ\}}|jtjdƒ}|jdƒ}|j ƒ}||_ |d krÔt tdƒrÂ|j rÂtj |ƒ}qétj|ƒ}ntj|jƒƒ}d}|j}tj|ƒr�|j|jf} |j rj|jdkrj| |jkrj||j| krjt} |j| }qt} | dr||j| slink toN(R§R_RRdRRRRRqRsR R RRR´t localtimeR”RùRúRû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. R€iÿÿÿÿNsuse the filter argument insteadistarfile: Excluded %rstarfile: Skipped %ristarfile: Unsupported type %rR}(R§RR�R�R‘t_dbgR”R‹RR„RËR÷RƒtaddfileRùtlistdirtaddR>( R“R”RÆt recursivetexcludetfilterR�Ràtf((s/usr/lib64/python2.7/tarfile.pyRÒ©sB        *       *cCsô|jdƒtj|ƒ}|j|j|j|jƒ}|jj|ƒ|jt |ƒ7_|dk ràt ||j|j ƒt |j tƒ\}}|dkrÊ|jjtt|ƒ|d7}n|j|t7_n|jj|ƒdS(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. R€iiN(R§RR#R7R?R@RŸRQRÒR RRMRRNRÈR!R‰R=(R“RàRŸRHRURV((s/usr/lib64/python2.7/tarfile.pyRÐæs    cCs™|dkrO|j}|dkr%tSt|tƒrKtdddƒ‚n|St|ƒr_|Sy t|SWn'tk r”t 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_filterRRØRkt TypeErrortcallablet_NAMED_FILTERSR¥RRî(R“RÕ((s/usr/lib64/python2.7/tarfile.pyt_get_filter_function s      Rfc CsMg}|j|ƒ}|dkr*|}nxƒ|D]{}|j|||ƒ}|dkr^q1n|jƒr–|j|ƒ|j||dtd|ƒq1|j||d|ƒq1W|jdd„dtƒx}|D]u}t j j ||j ƒ}y4|j ||ƒ|j||ƒ|j||ƒWqÐtk rD} |j| ƒqÐXqÐWdS(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_attrstfilter_functionRcSs|jS(N(R”(R~((s/usr/lib64/python2.7/tarfile.pyt4 streverseN(RÛRt_get_extract_tarinfoRùR=t _extract_oneRltsortRnR‹RR>R”tchowntutimetchmodR€t_handle_nonfatal_error( R“RR‰RÕt directoriesRÝRýRàtdirpathR�((s/usr/lib64/python2.7/tarfile.pyt extractall s.          R1cCsM|j|ƒ}|j|||ƒ}|dk rI|j||d|ƒndS(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'. 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. RÝN(RÛRàRRá(R“RýRRÕRÝRà((s/usr/lib64/python2.7/tarfile.pytextract@ s  cCsøt|tƒr!|j|ƒ}n|}|}d}y|||ƒ}WnEttfk rn}|j|ƒn tk r�}|j|ƒnX|dkrµ|j dd|j ƒdS|}|j ƒrôt j |ƒ}t jj||jƒ|_n|S(s@Get filtered TarInfo (or None) from member, which might be a stristarfile: Excluded %rN(RØt basestringR¦RtOSErrorRët_handle_fatal_errorR€RæRÏR”RøRR‹RR>Rût _link_target(R“RýRÝRRàt unfilteredtfilteredR�((s/usr/lib64/python2.7/tarfile.pyRàP s&  cCsˆ|jdƒy5|j|tjj||jƒ|d|d|ƒWn?tk rd}|j|ƒn tk rƒ}|j |ƒnXdS(s±Extract from filtered tarinfo to disk. filter_function is only used when extracting a *different* member (e.g. as fallback to creating a symlink) RZRÝtextraction_rootN( R§t_extract_memberR‹RR>R”RìRíR€Ræ(R“RàRRÜRÝR�((s/usr/lib64/python2.7/tarfile.pyRám s $ cCsNt|jtƒr>|jdkr'‚qJ|jdd|ƒn tdƒ‚dS(s=Handle non-fatal error (ExtractError) according to errorlevelis tarfile: %sserror level is not an integerN(RØRˆR)RÏRØ(R“R�((s/usr/lib64/python2.7/tarfile.pyRæ s cCsØt|jtƒrÈ|jdkr'‚qÔt|ƒjttgkr¢|jdkrk|j dd|j ƒqÅ|j dd|ƒ|j dd|j |jfƒqÔ|j ddt|ƒj|fƒn t dƒ‚dS(s1Handle "fatal" error according to self.errorleveliis tarfile: %sstarfile: %s %rstarfile: %s %sserror level is not an integerN( RØRˆR)R¶R}tEnvironmentErrorRìtfilenameRRÏtstrerrorRØ(R“R�((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(R§RØRëR¦R÷t fileobjectR¶RRRøRúRŸR—Rƒt extractfilet_find_link_targetR(R“RýRà((s/usr/lib64/python2.7/tarfile.pyR÷™ s  c Csê|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||ƒni|jƒsM|j ƒrl|j||d|d|ƒn2|jtkrŽ|j||ƒn|j||ƒ|ræ|j||ƒ|j ƒsæ|j||ƒ|j||ƒqændS(sçExtract the filtered TarInfo object tarinfo to a physical file called targetpath. filter_function is only used when extracting a *different* member (e.g. as fallback to creating a symlink) Reis%s -> %sRÝRñN(RDR®R‹RhRRüR‚tmakedirsRøRúRÏR”RûR÷tmakefileRùtmakedirRutmakefifoRqRstmakedevtmakelink_with_filterR¶RRt makeunknownRãRåRä(R“Ràt targetpathRÜRÝRñt upperdirs((s/usr/lib64/python2.7/tarfile.pyRò¿ s: #      cCsey3|jdkr"tj|ƒntj|dƒWn+tk r`}|jtjkra‚qanXdS(s,Make a directory called targetpath. iÀN(R_RR‹tmkdirRóterrnotEEXIST(R“RàRR�((s/usr/lib64/python2.7/tarfile.pyRûö scCsJ|j|ƒ}z)t|dƒ�}t||ƒWdQXWd|jƒXdS(s'Make a file called targetpath. RN(R÷RƒRMR–(R“RàRtsourcettarget((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(R�R‹RR€(R“RàR((s/usr/lib64/python2.7/tarfile.pyRü scCsŸttdƒ s ttdƒ r/tdƒ‚n|j}|dkrMd}n|jƒri|tjO}n |tjO}tj ||tj |j |j ƒƒdS(s<Make a character or block device called targetpath. tmknodRýs'special devices not supported by systemi€N( R�R‹R€R_RRsR¯tS_IFBLKtS_IFCHRRRýR R (R“RàRR_((s/usr/lib64/python2.7/tarfile.pyRý s       cCs|j||ddƒS(N(RþR(R“RàR((s/usr/lib64/python2.7/tarfile.pytmakelink1 scCsÉt}ttdƒrÆttdƒrÆ|jƒritjj|ƒrRtj|ƒntj|j|ƒdStjj |j ƒrÌtjj|ƒr tj|ƒntj tjj |j ƒ|ƒdSnt }y|j|ƒ}Wn)tk r |rtdƒ‚q ‚nX|dkr |}nz|dkr?tddƒ‚ny5||jd|jdtƒ|ƒ|||ƒ}Wn#tk r™t||jƒ‚nX|dk rÅ|j||d |d |ƒndS( s3Make 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. filter_function is only used when extracting a *different* member (e.g. as fallback to creating a link). tsymlinktlinkNs%unable to resolve link inside archives6makelink_with_filter: if filter_function is not None, s%extraction_root must also not be NoneR”RRÝRñ(RlR�R‹RúRtlexiststunlinkR RûR‚RîR RõRnRøR¥R€RR®R”t_FILTER_ERRORSRôRò(R“RàRRÝRñtkeyerror_to_extracterrorRïRð((s/usr/lib64/python2.7/tarfile.pyRþ4 sH         cCsHtrDttdƒrDtjƒdkrD|j}|j}ytj|jƒd}Wnt k rfnXytj |j ƒd}Wnt t fk ršnX|dkr°d}n|dkrÅd}nyZ|jƒrùttdƒrùtj|||ƒn%tjdkrtj|||ƒnWqDtk r@}tdƒ‚qDXndS( s6Set owner of targetpath according to tarinfo. tgeteuidiiiÿÿÿÿtlchowntos2emxscould not change ownerN(RÁR�R‹RRRRÃtgetgrnamRR¥tgetpwnamRRØRRúRtsystplatformRãRóR€(R“RàRRtuR�((s/usr/lib64/python2.7/tarfile.pyRãq s,'       cCsb|jdkrdSttdƒr^ytj||jƒWq^tk rZ}tdƒ‚q^XndS(sASet file permissions of targetpath according to tarinfo. NRåscould not change mode(R_RR�R‹RåRóR€(R“RàRR�((s/usr/lib64/python2.7/tarfile.pyRå� scCsl|j}|dkrdSttdƒs,dSytj|||fƒWntk rg}tdƒ‚nXdS(sBSet modification time of targetpath according to tarinfo. NRäs"could not change modification time(RRR�R‹RäRóR€(R“RàRRR�((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´|j dd|j|fƒ|jt 7_qNq´nút k r+}|j r|j dd|j|fƒ|jt 7_qNq´|jdkr´tt|ƒƒ‚q´n‰tk rY|jdkr´tdƒ‚q´n[tk r�}|jdkr´tt|ƒƒ‚q´n%tk r³}tt|ƒƒ‚nXPqNW|dk rØ|jj|ƒn t|_|S(s¨Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. trais0x%X: %sis empty fileN(R§RŒRRŸRÄRÒRnRàRIR‡R†RÏRÈR*R�RkR…R†RˆR‰R=RŠ(R“tmRàR�((s/usr/lib64/python2.7/tarfile.pyRU¨ sF          c Cs|jƒ}t}|dk rXy|j|ƒ}Wntk rJt}qXX|| }n|rstjj|ƒ}nxrt |ƒD]d}|r­|j |j kr€t}q€q€n|rËtjj|j ƒ}n |j }||kr€|Sq€W|rýt|ƒ‚ndS(s}Find an archive member by name from bottom to top. If tarinfo is given, it is used as the starting point. N( R©RlRtindexRRnR‹RtnormpathtreversedRÒR”( R“R”Ràt normalizeR‰tskippingRRýt member_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(RnRURRŠ(R“Rà((s/usr/lib64/python2.7/tarfile.pyR¨ s    cCsW|jr"td|jjƒ‚n|dk rS|j|krStd|jƒ‚ndS(snCheck if TarFile is still open, and if the operation's mode corresponds to TarFile's mode. s %s is closedsbad operation for mode %rN(R¢RPRR}RR_(R“R_((s/usr/lib64/python2.7/tarfile.pyR§ s cCs’|jƒrEdjtdtjj|jƒ|jfƒƒ}d}n|j}|}|j |d|dt ƒ}|dkrŽt d|ƒ‚n|S(sZFind the target member of a symlink or hardlink member in the archive. ReRàRslinkname %r not foundN( RúR>RÕRR‹RRüR”RûR¤RnR¥(R“RàRûtlimitRý((s/usr/lib64/python2.7/tarfile.pyRø s 0   cCs$|jrt|jƒSt|ƒSdS(s$Provide an iterator object. N(RŠtiterR‰tTarIter(R“((s/usr/lib64/python2.7/tarfile.pyRê' s  cCs#||jkrtj|IJndS(s.Write debugging output to sys.stderr. N(R‡Rtstderr(R“tleveltmsg((s/usr/lib64/python2.7/tarfile.pyRÏ/ scCs|jƒ|S(N(R§(R“((s/usr/lib64/python2.7/tarfile.pyt __enter__5 s cCs?|dkr|jƒn"|js2|jjƒnt|_dS(N(RR–R›RŸRnR¢(R“R¶R"t traceback((s/usr/lib64/python2.7/tarfile.pyt__exit__9 s    N(DR}R~RR‡RlR…R†RˆRyR7RzR?RR@RRàRÜRöR×R•RŽR’RxtposixR{R£R‘R—RŸR¢R–R–R¦R©RªRËRnRÎRÒRÐRÛRéRêRàRáRæRíR÷RòRûRúRÿRüRýR RþRãRåRäRUR¤R¨R§RøRêRÏR(R*(((s/usr/lib64/python2.7/tarfile.pyRÌs†  d   H   b %=  .    &6      =   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•K s cCs|S(s Return iterator object. ((R“((s/usr/lib64/python2.7/tarfile.pyRêP 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( RRßRŒRRUR R‰RŠRnt StopIteration(R“Rà((s/usr/lib64/python2.7/tarfile.pyRUT s!   (R}R~RR•RêRU(((s/usr/lib64/python2.7/tarfile.pyR$D 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•n s cCs%|j|ko"|j|jkSS(N(RÒR(R“RÒ((s/usr/lib64/python2.7/tarfile.pyt __contains__q s(R}R~RR•R.(((s/usr/lib64/python2.7/tarfile.pyR-k 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•w s(R}R~RR•(((s/usr/lib64/python2.7/tarfile.pyRÙt sRWcBseZdZRS(s/Represent a hole section in a sparse file. (R}R~R(((s/usr/lib64/python2.7/tarfile.pyRW{ sRVcBs 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/RnR R(R“RÒR/titem((s/usr/lib64/python2.7/tarfile.pyR%† s       (R}R~RR•R%(((s/usr/lib64/python2.7/tarfile.pyRV€ s t TarFileCompatcBsteZdZded„Zd„Zd„Zd„Zd„Zd„Z d„Z d d d „Z d „Z d „ZRS( sRTarFile class compatible with standard module zipfile's ZipFile class. RZcCsßddlm}|dddƒ|tkrDtj||ƒ|_n0|tkrhtj||ƒ|_n tdƒ‚|dd!d krÛ|jj ƒ}xB|D]7}|j |_ |j |_ tj|jƒd |_q�WndS( Niÿÿÿÿ(twarnpy3ks6the TarFileCompat class has been removed in Python 3.0t stacklevelisunknown compression constantiiRZi(R�R2t TAR_PLAINRR—Rßt TAR_GZIPPEDRŸRR©R”RôRt file_sizeR´tgmtimeRt date_time(R“tfileR_t compressionR2R‰R((s/usr/lib64/python2.7/tarfile.pyR•ž s       cCstd„|jƒƒS(NcSs|jS(N(R”(R((s/usr/lib64/python2.7/tarfile.pyRÞ¯ s(Rjtinfolist(R“((s/usr/lib64/python2.7/tarfile.pytnamelist® scCstd„|jjƒƒS(NcSs |jtkS(N(R¶Rl(R((s/usr/lib64/python2.7/tarfile.pyRÞ± s(RÕRßR©(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ßR¦(R“R”((s/usr/lib64/python2.7/tarfile.pytgetinfo· scCs"|jj|jj|ƒƒjƒS(N(RßR÷R¦RO(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 ƒ|_ |j j |||ƒƒdS(Niÿÿÿÿ(tStringIO( t cStringIORAR¤tcalendarRRôR RttimegmR8RRßRÐ(R“tzinfotbytesRARCttinfo((s/usr/lib64/python2.7/tarfile.pytwritestr½ s  cCs|jjƒdS(N(RßR–(R“((s/usr/lib64/python2.7/tarfile.pyR–Ç sN(R}R~RR4R•R<R;R=R>R?RORRQRHR–(((s/usr/lib64/python2.7/tarfile.pyR1š s       cCs7yt|ƒ}|jƒtSWntk r2tSXdS(sfReturn True if name points to a tar archive that we are able to handle, else return False. N(R‘R–RnRRl(R”R\((s/usr/lib64/python2.7/tarfile.pyRÎ s    (ŒRt __version__tversiont __author__t__date__t __cvsid__t __credits__RR‹RLR¯RR´R3RtretoperatorR�RÃRÁR¤Rt__all__R!RÈR£R*R%R'R&R7R RCRoRnRpRrRRttCONTTYPER-R,RLRNR4RORR2R RyRRRlRERiR0R)RjtS_IFLNKtS_IFREGR tS_IFDIRR tS_IFIFOtTSUIDtTSGIDtTSVTXtTUREADtTUWRITEtTUEXECtTGREADtTGWRITEtTGEXECtTOREADtTOWRITEtTOEXECtgetfilesystemencodingRztgetdefaultencodingR$R'R/R8RBRKRMR^RdR|t ExceptionRR€R�R‚RƒR„R…R†R‡R*RˆR‰R—tobjectRœRËRÑRÜRëRìRïRñRòRóRôRìRRnRRRRRÚRRtcompiletUR^RR$R-RÙRWRÎRVR4R5R1RR‘Rƒ(((s/usr/lib64/python2.7/tarfile.pytsX                                                 çAL…  ?     ÿÿ†ÿÿÿÿ|' 4