-ν
ηΆ<c       sΊ   d  Z  d k Z d k Z d k Z d d d g Z h  Z d d Z d d d	  Z d
   Z d   Z	 d f  d     YZ
 d d d  Z d   Z d   Z d   Z e d j o e   n d S(   s―   Utilities for comparing files and directories.

Classes:
    dircmp

Functions:
    cmp(f1, f2, shallow=1, use_statcache=0) -> int
    cmpfiles(a, b, common) -> ([], [], [])

Ns   cmps   dircmps   cmpfilesi   i   i   i    c 	   s  | o t i } n
 t i } t | |    } t | |   } | d t i
 j p | d t i
 j o d Sn | o
 | | j o d Sn | d | d j o d Sn t i |  | f  } | o | | f | d  j o | d Sn t |  |  } | | | f t |  | f <| Sd S(   s  Compare two files.

    Arguments:

    f1 -- First file name

    f2 -- Second file name

    shallow -- Just check stat signature (do not read the files).
               defaults to 1.

    use_statcache -- Do not stat() each file directly: go through
                     the statcache module for more efficiency.

    Return value:

    integer -- 1 if the files are the same, 0 otherwise.

    This function uses a cache for past comparisons and the results,
    with a cache invalidation mechanism relying on stale signatures.
    Of course, if 'use_statcache' is true, this mechanism is defeated,
    and the cache will never grow stale.

    i    i   i   N(   s   use_statcaches	   statcaches   stats   stat_functions   oss   _sigs   f1s   s1s   f2s   s2s   S_IFREGs   shallows   _caches   gets   results   _do_cmps   outcome(	   s   f1s   f2s   shallows   use_statcaches   s2s   s1s   stat_functions   results   outcome(    (    s   /usr/lib/python2.2/filecmp.pys   cmp s$     	(c    s/   t  i |  t  i  |  t  i |  t  i f Sd  S(   N(   s   stats   S_IFMTs   sts   ST_MODEs   ST_SIZEs   ST_MTIME(   s   st(    (    s   /usr/lib/python2.2/filecmp.pys   _sigB s    c    sz   t  } t |  d  } t | d  } xO d oG | i |  } | i |  } | | j o d Sn | o d Sn q' Wd  S(   Ns   rbi   i    (
   s   BUFSIZEs   bufsizes   opens   f1s   fp1s   f2s   fp2s   reads   b1s   b2(   s   f1s   f2s   fp1s   b1s   b2s   fp2s   bufsize(    (    s   /usr/lib/python2.2/filecmp.pys   _do_cmpG s     c      sΉ   t  Z d  Z e e d  Z d   Z d f Z d d d f Z d d d	 f Z d
 d d f Z	 d d f Z
 d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sQ  A class that manages the comparison of 2 directories.

    dircmp(a,b,ignore=None,hide=None)
      A and B are directories.
      IGNORE is a list of names to ignore,
        defaults to ['RCS', 'CVS', 'tags'].
      HIDE is a list of names to hide,
        defaults to [os.curdir, os.pardir].

    High level usage:
      x = dircmp(dir1, dir2)
      x.report() -> prints a report on the differences between dir1 and dir2
       or
      x.report_partial_closure() -> prints report on differences between dir1
            and dir2, and reports on common immediate subdirectories.
      x.report_full_closure() -> like report_partial_closure,
            but fully recursive.

    Attributes:
     left_list, right_list: The files in dir1 and dir2,
        filtered by hide and ignore.
     common: a list of names in both dir1 and dir2.
     left_only, right_only: names only in dir1, dir2.
     common_dirs: subdirectories in both dir1 and dir2.
     common_files: files in both dir1 and dir2.
     common_funny: names in both dir1 and dir2 where the type differs between
        dir1 and dir2, or the name is not stat-able.
     same_files: list of identical files.
     diff_files: list of filenames which differ.
     funny_files: list of files which could not be compared.
     subdirs: a dictionary of dircmp objects, keyed by names in common_dirs.
     c    sq   | |  _ | |  _ | t j o t i t i	 g |  _ n
 | |  _ | t j o d d d g |  _
 n
 | |  _
 d  S(   Ns   RCSs   CVSs   tags(   s   as   selfs   lefts   bs   rights   hides   Nones   oss   curdirs   pardirs   ignore(   s   selfs   as   bs   ignores   hide(    (    s   /usr/lib/python2.2/filecmp.pys   __init__w s    			c    sn   t  t i |  i  |  i |  i  |  _ t  t i |  i  |  i |  i  |  _	 |  i i
   |  i	 i
   d  S(   N(   s   _filters   oss   listdirs   selfs   lefts   hides   ignores	   left_lists   rights
   right_lists   sort(   s   self(    (    s   /usr/lib/python2.2/filecmp.pys   phase0 s    s   subdirss
   same_filess
   diff_filess   funny_filess   common_dirss   common_filess   common_funnys   commons	   left_onlys
   right_onlys	   left_lists
   right_listc    s°   | |  i j o |  i   n | |  i j o |  i   nd | |  i j o |  i   nF | |  i j o |  i	   n( | |  i
 j o |  i   n
 t |  t |  |  Sd  S(   N(   s   attrs   selfs   _dircmp__p4_attrss   phase4s   _dircmp__p3_attrss   phase3s   _dircmp__p2_attrss   phase2s   _dircmp__p1_attrss   phase1s   _dircmp__p0_attrss   phase0s   AttributeErrors   getattr(   s   selfs   attr(    (    s   /usr/lib/python2.2/filecmp.pys   __getattr__ s    	c    sΫ   g  g  f \ } } h  } h  } x |  i D] } d | | <q( Wx? |  i D]4 } | i	 | d  o d | | <n | i
 |  qF Wx5 |  i D]* } | i	 | d  o n | i
 |  q W| i   |  _ | |  _ | |  _ d  S(   Ni   i    (   s   a_onlys   b_onlys   commons   bs   selfs
   right_lists   fnms	   left_lists   xs   gets   appends   keyss	   left_onlys
   right_only(   s   selfs   b_onlys   bs   commons   xs   a_onlys   fnm(    (    s   /usr/lib/python2.2/filecmp.pys   phase1  s&    
 
 
 	c 
   s  g  |  _ g  |  _ g  |  _ xo|  i D]d} t i i |  i	 |  } t i i |  i |  } d } y t i |  } Wn t i j
 o }	 d } n Xy t i |  } Wn t i j
 o }	 d } n X| o© t i | t i  } t i | t i  } | | j o |  i i |  nY t i |  o |  i i |  n5 t i |  o |  i i |  n |  i i |  n |  i i |  q% Wd  S(   Ni   i    (   s   selfs   common_dirss   common_filess   common_funnys   commons   xs   oss   paths   joins   lefts   a_paths   rights   b_paths   oks	   statcaches   stats   a_stats   errors   whys   b_stats   S_IFMTs   ST_MODEs   a_types   b_types   appends   S_ISDIRs   S_ISREG(
   s   selfs   b_paths   oks   b_types   b_stats   a_types   a_stats   a_paths   xs   why(    (    s   /usr/lib/python2.2/filecmp.pys   phase2΄ s6    			
 c    s7   t  |  i |  i |  i  } | \ |  _ |  _ |  _ d  S(   N(	   s   cmpfiless   selfs   lefts   rights   common_filess   xxs
   same_filess
   diff_filess   funny_files(   s   selfs   xx(    (    s   /usr/lib/python2.2/filecmp.pys   phase3Χ s    c    ss   h  |  _ xc |  i D]X } t i i |  i |  } t i i |  i	 |  } t | | |  i |  i  |  i | <q Wd  S(   N(   s   selfs   subdirss   common_dirss   xs   oss   paths   joins   lefts   a_xs   rights   b_xs   dircmps   ignores   hide(   s   selfs   b_xs   xs   a_x(    (    s   /usr/lib/python2.2/filecmp.pys   phase4Ϋ s    	
 c    s9   |  i   x( |  i i   D] } |  i | i   q Wd  S(   N(   s   selfs   phase4s   subdirss   keyss   xs   phase4_closure(   s   selfs   x(    (    s   /usr/lib/python2.2/filecmp.pys   phase4_closureε s    
 c    s>  d G|  i G|  i GH|  i o( |  i i   d G|  i Gd G|  i GHn |  i o( |  i i   d G|  i Gd G|  i GHn |  i o |  i i   d G|  i GHn |  i o |  i i   d G|  i GHn |  i o |  i i   d G|  i GHn |  i	 o |  i	 i   d G|  i	 GHn |  i
 o |  i
 i   d G|  i
 GHn d  S(	   Ns   diffs   Only ins   :s   Identical files :s   Differing files :s   Trouble with common files :s   Common subdirectories :s   Common funny cases :(   s   selfs   lefts   rights	   left_onlys   sorts
   right_onlys
   same_filess
   diff_filess   funny_filess   common_dirss   common_funny(   s   self(    (    s   /usr/lib/python2.2/filecmp.pys   reportκ s,    






c    s:   |  i   x) |  i i   D] } H|  i | i   q Wd  S(   N(   s   selfs   reports   subdirss   keyss   x(   s   selfs   x(    (    s   /usr/lib/python2.2/filecmp.pys   report_partial_closures
    
 c    s:   |  i   x) |  i i   D] } H|  i | i   q Wd  S(   N(   s   selfs   reports   subdirss   keyss   xs   report_full_closure(   s   selfs   x(    (    s   /usr/lib/python2.2/filecmp.pys   report_full_closure	s
    
 (   s   __name__s
   __module__s   __doc__s   Nones   __init__s   phase0s   _dircmp__p4_attrss   _dircmp__p3_attrss   _dircmp__p2_attrss   _dircmp__p1_attrss   _dircmp__p0_attrss   __getattr__s   phase1s   phase2s   phase3s   phase4s   phase4_closures   reports   report_partial_closures   report_full_closure(    (    (    s   /usr/lib/python2.2/filecmp.pys   dircmpU s"     					#		
			c 	   sr   g  g  g  f } xX | D]P } t i i |  |  } t i i | |  } | t
 | | | |  i |  q W| Sd S(   s₯  Compare common files in two directories.

    a, b -- directory names
    common -- list of file names found in both directories
    shallow -- if true, do comparison based solely on stat() information
    use_statcache -- if true, use statcache.stat() instead of os.stat()

    Returns a tuple of three lists:
      files that compare equal
      files that are different
      filenames that aren't regular files.

    N(   s   ress   commons   xs   oss   paths   joins   as   axs   bs   bxs   _cmps   shallows   use_statcaches   append(	   s   as   bs   commons   shallows   use_statcaches   ress   xs   axs   bx(    (    s   /usr/lib/python2.2/filecmp.pys   cmpfiless      $c    s?   y t  t |  | | |   SWn t i j
 o d Sn Xd  S(   Ni   (   s   abss   cmps   as   bs   shs   sts   oss   error(   s   as   bs   shs   st(    (    s   /usr/lib/python2.2/filecmp.pys   _cmp,s    c    s=   g  } x, |  D]$ } | | j o | i |  n q W| Sd  S(   N(   s   results   lists   items   skips   append(   s   lists   skips   results   item(    (    s   /usr/lib/python2.2/filecmp.pys   _filter5s      c     s   d  k  }  d  k } | i |  i d d  \ } } t |  d j o | i d  n t | d | d  } d d f | j o | i	   n | i
   d  S(   Ni   s   ri   s   need exactly two argsi    s   -rs    (   s   syss   getopts   argvs   optionss   argss   lens   errors   dircmps   dds   report_full_closures   report(   s   syss   getopts   dds   argss   options(    (    s   /usr/lib/python2.2/filecmp.pys   demo>s    		s   __main__(   s   __doc__s   oss   stats	   statcaches   __all__s   _caches   BUFSIZEs   cmps   _sigs   _do_cmps   dircmps   cmpfiless   _cmps   _filters   demos   __name__(   s   demos   stats   dircmps   __all__s	   statcaches   _sigs   _cmps   _filters   _caches   cmpfiless   BUFSIZEs   oss   _do_cmps   cmp(    (    s   /usr/lib/python2.2/filecmp.pys   ?
 s    			
-		»					