
bc           @   sG  d  Z  d Z d Z d Z d Z d Z d Z d d l m Z	 d d	 l
 Z
 d d	 l Z d d	 l Z d d	 l Z d d	 l Z d d	 l Z d d	 l Z d d	 l Z d d	 l Z d d	 l Z y d d	 l Z d d	 l Z Wn e k
 r e Z Z n Xd
 d d d g Z d Z d Z e 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 Z) d Z* d Z+ d Z, d  Z- d! Z. d" Z/ d# Z0 d$ Z1 d% Z2 e1 Z3 e! e" e# e$ e' e( e) e% e& e* e+ e, f Z4 e! e" e) e, f Z5 e* e+ e, f Z6 d& d' d( d) d* d+ d, d- f Z7 i e8 d. 6e8 d/ 6e8 d) 6e9 d* 6e9 d+ 6e9 d( 6Z: d0 Z; d1 Z< d2 Z= d3 Z> d4 Z? d5 Z@ d6 ZA d7 ZB d ZC d8 ZD d9 ZE d: ZF d; ZG d< ZH d= ZI d> ZJ d% ZK d$ ZL e
 jM   ZN eN e k re
 jO   ZN n  d?   ZP d@   ZQ dA   ZR d= e3 dB  ZS dC   ZT dD   ZU e dE  ZV e; dF f e< dG f e= dH f e> dI f e? dJ f e@ dK f f eD dL f f eE dM f f eF eA BdN f eA d f eF d  f f eG dL f f eH dM f f eI eB BdN f eB d f eI d  f f eJ dL f f eK dM f f eL eC BdO f eC dP f eL d  f f f
 ZW dQ   ZX d eY f dR     YZZ dS eZ f dT     YZ[ dU eZ f dV     YZ\ dW eZ f dX     YZ] dY eZ f dZ     YZ^ d[ eZ f d\     YZ_ d] e_ f d^     YZ` d_ e_ f d`     YZa da e_ f db     YZb dc e_ f dd     YZc de e_ f df     YZd dg f  dh     YZe di f  dj     YZf dk eg f dl     YZh dm eg f dn     YZi do eg f dp     YZj dq eg f dr     YZk d eg f ds     YZl d
 eg f dt     YZm du f  dv     YZn dw f  dx     YZo dy eo f dz     YZp d{ eo f d|     YZq d} er f d~     YZs d# Zt d= Zu d f  d     YZv d   Zw em j Z d	 S(   s,   Read from and write to tar format archives.
