ó ú4Pc@s´ddlmZddlZdZeeƒZdZdZdefd„ƒYZ de fd „ƒYZ d e fd „ƒYZ e d kr°e d ƒZedjejƒƒƒndS(iÿÿÿÿ(tprint_functionNs! i<s` tArErrorcBseZRS((t__name__t __module__(((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyRstArFilecBsƒeZdZd dd d d d„Zd„Zd„Zd„ZeeƒZ d„Z d„Z d„Z d „Z d „Zd „ZRS( s Representation of an ar archive, see man 1 ar. The interface of this class tries to mimick that of the TarFile module in the standard library. ArFile objects have the following (read-only) properties: - members same as getmembers() trcCs›g|_i|_||_||_|dkr?tjƒ}n||_|dkrutjdkrld}qud}n||_ |dkr—|j ƒndS(s´ Build an ar file representation starting from either a filename or an existing file object. The only supported mode is 'r'. In Python 3, the encoding and errors parameters control how member names are decoded into Unicode strings. Like tarfile, the default encoding is sys.getfilesystemencoding() and the default error handling scheme is 'surrogateescape' (>= 3.2) or 'strict' (< 3.2). s3.2tsurrogateescapetstrictRN( t_ArFile__memberst_ArFile__members_dictt_ArFile__fnamet_ArFile__fileobjtNonetsystgetfilesystemencodingt_ArFile__encodingtversiont_ArFile__errorst_ArFile__index_archive(tselftfilenametmodetfileobjtencodingterrors((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyt__init__)s            cCs|jrt|jdƒ}n!|jr3|j}n tdƒ‚|jtƒtkrctdƒ‚nx›trtj ||jd|j d|j ƒ}|sPn|j j |ƒ||j|j<|jddkræ|j|jdƒqf|j|jddƒqfW|jr|jƒndS( NtrbsUnable to open valid filesUnable to find global headerRRiii(R topenR RtreadtGLOBAL_HEADER_LENGTHt GLOBAL_HEADERtTruetArMembert from_fileRRRtappendR tnametsizetseektclose(Rtfpt newmember((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyt__index_archiveFs(        cCs |j|S(s Return the (last occurrence of a) member in the archive whose name is 'name'. Raise KeyError if no member matches the given name. Note that in case of name collisions the only way to retrieve all members matching a given name is to use getmembers. (R (RR#((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyt getmemberascCs|jS(sø Return a list of all members contained in the archive. The list has the same order of members in the archive and can contain duplicate members (i.e. members with the same name) if they are duplicate in the archive itself. (R(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyt getmembersjscCsg|jD]}|j^q S(s3 Return a list of all member names in the archive. (RR#(Rtf((s1/usr/lib/python2.7/dist-packages/debian/arfile.pytgetnamesuscCs t‚dS(s Not (yet) implemented. N(tNotImplementedError(((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyt extractallzscCs t‚dS(s Not (yet) implemented. N(R.(Rtmembertpath((s1/usr/lib/python2.7/dist-packages/debian/arfile.pytextractscCsTxM|jD]B}t|tƒr5|j|jkr5|S||jkrH|SdSq WdS(s  Return a file object corresponding to the requested member. A member can be specified either as a string (its name) or as a ArMember instance. N(Rt isinstanceR R#R (RR0tm((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyt extractfile„s !cCs t|jƒS(s5 Iterate over the members of the present ar archive. (titerR(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyt__iter__“scCs |j|ƒS(s Same as .getmember(name). (R*(RR#((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyt __getitem__˜sN(RRt__doc__R RRR*R+tpropertytmembersR-R/R2R5R7R8(((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyRs        R cBsøeZdZd„Zddd„ZeeƒZdd„Zdd„Zdd„Z dd„Z d„Z d „Z d „Z d „Zd „Zed „ƒZed„ƒZed„ƒZed„ƒZed„ƒZed„ƒZed„ƒZRS(s Member of an ar archive. Implements most of a file object interface: read, readline, next, readlines, seek, tell, close. ArMember objects have the following (read-only) properties: - name member name in an ar archive - mtime modification time - owner owner user - group owner group - fmode file permissions - size size in bytes - fname file namecCs^d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ dS(N( R t_ArMember__namet_ArMember__mtimet_ArMember__ownert_ArMember__groupt_ArMember__fmodet_ArMember__sizet_ArMember__fnamet _ArMember__fpt_ArMember__offsett_ArMember__end(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyR­s         cCs£|jtƒ}|sdSt|ƒtkr:tdƒ‚n|dd!tkr\tdƒ‚ntjdkr¶|dkr†tjƒ}n|dkr¶tjdkrªd}q³d}q¶nt ƒ}|d d !j d ƒd j ƒ|_ tjdkr |j j ||ƒ|_ nt|d d !ƒ|_t|d d !ƒ|_t|d d!ƒ|_|dd!|_t|dd!ƒ|_||_|jƒ|_|j|j|_|S(sŒfp is an open File object positioned on a valid file header inside an ar archive. Return a new ArMember on success, None otherwise. sIncorrect header lengthi:i<sIncorrect file magict3s3.2RRiit/ii"i(i0N(RtFILE_HEADER_LENGTHR tlentIOErrort FILE_MAGICR RRR tsplittstripR<tdecodetintR=R>R?R@RARBttellRDRE(R'tfnameRRtbufR,((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyR!¹s6    # icCs±|jdkr:t|jdƒ|_|jj|jƒn|jjƒ}|dkrx||j|krx|jj|ƒS||jks–||jkršdS|jj|j|ƒS(NRit( RCR RRBR%RDRPRER(RR$tcur((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyRòscCs«|jdkr:t|jdƒ|_|jj|jƒn|dk rx|jj|ƒ}|jjƒ|jkrtdS|S|jjƒ}|jjƒ|jkr£dS|SdS(NRRS( RCR RRBR%RDtreadlineRPRE(RR$RR((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyRUs cCsz|jdkr:t|jdƒ|_|jj|jƒnd}g}x-tru|jƒ}|sePn|j|ƒqIW|S(NR( RCR RRBR%RDRRUR"(RtsizehintRRtlines((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyt readliness  cCs|jdkr:t|jdƒ|_|jj|jƒn|jjƒ|jkrh|jj|jƒn|dkr£||jjƒ|jkr£td|ƒ‚n|dkrÅ|jj|dƒnR|dkrî|jj|j|dƒn)|dkr|jj|j|dƒndS(NRisCan't seek at %dii( RCR RRBR%RDRPRJRE(Rtoffsettwhence((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyR%"s(   cCsk|jdkr:t|jdƒ|_|jj|jƒn|jjƒ}||jkr\dS||jSdS(NRi(RCR RRBR%RDRP(RRT((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyRP4scCstS(N(R(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pytseekable@scCs#|jdk r|jjƒndS(N(RCR R&(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyR&CscCs |jƒS(N(RU(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pytnextGscs‡fd†}t|ƒƒS(Nc3sˆjƒ}|r|VndS(N(RU(tline(R(s1/usr/lib/python2.7/dist-packages/debian/arfile.pytnextlineKs (R6(RR^((Rs1/usr/lib/python2.7/dist-packages/debian/arfile.pyR7JscCs|jS(N(R<(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pytRscCs|jS(N(R=(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyR_SscCs|jS(N(R>(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyR_TscCs|jS(N(R?(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyR_UscCs|jS(N(R@(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyR_VscCs|jS(N(RA(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyR_WscCs|jS(N(RB(R((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyR_XsN(RRR9RR R!t staticmethodRRURXR%RPR[R&R\R7R:R#tmtimetownertgrouptfmodeR$RQ(((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyR žs(  4         t__main__stest.ars (t __future__RR RRIRRHRKt ExceptionRtobjectRR RtatprinttjoinR-(((s1/usr/lib/python2.7/dist-packages/debian/arfile.pyts  ¼