s   $Revision: 85213 $s   0.9.0s!   Lars Gustbel (lars@gustaebel.de)s   $Date$s   $Id$s3   Gustavo Niemeyer, Niels Gustbel, Richard Townsend.i(   t   openNt   TarFilet   TarInfot
   is_tarfilet   TarErrors    i   i   s   ustar   s   ustar 00id   i   t   0t   1t   2t   3t   4t   5t   6t   7t   Lt   Kt   St   xt   gt   Xi    i   i   t   patht   linkpatht   sizet   mtimet   uidt   gidt   unamet   gnamet   atimet   ctimei   i   i `  i @  i    i   i   i   i   i   i@   i    i   i   i   c         C   s   |  |  | t  |   t S(   s@   Convert a python string to a null-terminated string buffer.
    (   t   lent   NUL(   t   st   length(    (    s   /usr/lib/python2.7/tarfile.pyt   stn   s    c         C   s'   |  j  d  } | d k r |  S|  |  S(   s?   Convert a null-terminated string field to a python string.
    s    i(   t   find(   R   t   p(    (    s   /usr/lib/python2.7/tarfile.pyt   nts   s    c         C   s   |  d t  d  k r^ y% t t |   j   p1 d d  } Wq t k
 rZ t d   q XnI d } x@ t t |   d  D]( } | d K} | t |  | d  7} q{ W| S(   s/   Convert a number field to a python number.
    i    i   R   i   s   invalid headerl    i   (	   t   chrt   intR$   t   stript
   ValueErrort   InvalidHeaderErrort   xrangeR   t   ord(   R   t   nt   i(    (    s   /usr/lib/python2.7/tarfile.pyt   nti   s    %
c         C   s   d |  k o d | d k  n r? d | d |  f t  } n | t k s_ |  d | d k rn t d   n  |  d k  r t j d t j d |    d }  n  d	 } x6 t | d  D]$ } t |  d
 @ | } |  d L}  q Wt d  | } | S(   s/   Convert a python number to a number field.
    i    i   i   s   %0*oi   s   overflow in number fieldR   t   lt    i   i   (   R   t
   GNU_FORMATR(   t   structt   unpackt   packR*   R%   (   R,   t   digitst   formatR   R-   (    (    s   /usr/lib/python2.7/tarfile.pyt   itn   s    	$ %c         C   s   | d k r y |  j  | d  SWq t k
 r g  } xU |  D]M } y | j | j  | d   Wq= t k
 r | j | j  d   q= Xq= Wd j |  SXn |  j  | |  Sd S(   s*   Convert a unicode object to a string.
    s   utf-8t   strictt   utf8R0   N(   t   encodet   UnicodeEncodeErrort   appendt   join(   R   t   encodingt   errorsR   t   c(    (    s   /usr/lib/python2.7/tarfile.pyt   uts   s    c         C   sx   d t  t j d |  d   t j d |  d d !  } d t  t j d |  d   t j d |  d d !  } | | f S(	   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.
    i   t   148Bi   t   356Bi   i   t   148bt   356b(   t   sumR2   R3   (   t   buft   unsigned_chksumt   signed_chksum(    (    s   /usr/lib/python2.7/tarfile.pyt   calc_chksums   s    	77c         C   s   | d k r d S| d k r0 t j |  |  d Sd } t | |  \ } } xQ t |  D]C } |  j |  } t |  | k  r t d   n  | j |  qX W| d k r |  j |  } t |  | k  r t d   n  | j |  n  d S(   sj   Copy length bytes from fileobj src to fileobj dst.
       If length is None, copy the entire content.
    i    Ni   i   s   end of file reachedi @  (	   t   Nonet   shutilt   copyfileobjt   divmodR*   t   readR   t   IOErrort   write(   t   srct   dstR    t   BUFSIZEt   blockst	   remaindert   bRG   (    (    s   /usr/lib/python2.7/tarfile.pyRM     s$    R/   t   -RW   t   dR@   R#   t   rt   wR   t   tt   Tc         C   si   g  } xS t  D]K } xB | D]- \ } } |  | @| k r | j |  Pq q W| j d  q Wd j |  S(   sc   Convert a file's mode to a string of the form
       -rwxrwxrwx.
       Used by TarFile.list()
    RX   R0   (   t   filemode_tableR<   R=   (   t   modet   permt   tablet   bitt   char(    (    s   /usr/lib/python2.7/tarfile.pyt   filemode7  s    c           B   s   e  Z d  Z RS(   s   Base exception.(   t   __name__t
   __module__t   __doc__(    (    (    s   /usr/lib/python2.7/tarfile.pyR   F  s   t   ExtractErrorc           B   s   e  Z d  Z RS(   s%   General exception for extract errors.(   Re   Rf   Rg   (    (    (    s   /usr/lib/python2.7/tarfile.pyRh   I  s   t	   ReadErrorc           B   s   e  Z d  Z RS(   s&   Exception for unreadable tar archives.(   Re   Rf   Rg   (    (    (    s   /usr/lib/python2.7/tarfile.pyRi   L  s   t   CompressionErrorc           B   s   e  Z d  Z RS(   s.   Exception for unavailable compression methods.(   Re   Rf   Rg   (    (    (    s   /usr/lib/python2.7/tarfile.pyRj   O  s   t   StreamErrorc           B   s   e  Z d  Z RS(   s=   Exception for unsupported operations on stream-like TarFiles.(   Re   Rf   Rg   (    (    (    s   /usr/lib/python2.7/tarfile.pyRk   R  s   t   HeaderErrorc           B   s   e  Z d  Z RS(   s!   Base exception for header errors.(   Re   Rf   Rg   (    (    (    s   /usr/lib/python2.7/tarfile.pyRl   U  s   t   EmptyHeaderErrorc           B   s   e  Z d  Z RS(   s   Exception for empty headers.(   Re   Rf   Rg   (    (    (    s   /usr/lib/python2.7/tarfile.pyRm   X  s   t   TruncatedHeaderErrorc           B   s   e  Z d  Z RS(   s    Exception for truncated headers.(   Re   Rf   Rg   (    (    (    s   /usr/lib/python2.7/tarfile.pyRn   [  s   t   EOFHeaderErrorc           B   s   e  Z d  Z RS(   s"   Exception for end of file headers.(   Re   Rf   Rg   (    (    (    s   /usr/lib/python2.7/tarfile.pyRo   ^  s   R)   c           B   s   e  Z d  Z RS(   s   Exception for invalid headers.(   Re   Rf   Rg   (    (    (    s   /usr/lib/python2.7/tarfile.pyR)   a  s   t   SubsequentHeaderErrorc           B   s   e  Z d  Z RS(   s3   Exception for missing and invalid extended headers.(   Re   Rf   Rg   (    (    (    s   /usr/lib/python2.7/tarfile.pyRp   d  s   t   _LowLevelFilec           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s   Low-level file object. Supports reading and writing.
       It is used instead of a regular file object for streaming
       access.
    c         C   sg   i t  j d 6t  j t  j Bt  j Bd 6| } t t  d  rK | t  j O} n  t  j | | d  |  _ d  S(   NRZ   R[   t   O_BINARYi  (	   t   ost   O_RDONLYt   O_WRONLYt   O_CREATt   O_TRUNCt   hasattrRr   R    t   fd(   t   selft   nameR_   (    (    s   /usr/lib/python2.7/tarfile.pyt   __init__q  s    
c         C   s   t  j |  j  d  S(   N(   Rs   t   closeRy   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR}   z  s    c         C   s   t  j |  j |  S(   N(   Rs   RO   Ry   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyRO   }  s    c         C   s   t  j |  j |  d  S(   N(   Rs   RQ   Ry   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyRQ     s    (   Re   Rf   Rg   R|   R}   RO   RQ   (    (    (    s   /usr/lib/python2.7/tarfile.pyRq   k  s
   				t   _Streamc           B   s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	 d
  Z d d  Z d   Z d   Z RS(   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.
    c         C   s  t  |  _ | d k r0 t | |  } t |  _ n  | d k rW t |  } | j   } n  | p` d |  _ | |  _ | |  _	 | |  _
 | |  _ d |  _ d |  _ t |  _ y | d k r)y d d l } Wn t k
 r t d   n X| |  _ | j d  d @|  _ | d	 k r|  j   q|  j   nu | d
 k ry d d l } Wn t k
 rdt d   n X| d	 k rd |  _ | j   |  _ q| j   |  _ n  Wn, |  j s|  j
 j   n  t  |  _   n Xd S(   s$   Construct a _Stream object.
        t   *R0   l    t   gziNs   zlib module is not availablel    RZ   t   bz2s   bz2 module is not available(   t   Truet   _extfileobjRK   Rq   t   Falset   _StreamProxyt   getcomptypeR{   R_   t   comptypet   fileobjt   bufsizeRG   t   post   closedt   zlibt   ImportErrorRj   t   crc32t   crct   _init_read_gzt   _init_write_gzR   t   dbuft   BZ2Decompressort   cmpt   BZ2CompressorR}   (   Rz   R{   R_   R   R   R   R   R   (    (    s   /usr/lib/python2.7/tarfile.pyR|     sP    												c         C   s*   t  |  d  r& |  j r& |  j   n  d  S(   NR   (   Rx   R   R}   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   __del__  s    c         C   s   |  j  j d |  j  j |  j  j |  j  j d  |  _ t j d t t	 j	     } |  j
 d |  t |  j  t k r |  j j d d  |  _ n  |  j j d  r |  j d  |  _ n  |  j
 |  j t  d	 S(
   s6   Initialize for writing with gzip compression.
        i	   i    s   <Ls   %ss
   iso-8859-1t   replaces   .gziN(   R   t   compressobjt   DEFLATEDt	   MAX_WBITSt   DEF_MEM_LEVELR   R2   R4   t   longt   timet   _Stream__writet   typeR{   t   unicodeR:   t   endswithR   (   Rz   t	   timestamp(    (    s   /usr/lib/python2.7/tarfile.pyR     s    
	c         C   s{   |  j  d k r1 |  j j | |  j  d @|  _ n  |  j t |  7_ |  j  d k rj |  j j |  } n  |  j |  d S(   s&   Write string s to the stream.
        R   l    t   tarN(	   R   R   R   R   R   R   R   t   compressR   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyRQ     s    "c         C   s_   |  j  | 7_  xI t |  j   |  j k rZ |  j j |  j  |  j   |  j  |  j |  _  q Wd S(   s]   Write string s to the stream if a whole new block
           is ready to be written.
        N(   RG   R   R   R   RQ   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyt   __write  s    c         C   s  |  j  r d St |  _  z |  j d k rR |  j d k rR |  j |  j j   7_ n  |  j d k r |  j r |  j j |  j  d |  _ |  j d k r |  j j t	 j
 d |  j d @  |  j j t	 j
 d |  j d @  q n  Wd |  j s |  j j   n  Xd S(   s[   Close the _Stream object. No operation should be
           done on it afterwards.
        NR[   R   R0   R   s   <Ll    (   R   R   R_   R   RG   R   t   flushR   RQ   R2   R4   R   R   R   R}   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR}     s    			#-	c         C   ss  |  j  j |  j  j  |  _ d |  _ |  j d  d k rI t d   n  |  j d  d k rm t d   n  t |  j d   } |  j d  | d	 @r t |  j d   d
 t |  j d   } |  j	 |  n  | d @rx3 t
 r|  j d  } | s
| t k r Pq q Wn  | d @rUx3 t
 rQ|  j d  } | sJ| t k r"Pq"q"Wn  | d @ro|  j d  n  d S(   s:   Initialize for reading a gzip compressed fileobj.
        R0   i   s   s   not a gzip filei   s   s   unsupported compression methodi   i   i   i   i   N(   R   t   decompressobjR   R   R   t   _Stream__readRi   Rj   R+   RO   R   R   (   Rz   t   flagt   xlenR   (    (    s   /usr/lib/python2.7/tarfile.pyR     s.    	
,
	
	
c         C   s   |  j  S(   s3   Return the stream's file pointer position.
        (   R   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   tell#  s    i    c         C   s|   | |  j  d k ri t | |  j  |  j  \ } } x$ t |  D] } |  j |  j  q? W|  j |  n t d   |  j  S(   sX   Set the stream's file pointer to pos. Negative seeking
           is forbidden.
        i    s    seeking backwards is not allowed(   R   RN   R   R*   RO   Rk   (   Rz   R   RU   RV   R-   (    (    s   /usr/lib/python2.7/tarfile.pyt   seek(  s    c         C   s   | d k rZ g  } x3 t rG |  j |  j  } | s7 Pn  | j |  q Wd j |  } n |  j |  } |  j t |  7_ | S(   s   Return the next size number of bytes from the stream.
           If size is not defined, return all bytes of the stream
           up to EOF.
        R0   N(   RK   R   t   _readR   R<   R=   R   R   (   Rz   R   R\   RG   (    (    s   /usr/lib/python2.7/tarfile.pyRO   5  s    	c         C   s   |  j  d k r |  j |  St |  j  } |  j g } x | | k  r |  j |  j  } | sb Pn  y |  j j |  } Wn t k
 r t d   n X| j	 |  | t |  7} q: Wd j
 |  } | | |  _ | |  S(   s+   Return size bytes from the stream.
        R   s   invalid compressed dataR0   (   R   R   R   R   R   R   t
   decompressRP   Ri   R<   R=   (   Rz   R   R@   R\   RG   (    (    s   /usr/lib/python2.7/tarfile.pyR   G  s"    c         C   s   t  |  j  } |  j g } xL | | k  ri |  j j |  j  } | sI Pn  | j |  | t  |  7} q Wd j |  } | | |  _ | |  S(   ss   Return size bytes from stream. If internal buffer is empty,
           read another block from the stream.
        R0   (   R   RG   R   RO   R   R<   R=   (   Rz   R   R@   R\   RG   (    (    s   /usr/lib/python2.7/tarfile.pyt   __read]  s    N(   Re   Rf   Rg   R|   R   R   RQ   R   R}   R   R   R   RK   RO   R   R   (    (    (    s   /usr/lib/python2.7/tarfile.pyR~     s   		4			
						R   c           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   ss   Small proxy class that enables transparent compression
       detection for the Stream interface (mode 'r|*').
    c         C   s"   | |  _  |  j  j t  |  _ d  S(   N(   R   RO   t	   BLOCKSIZERG   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyR|   s  s    	c         C   s   |  j  j |  _ |  j S(   N(   R   RO   RG   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyRO   w  s    c         C   sJ   |  j  j d  r d S|  j  d d !d k rF |  j  d d !d k rF d	 Sd
 S(   Ns   R   i    i   t   BZhi   i
   s   1AY&SYR   R   (   RG   t
   startswith(   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR   {  s
    ,c         C   s   |  j  j   d  S(   N(   R   R}   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR}     s    (   Re   Rf   Rg   R|   RO   R   R}   (    (    (    s   /usr/lib/python2.7/tarfile.pyR   n  s
   			t	   _BZ2Proxyc           B   sS   e  Z d  Z d
 Z d   Z d   Z d   Z d   Z d   Z d   Z	 d	   Z
 RS(   s  Small 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.
    i   i   c         C   s8   | |  _  | |  _ t |  j  d d   |  _ |  j   d  S(   NR{   (   R   R_   t   getattrRK   R{   t   init(   Rz   R   R_   (    (    s   /usr/lib/python2.7/tarfile.pyR|     s    		c         C   sb   d d  l  } d |  _ |  j d k rO | j   |  _ |  j j d  d |  _ n | j   |  _ d  S(   Nii    RZ   R0   (	   R   R   R_   R   t   bz2objR   R   RG   R   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    	c         C   s   |  j  g } t |  j   } x^ | | k  r{ |  j j |  j  } | sI Pn  |  j j |  } | j |  | t |  7} q Wd j |  |  _  |  j  |  } |  j  | |  _  |  j	 t |  7_	 | S(   NR0   (
   RG   R   R   RO   t	   blocksizeR   R   R<   R=   R   (   Rz   R   RW   R   t   rawt   dataRG   (    (    s   /usr/lib/python2.7/tarfile.pyRO     s    c         C   s4   | |  j  k  r |  j   n  |  j | |  j   d  S(   N(   R   R   RO   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    c         C   s   |  j  S(   N(   R   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    c         C   s;   |  j  t |  7_  |  j j |  } |  j j |  d  S(   N(   R   R   R   R   R   RQ   (   Rz   R   R   (    (    s   /usr/lib/python2.7/tarfile.pyRQ     s    c         C   s5   |  j  d k r1 |  j j   } |  j j |  n  d  S(   NR[   (   R_   R   R   R   RQ   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyR}     s    i @  (   Re   Rf   Rg   R   R|   R   RO   R   R   RQ   R}   (    (    (    s   /usr/lib/python2.7/tarfile.pyR     s   		
				t   _FileInFilec           B   s\   e  Z d  Z d	 d  Z d   Z d   Z d	 d  Z d   Z d   Z	 d   Z
 d   Z RS(
   s   A thin wrapper around an existing file object that
       provides a part of its data as an individual file
       object.
    c         C   s1   | |  _  | |  _ | |  _ | |  _ d |  _ d  S(   Ni    (   R   t   offsetR   t   sparset   position(   Rz   R   R   R   R   (    (    s   /usr/lib/python2.7/tarfile.pyR|     s
    				c         C   s   |  j  S(   s*   Return the current file position.
        (   R   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    c         C   s   | |  _  d S(   s(   Seek to a position in the file.
        N(   R   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    c         C   se   | d k r |  j |  j } n t | |  j |  j  } |  j d k rT |  j |  S|  j |  Sd S(   s!   Read data from the file.
        N(   RK   R   R   t   minR   t
   readnormalt
   readsparse(   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyRO     s    c         C   s7   |  j  j |  } t |  | k r3 t d   n  | S(   Ns   unexpected end of data(   R   RO   R   Ri   (   Rz   R   RG   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    c         C   s6   |  j  j |  j |  j  |  j | 7_ |  j |  S(   s*   Read operation for regular files.
        (   R   R   R   R   t   _FileInFile__read(   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    c         C   s\   g  } xF | d k rN |  j  |  } | s. Pn  | t |  8} | j |  q	 Wd j |  S(   s)   Read operation for sparse files.
        i    R0   (   t   readsparsesectionR   R<   R=   (   Rz   R   R   RG   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    c         C   s   |  j  j |  j  } | d k r% d St | | j | j |  j  } t | t  r | j	 |  j | j } |  j
 j |  j |  |  j | 7_ |  j |  S|  j | 7_ t | Sd S(   s0   Read a single section of a sparse file.
        R0   N(   R   R"   R   RK   R   R   R   t
   isinstancet   _datat   realposR   R   R   R   (   Rz   R   t   sectionR   (    (    s   /usr/lib/python2.7/tarfile.pyR     s     N(   Re   Rf   Rg   RK   R|   R   R   RO   R   R   R   R   (    (    (    s   /usr/lib/python2.7/tarfile.pyR     s   					t   ExFileObjectc           B   sh   e  Z d  Z d Z d   Z d d  Z d d  Z d   Z d   Z	 e
 j d  Z d	   Z d
   Z RS(   sa   File-like object for reading an archive member.
       Is returned by TarFile.extractfile().
    i   c         C   sm   t  | j | j | j t | d d    |  _ | j |  _ d |  _ t |  _	 | j |  _ d |  _
 d |  _ d  S(   NR   RZ   i    R0   (   R   R   t   offset_dataR   R   RK   R{   R_   R   R   R   t   buffer(   Rz   t   tarfilet   tarinfo(    (    s   /usr/lib/python2.7/tarfile.pyR|     s    				c         C   s   |  j  r t d   n  d } |  j rh | d k rH |  j } d |  _ qh |  j |  } |  j | |  _ n  | d k r | |  j j   7} n  | |  j j | t |   7} |  j t |  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.
        s   I/O operation on closed fileR0   N(   R   R(   R   RK   R   RO   R   R   (   Rz   R   RG   (    (    s   /usr/lib/python2.7/tarfile.pyRO   ,  s    			 ic         C   s,  |  j  r t d   n  d |  j k r@ |  j j d  d } n |  j g } x t r |  j j |  j  } | j |  | s d | k rO d j	 |  |  _ |  j j d  d } | d k r t
 |  j  } n  PqO qO W| d k r 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.
        s   I/O operation on closed files   
i   R0   i    i(   R   R(   R   R"   R   R   RO   R   R<   R=   R   R   R   (   Rz   R   R   t   buffersRG   (    (    s   /usr/lib/python2.7/tarfile.pyt   readlineD  s(    		c         C   s:   g  } x- t  r5 |  j   } | s% Pn  | j |  q	 W| S(   s0   Return a list with all remaining lines.
        (   R   R   R<   (   Rz   t   resultt   line(    (    s   /usr/lib/python2.7/tarfile.pyt	   readlinesc  s    	 c         C   s   |  j  r t d   n  |  j S(   s*   Return the current file position.
        s   I/O operation on closed file(   R   R(   R   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR   m  s    	c         C   s  |  j  r t d   n  | t j k rH t t | d  |  j  |  _ n | t j k r | d k  r t |  j | d  |  _ q t |  j | |  j  |  _ nC | t j	 k r t t |  j | |  j  d  |  _ n t d   d |  _
 |  j j |  j  d S(   s(   Seek to a position in the file.
        s   I/O operation on closed filei    s   Invalid argumentR0   N(   R   R(   Rs   t   SEEK_SETR   t   maxR   R   t   SEEK_CURt   SEEK_ENDR   R   R   (   Rz   R   t   whence(    (    s   /usr/lib/python2.7/tarfile.pyR   u  s    	!(	c         C   s   t  |  _ d S(   s   Close the file object.
        N(   R   R   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR}     s    c         c   s,   x% t  r' |  j   } | s Pn  | Vq Wd S(   s/   Get an iterator over the file's lines.
        N(   R   R   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyt   __iter__  s
    	N(   Re   Rf   Rg   R   R|   RK   RO   R   R   R   Rs   R   R   R}   R   (    (    (    s   /usr/lib/python2.7/tarfile.pyR     s   		
		c           B   s  e  Z d  Z d d  Z d   Z d   Z e e e  Z d   Z d   Z	 e e e	  Z
 d   Z d   Z e e d	 d
  Z d   Z d   Z d   Z e d    Z d   Z e d    Z e d    Z e d    Z e e d   Z e d    Z e 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#   Z+ d$   Z, d%   Z- d&   Z. RS('   s  Informational 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.
    R0   c         C   s   | |  _  d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ t |  _ d |  _	 d |  _
 d |  _ d |  _ d |  _ d |  _ d |  _ i  |  _ d S(   sX   Construct a TarInfo object. name is the optional name
           of the member.
        i  i    R0   N(   R{   R_   R   R   R   R   t   chksumt   REGTYPER   t   linknameR   R   t   devmajort   devminorR   R   t   pax_headers(   Rz   R{   (    (    s   /usr/lib/python2.7/tarfile.pyR|     s     															c         C   s   |  j  S(   N(   R{   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   _getpath  s    c         C   s   | |  _  d  S(   N(   R{   (   Rz   R{   (    (    s   /usr/lib/python2.7/tarfile.pyt   _setpath  s    c         C   s   |  j  S(   N(   R   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   _getlinkpath  s    c         C   s   | |  _  d  S(   N(   R   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyt   _setlinkpath  s    c         C   s    d |  j  j |  j t |   f S(   Ns   <%s %r at %#x>(   t	   __class__Re   R{   t   id(   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   __repr__  s    c         C   s  i |  j  d 6|  j d @d 6|  j d 6|  j d 6|  j d 6|  j d 6|  j d 6|  j d	 6|  j d
 6|  j	 d 6|  j
 d 6|  j d 6|  j d 6} | d	 t k r | d j d  r | d c d 7<n  xA d D]9 } t | |  t k r | | j | |  | | <q q W| S(   s9   Return the TarInfo's attributes as a dictionary.
        R{   i  R_   R   R   R   R   R   R   R   R   R   R   R   t   /(   R{   R   R   R   (   R{   R_   R   R   R   R   R   R   R   R   R   R   R   t   DIRTYPER   R   R:   (   Rz   R>   R?   t   infot   key(    (    s   /usr/lib/python2.7/tarfile.pyt   get_info  s(    










$!R8   c         C   ss   |  j  | |  } | t k r+ |  j |  S| t k rD |  j |  S| t k rc |  j | | |  St d   d S(   s<   Return a tar header as a string of 512 byte blocks.
        s   invalid formatN(   R   t   USTAR_FORMATt   create_ustar_headerR1   t   create_gnu_headert
   PAX_FORMATt   create_pax_headerR(   (   Rz   R6   R>   R?   R   (    (    s   /usr/lib/python2.7/tarfile.pyt   tobuf  s    c         C   sy   t  | d <t | d  t k r/ t d   n  t | d  t k ri |  j | d  \ | d <| d <n  |  j | t  S(   s3   Return the object as a ustar header block.
        t   magicR   s   linkname is too longR{   t   prefix(   t   POSIX_MAGICR   t   LENGTH_LINKR(   t   LENGTH_NAMEt   _posix_split_namet   _create_headerR   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    
$c         C   s   t  | d <d } t | d  t k rC | |  j | d t  7} n  t | d  t k rv | |  j | d t  7} n  | |  j | t  S(   s:   Return the object as a GNU header block sequence.
        R   R0   R   R{   (	   t	   GNU_MAGICR   R   t   _create_gnu_long_headert   GNUTYPE_LONGLINKR   t   GNUTYPE_LONGNAMER   R1   (   Rz   R   RG   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    
c         C   s  t  | d <|  j j   } x d d t f d d t f d d f D] \ } } } | | k r_ q> n  | | j | |  } y | j d	  Wn t k
 r | | | <q> n Xt | |  | k r> | | | <q> q> Wx d d d d f D] \ } }	 | | k r	d | | <q n  | | } d | k o2d |	 d k  n sGt	 | t
  r t |  | | <d | | <q q W| r|  j |  }
 n d }
 |
 |  j | t  S(   s   Return the object as a ustar header block. If it cannot be
           represented this way, prepend a pax extended header sequence
           with supplement information.
        R   R{   R   R   R   R   i    R   t   asciiR   i   R   R   i   R   i    i   R0   (   R   R   i    (   R   R   i    (   R   i   (   R   i   (   R   i   (   R   i   (   R   R   t   copyR   R   t   decodeR:   R;   R   R   t   floatR   t   _create_pax_generic_headerR   R   (   Rz   R   R>   R?   R   R{   t   hnameR    t   valR5   RG   (    (    s   /usr/lib/python2.7/tarfile.pyR     s6    



4c         C   s   |  j  | d t S(   sA   Return the object as a pax global header block sequence.
        R   (   R   t   XGLTYPE(   t   clsR   (    (    s   /usr/lib/python2.7/tarfile.pyt   create_pax_global_headerD  s    c         C   s   | t  d  } x$ | r4 | d d k r4 | d  } q W| t |  } | d  } | sh t |  t k rw t d   n  | | f S(   sU   Split a name longer than 100 chars into a prefix
           and a name part.
        i   iR   s   name is too long(   t   LENGTH_PREFIXR   R   R(   (   Rz   R{   R   (    (    s   /usr/lib/python2.7/tarfile.pyR   J  s    
c         C   s  t  |  j d d  d  t |  j d d  d @d |  t |  j d d  d |  t |  j d	 d  d |  t |  j d
 d  d |  t |  j d d  d |  d |  j d t  t  |  j d d  d  t  |  j d t  d  t  |  j d d  d  t  |  j d d  d  t |  j d d  d |  t |  j d d  d |  t  |  j d d  d  g } t j d t d j |   } t	 | t  d } | d  d | | d } | S(   s   Return a header block. info is a dictionary with file
           information, format must be one of the *_FORMAT constants.
        R{   R0   id   R_   i    i  i   R   R   R   i   R   s           R   R   R   R   i    R   R   R   R   i   s   %dsis   %06o i(
   R!   t   getR7   R   R   R2   R4   R   R=   RJ   (   R   R6   t   partsRG   R   (    (    s   /usr/lib/python2.7/tarfile.pyR   Y  s&    c         C   s@   t  t |   t  \ } } | d k r< |  t | t 7}  n  |  S(   sd   Return the string payload filled with zero bytes
           up to the next 512 byte border.
        i    (   RN   R   R   R   (   t   payloadRU   RV   (    (    s   /usr/lib/python2.7/tarfile.pyt   _create_payloadu  s    c         C   s[   | t  7} i  } d | d <| | d <t |  | d <t | d <|  j | t  |  j |  S(   sT   Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence
           for name.
        s   ././@LongLinkR{   R   R   R   (   R   R   R   R   R   R  (   R  R{   R   R   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    



c   
      C   s  g  } x | j    D] \ } } | j d  } | j d  } t |  t |  d } d } } x6 t r | t t |   } | | k r Pn  | } qd W| j d | | | f  q Wd j |  } i  }	 d |	 d <| |	 d <t |  |	 d	 <t |	 d
 <|  j |	 t	  |  j
 |  S(   s   Return a POSIX.1-2001 extended or global header sequence
           that contains a list of keyword, value pairs. The values
           must be unicode objects.
        R9   i   i    s	   %d %s=%s
R0   s   ././@PaxHeaderR{   R   R   R   (   t	   iteritemsR:   R   R   t   strR<   R=   R   R   R   R  (
   R  R   R   t   recordst   keywordt   valueR/   R,   R#   R   (    (    s   /usr/lib/python2.7/tarfile.pyR     s(    
	



c         C   sK  t  |  d k r! t d   n  t  |  t k rB t d   n  | j t  t k rf t d   n  t | d d ! } | t |  k r t	 d   n  |    } | | _
 t | d d ! | _ t | d d	 ! | _ t | d	 d
 ! | _ t | d
 d ! | _ t | d d ! | _ t | d d ! | _ | | _ | d d !| _ t | d d ! | _ t | d d ! | _ t | d d ! | _ t | d d ! | _ t | d d ! | _ t | d d ! } | j t k r| j j d  rt | _ n  | j   r| j j d  | _ n  | rG| j t k rG| d | j | _ n  | S(   sB   Construct a TarInfo object from a 512 byte string buffer.
        i    s   empty headers   truncated headers   end of file headeri   i   s   bad checksumid   il   it   i|   i   i   i  i	  i)  iI  iQ  iY  i  R   (   R   Rm   R   Rn   t   countR   Ro   R.   RJ   R)   RG   R$   R{   R_   R   R   R   R   R   R   R   R   R   R   R   t   AREGTYPER   R   t   isdirt   rstript	   GNU_TYPES(   R  RG   R   t   objR   (    (    s   /usr/lib/python2.7/tarfile.pyt   frombuf  s@    			!c         C   sD   | j  j t  } |  j |  } | j  j   t | _ | j |  S(   sO   Return the next TarInfo object from TarFile object
           tarfile.
        (   R   RO   R   R  R   R   t   _proc_member(   R  R   RG   R  (    (    s   /usr/lib/python2.7/tarfile.pyt   fromtarfile  s    c         C   st   |  j  t t f k r" |  j |  S|  j  t k r> |  j |  S|  j  t t t f k rc |  j	 |  S|  j
 |  Sd S(   sY   Choose the right processing method depending on
           the type and call it.
        N(   R   R   R   t   _proc_gnulongt   GNUTYPE_SPARSEt   _proc_sparset   XHDTYPER  t   SOLARIS_XHDTYPEt	   _proc_paxt   _proc_builtin(   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyR    s    c         C   sx   | j  j   |  _ |  j } |  j   s6 |  j t k rO | |  j |  j  7} n  | | _ |  j	 | j
 | j | j  |  S(   sf   Process a builtin type or an unknown type which
           will be treated as a regular file.
        (   R   R   R   t   isregR   t   SUPPORTED_TYPESt   _blockR   R   t   _apply_pax_infoR   R>   R?   (   Rz   R   R   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    		c         C   s   | j  j |  j |  j   } y |  j |  } Wn t k
 rP t d   n X|  j | _ |  j t	 k r~ t
 |  | _ n! |  j t k r t
 |  | _ n  | S(   sS   Process the blocks that hold a GNU longname
           or longlink member.
        s    missing or bad subsequent header(   R   RO   R   R   R  Rl   Rp   R   R   R   R$   R{   R   R   (   Rz   R   RG   t   next(    (    s   /usr/lib/python2.7/tarfile.pyR    s    c         C   ss  |  j  } t   } d } d } d } x t d  D] } y6 t | | | d ! } t | | d | d ! }	 Wn t k
 r Pn X| | k r | j t | | |   n  | j t | |	 |   | |	 7} | |	 } | d 7} q1 Wt | d  }
 t | d d ! } x |
 d	 k r| j	 j
 t  } d
 } x t d  D] } y6 t | | | d ! } t | | d | d ! }	 Wn t k
 rPn X| | k r| j t | | |   n  | j t | |	 |   | |	 7} | |	 } | d 7} q=Wt | d  }
 qW| | k  r/| j t | | |   n  | |  _ | j	 j   |  _ |  j |  j |  j  | _ | |  _ |  S(   s8   Process a GNU sparse header plus extra headers.
        i  l    i   i   i   i  i  i  i   i    i   i  (   RG   t   _ringbufferR*   R.   R(   R<   t   _holeR   R+   R   RO   R   R   R   R   R   R   R   (   Rz   R   RG   t   spR   t   lastposR   R-   R   t   numbytest
   isextendedt   origsize(    (    s   /usr/lib/python2.7/tarfile.pyR  '  sT    		



		c         C   s  | j  j |  j |  j   } |  j t k r9 | j } n | j j   } t j	 d t j
  } d } x t r!| j | |  } | s Pn  | j   \ } } t |  } | d k r t d   n  | | j d  d | j d  | d !}	 | j d  } |	 j d  }	 |	 | | <| | 7} qf Wy |  j |  }
 Wn t k
 rTt d   n X|  j t t f k r|
 j | | j | j  |  j |
 _ d | k r|
 j } |
 j   s|
 j t k r| |
 j |
 j  7} n  | | _ qn  |
 S(	   sV   Process an extended or global header as described in
           POSIX.1-2001.
        s   (\d+) ([^=]+)=i    s   invalid headeri   i   R9   s    missing or bad subsequent headerR   (   R   RO   R   R   R   R  R   R   t   ret   compilet   UR   t   matcht   groupsR&   R)   t   endt   startR   R  Rl   Rp   R  R  R!  R>   R?   R   R   R  R  (   Rz   R   RG   R   t   regexR   R-  R    R  R  R"  R   (    (    s   /usr/lib/python2.7/tarfile.pyR  _  s@    	+
	c         C   s   x | j    D] \ } } | t k r+ q n  | d k rI | j d  } n  | t k r y t | |  } Wq t k
 r d } q Xn t | | |  } t |  | |  q W| j   |  _ d S(   so   Replace fields with supplemental information from a previous
           pax extended or global header.
        R   R   i    N(	   R	  t
   PAX_FIELDSR  t   PAX_NUMBER_FIELDSR(   RA   t   setattrR   R   (   Rz   R   R>   R?   R  R  (    (    s   /usr/lib/python2.7/tarfile.pyR!    s    c         C   s0   t  | t  \ } } | r( | d 7} n  | t S(   s_   Round up a byte count by BLOCKSIZE and return it,
           e.g. _block(834) => 1024.
        i   (   RN   R   (   Rz   R  RU   RV   (    (    s   /usr/lib/python2.7/tarfile.pyR     s    c         C   s   |  j  t k S(   N(   R   t   REGULAR_TYPES(   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR    s    c         C   s
   |  j    S(   N(   R  (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   isfile  s    c         C   s   |  j  t k S(   N(   R   R   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR    s    c         C   s   |  j  t k S(   N(   R   t   SYMTYPE(   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   issym  s    c         C   s   |  j  t k S(   N(   R   t   LNKTYPE(   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   islnk  s    c         C   s   |  j  t k S(   N(   R   t   CHRTYPE(   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   ischr  s    c         C   s   |  j  t k S(   N(   R   t   BLKTYPE(   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   isblk  s    c         C   s   |  j  t k S(   N(   R   t   FIFOTYPE(   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   isfifo  s    c         C   s   |  j  t k S(   N(   R   R  (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   issparse  s    c         C   s   |  j  t t t f k S(   N(   R   R;  R=  R?  (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   isdev  s    (/   Re   Rf   Rg   R|   R   R   t   propertyR   R   R   R   R   R   t   DEFAULT_FORMATt   ENCODINGR   R   R   R   t   classmethodR  R   t   staticmethodR   R  R   R  R   R  R  R  R  R  R  R  R!  R   R  R6  R  R8  R:  R<  R>  R@  RA  RB  (    (    (    s   /usr/lib/python2.7/tarfile.pyR     sP   									3	
.				8	<												c           B   sH  e  Z d  Z d Z e Z e Z d Z e Z	 e
 Z d2 Z e Z e Z d2 d d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d  Z d   Z d   Z e e e  Z e d2 d d2 e d   Z e d d2 d   Z e d d2 d	 d
   Z e d d2 d	 d   Z i d d 6d d 6d d 6Z d   Z d   Z d   Z  d   Z! d2 d2 d2 d  Z" e# d  Z$ d2 e# d2 d2 d  Z% d2 d  Z& d d2 d  Z' d d  Z( d   Z) d   Z* d    Z+ d!   Z, d"   Z- d#   Z. d$   Z/ d%   Z0 d&   Z1 d'   Z2 d(   Z3 d)   Z4 d2 e d*  Z5 d+   Z6 d2 d,  Z7 d-   Z8 d.   Z9 d/   Z: d0   Z; d1   Z< RS(3   s=   The TarFile Class provides an interface to tar archives.
    i    i   RZ   c         C   s  i d d 6d d 6d d 6} | | k r6 t  d   n  | |  _ | | |  _ | s |  j d k r t j j |  r d |  _ d |  _ n  t | |  j  } t |  _ nN | d k r t
 | d  r | j } n  t
 | d	  r | j |  _ n  t |  _ | rt j j |  n d |  _ | |  _ | d k	 r7| |  _ n  | d k	 rO| |  _ n  | d k	 rg| |  _ n  | d k	 r| |  _ n  | d k	 r| |  _ n  |	 d k	 r|	 |  _ n! | d k rd
 |  _ n	 d |  _ |
 d k	 r|  j t k r|
 |  _ n	 i  |  _ | d k	 r| |  _ n  | d k	 r0| |  _ n  t |  _ g  |  _ t |  _ |  j j   |  _ i  |  _ y9|  j d k rd |  _ |  j    |  _ n  |  j d k r7x t r3|  j j! |  j  y& |  j j" |   } |  j j# |  Wqt$ k
 r|  j j! |  j  Pqt% k
 r/} t& t' |    qXqWn  |  j d k rt |  _ |  j r|  j j( |  j j)    } |  j j* |  |  j t+ |  7_ qn  Wn, |  j s|  j j,   n  t |  _   n Xd S(   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.
        t   rbRZ   s   r+bt   at   wbR[   s   mode must be 'r', 'a' or 'w'R{   R_   s   utf-8R8   t   awN(-   R(   R_   t   _modeRs   R   t   existst	   bltn_openR   R   RK   Rx   R{   R   t   abspathR   R6   R   t   dereferencet   ignore_zerosR>   R?   R   R   t   debugt
   errorlevelR   t   memberst   _loadedR   R   t   inodest   firstmemberR"  R   R  R<   Ro   Rl   Ri   R
  R  R   RQ   R   R}   (   Rz   R{   R_   R   R6   R   RP  RQ  R>   R?   R   RR  RS  t   modest   eRG   (    (    s   /usr/lib/python2.7/tarfile.pyR|     s    	"		!													c         C   s   |  j  t k S(   N(   R6   R   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt	   _getposixR  s    c         C   s>   d d  l  } | j d t d  | r1 t |  _ n	 t |  _ d  S(   Nis    use the format attribute insteadi   (   t   warningst   warnt   DeprecationWarningR   R6   R1   (   Rz   R  R[  (    (    s   /usr/lib/python2.7/tarfile.pyt	   _setposixT  s    c            sO  | r | r t  d   n  | d k r   f d   } x t   j d | D] } t     j |  } | d k	 r | j   }	 n  y | | d | |  SWqN t t f k
 r }
 | d k	 rN | j |	  qN qN qN XqN Wt d   nUd | k rq| j	 d d  \ } } | pd } | p#d	 } |   j k rNt     j |  } n t d
 |   | | | | |  Sd | k r| j	 d d  \ } } | pd } | pd	 } | d k rt  d   n  t
 | | | | |  } y   | | | |  } Wn | j     n Xt | _ | S| d k r?  j | | | |  St  d   d S(   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
        s   nothing to openRZ   s   r:*c            s     j  |  d k S(   Nt   taropen(   t	   OPEN_METH(   R   (   R  (    s   /usr/lib/python2.7/tarfile.pyt   not_compressed  s    R   s%   file could not be opened successfullyt   :i   R   s   unknown compression type %rt   |R[   s   mode must be 'r' or 'w'RI  s   undiscernible modeN(   RZ   s   r:*(   RZ   R[   (   RI  R[   (   R(   t   sortedR`  R   RK   R   Ri   Rj   R   t   splitR~   R}   R   R   R_  (   R  R{   R_   R   R   t   kwargsRa  R   t   funct	   saved_posRY  Rd   t   streamR\   (    (   R  s   /usr/lib/python2.7/tarfile.pyR    i  sP    
	c         K   s.   | d k r t  d   n  |  | | | |  S(   sC   Open uncompressed tar archive name for reading or writing.
        RZ   RI  R[   s   mode must be 'r', 'a' or 'w'(   RZ   RI  R[   (   R(   (   R  R{   R_   R   Rf  (    (    s   /usr/lib/python2.7/tarfile.pyR_    s    i	   c         K   s*  | d k r t  d   n  y d d l } | j Wn# t t f k
 rW t d   n Xy | j | | | |  } Wn; t k
 r | d k	 r | d k r t d   n    n Xy |  j	 | | | |  } WnL t
 k
 r	| j   | d k rt d   n    n | j     n Xt | _ | S(	   sk   Open gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        RZ   R[   s   mode must be 'r' or 'w'iNs   gzip module is not availables   not a gzip file(   RZ   R[   (   R(   t   gzipt   GzipFileR   t   AttributeErrorRj   t   OSErrorRK   Ri   R_  RP   R}   R   R   (   R  R{   R_   R   t   compresslevelRf  Rj  R\   (    (    s   /usr/lib/python2.7/tarfile.pyt   gzopen  s2    

	c         K   s   | d	 k r t  d   n  y d d l } Wn t k
 rJ t d   n X| d k	 ri t | |  } n | j | | d | } y |  j | | | |  } WnR t t	 f k
 r | j
   | d k r t d   n    n | j
     n Xt | _ | S(
   sl   Open bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
        RZ   R[   s   mode must be 'r' or 'w'.iNs   bz2 module is not availableRn  s   not a bzip2 file(   RZ   R[   (   R(   R   R   Rj   RK   R   t   BZ2FileR_  RP   t   EOFErrorR}   Ri   R   R   (   R  R{   R_   R   Rn  Rf  R   R\   (    (    s   /usr/lib/python2.7/tarfile.pyt   bz2open  s*    

	R_  R   Ro  R   Rr  R   c         C   s   |  j  r d St |  _  z |  j d k r |  j j t t d  |  j t d 7_ t |  j t	  \ } } | d k r |  j j t t	 |  q n  Wd |  j
 s |  j j   n  Xd S(   sl   Close the TarFile. In write-mode, two finishing zero blocks are
           appended to the archive.
        NRK  i   i    (   R   R   R_   R   RQ   R   R   R   RN   t
   RECORDSIZER   R}   (   Rz   RU   RV   (    (    s   /usr/lib/python2.7/tarfile.pyR}   
  s    		"	c         C   s2   |  j  |  } | d k r. t d |   n  | S(   s  Return 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.
        s   filename %r not foundN(   t
   _getmemberRK   t   KeyError(   Rz   R{   R   (    (    s   /usr/lib/python2.7/tarfile.pyt	   getmember  s    c         C   s'   |  j    |  j s  |  j   n  |  j S(   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   _checkRU  t   _loadRT  (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt
   getmembers*  s    
	c         C   s    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().
        (   Ry  R{   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyt   getnames4  s    c         C   s\  |  j  d  | d
 k	 r% | j } n  | d
 k r: | } n  t j j |  \ } } | j t j d  } | j d  } |  j	   } |  | _
 | d
 k r t t d  r |  j r t j |  } q t j |  } n t j | j    } d } | j } t j |  r| j | j f }	 |  j rj| j d k rj|	 |  j k rj| |  j |	 k rjt }
 |  j |	 } qt }
 |	 d r| |  j |	 <qn t j |  rt }
 ns t j |  rt }
 n[ t j |  rt }
 t j |  } n4 t j  |  rt! }
 n t j" |  rt# }
 n d
 S| | _ | | _$ | j% | _& | j' | _( |
 t k r]| j) | _* n	 d | _* | j+ | _, |
 | _- | | _. t/ ry t/ j0 | j&  d | _1 Wqt2 k
 rqXn  t3 ry t3 j4 | j(  d | _5 Wqt2 k
 rqXn  |
 t! t# f k rXt t d  rXt t d	  rXt j6 | j7  | _8 t j9 | j7  | _: qXn  | S(   s  Create 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.
        RK  R   t   lstatR0   i   i    l    t   majort   minorN(;   Rw  RK   R{   Rs   R   t
   splitdriveR   t   sept   lstripR   R   Rx   RP  R{  t   statt   fstatt   filenot   st_modet   S_ISREGt   st_inot   st_devt   st_nlinkRV  R9  R   t   S_ISDIRR   t   S_ISFIFOR?  t   S_ISLNKR7  t   readlinkt   S_ISCHRR;  t   S_ISBLKR=  R_   t   st_uidR   t   st_gidR   t   st_sizeR   t   st_mtimeR   R   R   t   pwdt   getpwuidR   Ru  t   grpt   getgrgidR   R|  t   st_rdevR   R}  R   (   Rz   R{   t   arcnameR   t   drvR   t   statresR   t   stmdt   inodeR   (    (    s   /usr/lib/python2.7/tarfile.pyt
   gettarinfo:  s~    			"
									c         C   s  |  j    x |  D] } | r t | j  Gd | j p< | j | j pK | j f G| j   sh | j   r d d | j	 | j
 f Gn d | j Gd t j | j  d  Gn  | j | j   r d n d G| r| j   r d	 G| j Gn  | j   rd
 G| j Gqn  Hq Wd S(   s   Print a table of contents to sys.stdout. If `verbose' is False, only
           the names of the members are printed. If it is True, an `ls -l'-like
           output is produced.
        s   %s/%ss   %10ss   %d,%ds   %10ds   %d-%02d-%02d %02d:%02d:%02di   R   R0   s   ->s   link toN(   Rw  Rd   R_   R   R   R   R   R<  R>  R   R   R   R   t	   localtimeR   R{   R  R8  R   R:  (   Rz   t   verboseR   (    (    s   /usr/lib/python2.7/tarfile.pyt   list  s&    
c   	      C   s  |  j  d  | d k r" | } n  | d k	 rt d d l } | j d t d  | |  rt |  j d d |  d Sn  |  j d k	 r t j j	 |  |  j k r |  j d d |  d S|  j d |  |  j
 | |  } | d k r |  j d d	 |  d S| d k	 r;| |  } | d k r;|  j d d |  d Sn  | j   rrt | d
   } |  j | |  Wd QXn | j   r|  j |  | rxQ t j |  D]= } |  j t j j | |  t j j | |  | | |  qWqn |  j |  d S(   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.
        RK  iNs   use the filter argument insteadi   s   tarfile: Excluded %rs   tarfile: Skipped %ri   s   tarfile: Unsupported type %rRH  (   Rw  RK   R[  R\  R]  t   _dbgR{   Rs   R   RO  R  R  RN  t   addfileR  t   listdirt   addR=   (	   Rz   R{   R  t	   recursivet   excludet   filterR[  R   t   f(    (    s   /usr/lib/python2.7/tarfile.pyR    sB    		
**c         C   s   |  j  d  t j |  } | j |  j |  j |  j  } |  j j |  |  j t	 |  7_ | d k	 r t | |  j | j  t | j t  \ } } | d k r |  j j t t |  | d 7} n  |  j | t 7_ n  |  j j |  d S(   sm  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 directly, or by using gettarinfo().
           On Windows platforms, `fileobj' should always be opened with mode
           'rb' to avoid irritation about the file size.
        RK  i    i   N(   Rw  R   R   R6   R>   R?   R   RQ   R   R   RK   RM   R   RN   R   R   RT  R<   (   Rz   R   R   RG   RU   RV   (    (    s   /usr/lib/python2.7/tarfile.pyR    s    t   .c         C   s3  g  } | d k r |  } n  xR | D]J } | j   r\ | j |  t j |  } d | _ n  |  j | |  q" W| j d t j d   | j	   x | D] } t
 j j | | j  } y4 |  j | |  |  j | |  |  j | |  Wq t k
 r*} |  j d k r  q+|  j d d |  q Xq Wd S(   sM  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().
        i  R   R{   i   s   tarfile: %sN(   RK   R  R<   R   R_   t   extractt   sortt   operatort
   attrgettert   reverseRs   R   R=   R{   t   chownt   utimet   chmodRh   RS  R  (   Rz   R   RT  t   directoriesR   t   dirpathRY  (    (    s   /usr/lib/python2.7/tarfile.pyt
   extractall  s*    	
R0   c         C   s7  |  j  d  t | t  r. |  j |  } n | } | j   r^ t j j | | j  | _	 n  y& |  j
 | t j j | | j   Wn t k
 r } |  j d k r   q3| j d k r |  j d d | j  q3|  j d d | j | j f  n< t k
 r2} |  j d k r  q3|  j d d |  n Xd S(   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'.
        RZ   i    i   s   tarfile: %ss   tarfile: %s %rN(   Rw  R   t
   basestringRv  R:  Rs   R   R=   R   t   _link_targett   _extract_memberR{   t   EnvironmentErrorRS  t   filenameRK   R  t   strerrorRh   (   Rz   t   memberR   R   RY  (    (    s   /usr/lib/python2.7/tarfile.pyR  6  s$    &#c         C   s   |  j  d  t | t  r. |  j |  } n | } | j   rP |  j |  |  S| j t k ro |  j |  |  S| j   s | j	   r t |  j
 t  r t d   q |  j |  j |   Sn d Sd S(   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()
        RZ   s'   cannot extract (sym)link as file objectN(   Rw  R   R  Rv  R  t
   fileobjectR   R  R:  R8  R   R~   Rk   t   extractfilet   _find_link_targetRK   (   Rz   R  R   (    (    s   /usr/lib/python2.7/tarfile.pyR  W  s    	c         C   s  | j  d  } | j d t j  } t j j |  } | r_ t j j |  r_ t j |  n  | j   sw | j	   r |  j
 d d | j | j f  n |  j
 d | j  | j   r |  j | |  n | j   r |  j | |  n | j   r
|  j | |  n | j   s"| j   r5|  j | |  n] | j   sM| j	   r`|  j | |  n2 | j t k r|  j | |  n |  j | |  |  j | |  | j	   s|  j | |  |  j | |  n  d S(   s\   Extract the TarInfo object tarinfo to a physical
           file called targetpath.
        R   i   s   %s -> %sN(   R  R   Rs   R  R   t   dirnameRM  t   makedirsR:  R8  R  R{   R   R  t   makefileR  t   makedirR@  t   makefifoR<  R>  t   makedevt   makelinkR   R  t   makeunknownR  R  R  (   Rz   R   t
   targetpatht	   upperdirs(    (    s   /usr/lib/python2.7/tarfile.pyR  }  s2    #c         C   sF   y t  j | d  Wn+ t k
 rA } | j t j k rB   qB n Xd S(   s,   Make a directory called targetpath.
        i  N(   Rs   t   mkdirR  t   errnot   EEXIST(   Rz   R   R  RY  (    (    s   /usr/lib/python2.7/tarfile.pyR    s
    c         C   sJ   |  j  |  } z) t | d   } t | |  Wd QXWd | j   Xd S(   s'   Make a file called targetpath.
        RJ  N(   R  RN  RM   R}   (   Rz   R   R  t   sourcet   target(    (    s   /usr/lib/python2.7/tarfile.pyR    s
    c         C   s+   |  j  | |  |  j d d | j  d S(   sY   Make a file from a TarInfo object with an unknown type
           at targetpath.
        i   s9   tarfile: Unknown file type %r, extracted as regular file.N(   R  R  R   (   Rz   R   R  (    (    s   /usr/lib/python2.7/tarfile.pyR    s    c         C   s/   t  t d  r t j |  n t d   d S(   s'   Make a fifo called targetpath.
        t   mkfifos   fifo not supported by systemN(   Rx   Rs   R  Rh   (   Rz   R   R  (    (    s   /usr/lib/python2.7/tarfile.pyR    s    c         C   s   t  t d  s  t  t d  r/ t d   n  | j } | j   rT | t j O} n | t j O} t j | | t j	 | j
 | j   d S(   s<   Make a character or block device called targetpath.
        t   mknodR  s'   special devices not supported by systemN(   Rx   Rs   Rh   R_   R>  R  t   S_IFBLKt   S_IFCHRR  R  R   R   (   Rz   R   R  R_   (    (    s   /usr/lib/python2.7/tarfile.pyR    s     	c         C   s  t  t d  r t  t d  r | j   rb t j j |  rL t j |  n  t j | j |  qt j j | j	  r t j j |  r t j |  n  t j
 | j	 |  q|  j |  j |  |  n= y |  j |  j |  |  Wn t k
 rt d   n Xd S(   s   Make a (symbolic) link called targetpath. If it cannot be created
          (platform limitation), we try to make a copy of the referenced file
          instead of a link.
        t   symlinkt   links%   unable to resolve link inside archiveN(   Rx   Rs   R8  R   t   lexistst   unlinkR  R   RM  R  R  R  R  Ru  Rh   (   Rz   R   R  (    (    s   /usr/lib/python2.7/tarfile.pyR    s    c         C   s  t  rt t d  rt j   d k ry t j | j  d } Wn t k
 r] | j } n Xy t  j	 | j
  d } Wn t k
 r | j } n XyZ | j   r t t d  r t j | | |  n% t j d k r t j | | |  n  Wqt k
 r} t d   qXn  d S(   s6   Set owner of targetpath according to tarinfo.
        t   geteuidi    i   t   lchownt   os2emxs   could not change ownerN(   R  Rx   Rs   R  R  t   getgrnamR   Ru  R   t   getpwnamR   R   R8  R  t   syst   platformR  R  Rh   (   Rz   R   R  R   t   uRY  (    (    s   /usr/lib/python2.7/tarfile.pyR    s     'c         C   sO   t  t d  rK y t j | | j  WqK t k
 rG } t d   qK Xn  d S(   sA   Set file permissions of targetpath according to tarinfo.
        R  s   could not change modeN(   Rx   Rs   R  R_   R  Rh   (   Rz   R   R  RY  (    (    s   /usr/lib/python2.7/tarfile.pyR  	  s
    c         C   sY   t  t d  s d Sy  t j | | j | j f  Wn t k
 rT } t d   n Xd S(   sB   Set modification time of targetpath according to tarinfo.
        R  Ns"   could not change modification time(   Rx   Rs   R  R   R  Rh   (   Rz   R   R  RY  (    (    s   /usr/lib/python2.7/tarfile.pyR  	  s     c         C   s%  |  j  d  |  j d k	 r2 |  j } d |  _ | S|  j |  j j   k r |  j j |  j d  |  j j d  s t d   q n  d } xkt	 ry |  j
 j |   } WnGt k
 r } |  j r|  j d d |  j | f  |  j t 7_ q qn t k
 rk} |  j rD|  j d d |  j | f  |  j t 7_ q q|  j d k rt t |    qn t k
 r|  j d k rt d   qn[ t k
 r} |  j d k rt t |    qn% t k
 r} t t |    n XPq W| d k	 r|  j j |  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.
        t   rai   s   unexpected end of datai   s   0x%X: %si    s
   empty fileN(   Rw  RW  RK   R   R   R   R   RO   Ri   R   R   R  Ro   RQ  R  R   R)   R
  Rm   Rn   Rp   RT  R<   RU  (   Rz   t   mR   RY  (    (    s   /usr/lib/python2.7/tarfile.pyR"  #	  sL    							c         C   s   |  j    } | d k	 r. | | j |   } n  | rI t j j |  } n  xK t |  D]= } | rz t j j | j  } n	 | j } | | k rV | SqV Wd S(   s}   Find an archive member by name from bottom to top.
           If tarinfo is given, it is used as the starting point.
        N(   Ry  RK   t   indexRs   R   t   normpatht   reversedR{   (   Rz   R{   R   t	   normalizeRT  R  t   member_name(    (    s   /usr/lib/python2.7/tarfile.pyRt  Y	  s    	c         C   s6   x& t  r( |  j   } | d k r Pq q Wt  |  _ d S(   sW   Read through the entire archive file and look for readable
           members.
        N(   R   R"  RK   RU  (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyRx  p	  s
    	c         C   sW   |  j  r" t d |  j j   n  | d k	 rS |  j | k rS t d |  j   n  d S(   sn   Check if TarFile is still open, and if the operation's mode
           corresponds to TarFile's mode.
        s   %s is closeds   bad operation for mode %rN(   R   RP   R   Re   RK   R_   (   Rz   R_   (    (    s   /usr/lib/python2.7/tarfile.pyRw  z	  s    	c         C   s   | j    rE d j t d t j j | j  | j f   } d } n | j } | } |  j	 | d | d t
 } | d k r t d |   n  | S(   sZ   Find the target member of a symlink or hardlink member in the
           archive.
        R   R   R  s   linkname %r not foundN(   R8  R=   R  RK   Rs   R   R  R{   R   Rt  R   Ru  (   Rz   R   R   t   limitR  (    (    s   /usr/lib/python2.7/tarfile.pyR  	  s    0		c         C   s$   |  j  r t |  j  St |   Sd S(   s$   Provide an iterator object.
        N(   RU  t   iterRT  t   TarIter(   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR   	  s    	c         C   s#   | |  j  k r t j | IJn  d S(   s.   Write debugging output to sys.stderr.
        N(   RR  R  t   stderr(   Rz   t   levelt   msg(    (    s   /usr/lib/python2.7/tarfile.pyR  	  s    c         C   s   |  j    |  S(   N(   Rw  (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt	   __enter__	  s    
c         C   s?   | d  k r |  j   n" |  j s2 |  j j   n  t |  _ d  S(   N(   RK   R}   R   R   R   R   (   Rz   R   R  t	   traceback(    (    s   /usr/lib/python2.7/tarfile.pyt   __exit__	  s
    	N(=   Re   Rf   Rg   RR  R   RP  RQ  RS  RD  R6   RE  R>   RK   R?   R   R   R   R  R|   RZ  R^  RC  t   posixRF  Rs  R    R_  Ro  Rr  R`  R}   Rv  Ry  Rz  R  R   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R"  Rt  Rx  Rw  R  R   R  R  R  (    (    (    s   /usr/lib/python2.7/tarfile.pyR     st   e		M!
			
	c=%!	&	/		
									6	
					R  c           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   sM   Iterator Class.

       for tarinfo in TarFile(...):
           suite...
    c         C   s   | |  _  d |  _ d S(   s$   Construct a TarIter object.
        i    N(   R   R  (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyR|   	  s    	c         C   s   |  S(   s    Return iterator object.
        (    (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR   	  s    c         C   s   |  j  d k r3 |  j j d k	 r3 |  j j   } np |  j  t |  j j  k  rd |  j j |  j  } n? |  j j s |  j j   } | s t |  j _ t	  q n t	  |  j  d 7_  | S(   s   Return the next item using TarFile's next() method.
           When all members have been read, set TarFile as _loaded.
        i    i   N(
   R  R   RW  RK   R"  R   RT  RU  R   t   StopIteration(   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyR"  	  s    !(   Re   Rf   Rg   R|   R   R"  (    (    (    s   /usr/lib/python2.7/tarfile.pyR  	  s   		t   _sectionc           B   s    e  Z d  Z d   Z d   Z RS(   s$   Base class for _data and _hole.
    c         C   s   | |  _  | |  _ d  S(   N(   R   R   (   Rz   R   R   (    (    s   /usr/lib/python2.7/tarfile.pyR|   	  s    	c         C   s%   |  j  | k o" |  j  |  j k  SS(   N(   R   R   (   Rz   R   (    (    s   /usr/lib/python2.7/tarfile.pyt   __contains__	  s    (   Re   Rf   Rg   R|   R  (    (    (    s   /usr/lib/python2.7/tarfile.pyR  	  s   	R   c           B   s   e  Z d  Z d   Z RS(   s/   Represent a data section in a sparse file.
    c         C   s    t  j |  | |  | |  _ d  S(   N(   R  R|   R   (   Rz   R   R   R   (    (    s   /usr/lib/python2.7/tarfile.pyR|   	  s    (   Re   Rf   Rg   R|   (    (    (    s   /usr/lib/python2.7/tarfile.pyR   	  s   R$  c           B   s   e  Z d  Z RS(   s/   Represent a hole section in a sparse file.
    (   Re   Rf   Rg   (    (    (    s   /usr/lib/python2.7/tarfile.pyR$  	  s   R#  c           B   s    e  Z d  Z d   Z d   Z RS(   sM   Ringbuffer class which increases performance
       over a regular list.
    c         C   s   d |  _  d  S(   Ni    (   t   idx(   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR|   	  s    c         C   su   |  j  } x\ t rg |  | } | | k r, Pn  | d 7} | t |   k rQ d } n  | |  j  k r d  Sq W| |  _  | S(   Ni   i    (   R  R   R   RK   (   Rz   R   R  t   item(    (    s   /usr/lib/python2.7/tarfile.pyR"   	  s    		

		(   Re   Rf   Rg   R|   R"   (    (    (    s   /usr/lib/python2.7/tarfile.pyR#  	  s   	t   TarFileCompatc           B   st   e  Z d  Z d e d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d d d	  Z d
   Z d   Z RS(   sR   TarFile class compatible with standard module zipfile's
       ZipFile class.
    RZ   c         C   s   d d l  m } | d d d | t k rD t j | |  |  _ n0 | t k rh t j | |  |  _ n t d   | d d !d	 k r |  j j	   } xB | D]7 } | j
 | _ | j | _ t j | j  d
  | _ q Wn  d  S(   Ni(   t   warnpy3ks6   the TarFileCompat class has been removed in Python 3.0t
   stackleveli   s   unknown compression constanti    i   RZ   i   (   R[  R  t	   TAR_PLAINR   R_  R   t   TAR_GZIPPEDRo  R(   Ry  R{   R  R   t	   file_sizeR   t   gmtimeR   t	   date_time(   Rz   t   fileR_   t   compressionR  RT  R  (    (    s   /usr/lib/python2.7/tarfile.pyR|   
  s    	c         C   s   t  d   |  j    S(   Nc         S   s   |  j  S(   N(   R{   (   R  (    (    s   /usr/lib/python2.7/tarfile.pyt   <lambda>
  R0   (   t   mapt   infolist(   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   namelist
  s    c         C   s   t  d   |  j j    S(   Nc         S   s   |  j  t k S(   N(   R   R5  (   R  (    (    s   /usr/lib/python2.7/tarfile.pyR   
  R0   (   R  R   Ry  (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR   
  s    	c         C   s   |  j  j   d  S(   N(   R   R  (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   printdir"
  s    c         C   s   d  S(   N(    (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyt   testzip$
  s    c         C   s   |  j  j |  S(   N(   R   Rv  (   Rz   R{   (    (    s   /usr/lib/python2.7/tarfile.pyt   getinfo&
  s    c         C   s"   |  j  j |  j  j |   j   S(   N(   R   R  Rv  RO   (   Rz   R{   (    (    s   /usr/lib/python2.7/tarfile.pyRO   (
  s    c         C   s   |  j  j | |  d  S(   N(   R   R  (   Rz   R  R  t   compress_type(    (    s   /usr/lib/python2.7/tarfile.pyRQ   *
  s    c         C   s   y d d l  m } Wn! t k
 r7 d d l m } n Xd d  l } t | j  } t |  | _ | j | j	  | _
 |  j j | | |   d  S(   Ni(   t   StringIO(   t	   cStringIOR  R   t   calendarR   R  R   R   t   timegmR  R   R   R  (   Rz   t   zinfot   bytesR  R  t   tinfo(    (    s   /usr/lib/python2.7/tarfile.pyt   writestr,
  s    c         C   s   |  j  j   d  S(   N(   R   R}   (   Rz   (    (    s   /usr/lib/python2.7/tarfile.pyR}   6
  s    N(   Re   Rf   Rg   R  R|   R  R   R  R  R  RO   RK   RQ   R  R}   (    (    (    s   /usr/lib/python2.7/tarfile.pyR  	
  s   							
c         C   s7   y t  |   } | j   t SWn t k
 r2 t SXd S(   sf   Return True if name points to a tar archive that we
       are able to handle, else return False.
    N(   R    R}   R   R   R   (   R{   R\   (    (    s   /usr/lib/python2.7/tarfile.pyR   =
  s    
(x   Rg   t   __version__t   versiont
   __author__t   __date__t	   __cvsid__t   __credits__t   __builtin__R    RN  R  Rs   RL   R  R  R   R2   R   R*  R  R  R  R   RK   t   __all__R   R   Rs  R   R   R   R   R  R   R  R9  R7  R;  R=  R   R?  t   CONTTYPER   R   R  R  R  R  R   R1   R   RD  R  R5  R  R2  R   R&   R3  t   S_IFLNKt   S_IFREGR  t   S_IFDIRR  t   S_IFIFOt   TSUIDt   TSGIDt   TSVTXt   TUREADt   TUWRITEt   TUEXECt   TGREADt   TGWRITEt   TGEXECt   TOREADt   TOWRITEt   TOEXECt   getfilesystemencodingRE  t   getdefaultencodingR!   R$   R.   R7   RA   RJ   RM   R^   Rd   t	   ExceptionR   Rh   Ri   Rj   Rk   Rl   Rm   Rn   Ro   R)   Rp   Rq   R~   t   objectR   R   R   R   R   R   R  R  R   R$  R  R#  R  R  R  R   (    (    (    s   /usr/lib/python2.7/tarfile.pyt   <module>   s.  
					
															AR  7   '	4	