???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................ó
¿œ^c           @   s¨   d  Z  d d l Z d d l m Z d d l Z d d l Z d d l Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z e d k r¤ e ƒ  n  d S(   sQ   Compare local and remote dictionaries and transfer differing files -- like rdist.iÿÿÿÿN(   t   reprc          C   s-  t  j ƒ  }  t d |  ƒ } | r> t  j | ƒ t  j ƒ  }  n  t d d ƒ } d } d } d } d GHt d | ƒ } | rƒ | } n  | | f } t j ƒ  } t j ƒ  } t j | | ƒ }	 t	 | |	 | ƒ |	 j
 ƒ  | j
 ƒ  t j ƒ  }
 |
 | } t | d	 ƒ \ } } | Gd
 Gt | ƒ Gd GHt d ƒ d  S(   Ns   chdir [%s] t   hosts   voorn.cwi.nli  i   t    s  Mode should be a string of characters, indicating what to do with differences.
r - read different files to local file system
w - write different files to remote file system
c - create new files, either remote or local
d - delete disappearing files, either remote or local
s
   mode [%s] i<   s   minutes andt   secondss   [Return to exit] (   t   ost   getcwdt	   raw_inputt   chdirt   askt   timet   FSProxyt   FSProxyLocalt   FSProxyClientt   comparet   _closet   divmodt   round(   t   pwdt   sR   t   portt   verboset   modet   addresst   t1t   localt   remotet   t2t   dtt   minst   secs(    (    s*   /usr/lib64/python2.7/Demo/pdist/cmptree.pyt   main	   s2     	


c         C   s    t  d |  | f ƒ } | p | S(   Ns   %s [%s] (   R   (   t   promptt   defaultR   (    (    s*   /usr/lib64/python2.7/Demo/pdist/cmptree.pyR   )   s    c         C   s3   t  d |  t | ƒ f ƒ } | r/ t j | ƒ S| S(   Ns   %s [%s] (   R   t   strt   stringt   atoi(   R   R    R   (    (    s*   /usr/lib64/python2.7/Demo/pdist/cmptree.pyt   askint-   s     c         C   sÜ  Hd Gt  t j ƒ  ƒ GH| j d ƒ } | j d ƒ } | j ƒ  d GHi  } x$ |  j ƒ  D] \ } } | | | <qV Wd GH| j | ƒ } d Gt | ƒ GHi  }	 x| D]\ } }
 |
 |	 | <| j | ƒ st  | ƒ Gd GHd | k r¬d	 | k r¬t	 |  | | ƒ q¬q  | | } | |
 k r  t  | ƒ G| j
 | ƒ } |  j
 | ƒ } | | k rrd
 Gd | k r¨t	 |  | | ƒ q¨n6 | | k r¤d Gd | k r¨t |  | | ƒ q¨n d GHq  q  Wx‘ | j ƒ  D]ƒ } |	 j ƒ  s½t  | ƒ Gd Gt ƒ  d | k rd	 | k rt |  | | ƒ n- d | k r<d | k r<t j | ƒ d GHn  Hq½q½Wd GH| j | ƒ } g  } xÚ | D]Ò } |  j | ƒ r™d Gt  | ƒ GH| j | ƒ qed Gt  | ƒ Gd GHd | k red	 | k red t  | ƒ } d | k réd } n t | d ƒ } | d  d k r7|  j | ƒ d t  | ƒ GH| j | ƒ q7qeqeW|  j ƒ  } x0 | D]( } | | k rNd Gt  | ƒ Gd GHqNqNWx[ | D]S } d Gt  | ƒ GH|  j | ƒ | j | ƒ t |  | | ƒ | j ƒ  |  j ƒ  qWd  S(   Ns   PWD =t   sumlistt   listsubdirss   calculating local sums ...s   getting remote sums ...t   gots   only remotet   rt   cs   remote newers   local newert   ws    same mtime but different sum?!?!s   only locallyt   ds   removed.s   gettin subdirs ...s   Common subdirectorys   Remote subdirectorys   not found locallys"   Create local subdirectory %s? [y] t   yi   t   Ys   Subdirectory %s mades   Local subdirectorys   not found remotelys   Entering subdirectory(   R,   R-   (   R    R   R   t   _sendt   _flushR%   t   _recvt   lent   has_keyt   recvfilet   mtimet   sendfilet   keyst   flt   unlinkt   isdirt   appendR   t   mkdirR&   t   cdR   t   back(   R   R   R   t   sums_idt
   subdirs_idt   lsumdictt   namet   infot   sumst   rsumdictt   rsumt   lsumt   rmtimet   lmtimet   subdirst   commont   prt   okt   lsubdirs(    (    s*   /usr/lib64/python2.7/Demo/pdist/cmptree.pyR   2   s”    



	
c         C   sÜ   y | j  | ƒ Wn& t t j f k
 r9 } d G| GHd  SXd Gt ƒ  t | ƒ j ƒ  } t j ƒ  } | j d | | ƒ | j	 ƒ  t j ƒ  } | | } t
 | ƒ Gd Gt | ƒ Gd G| r× d Gt t
 | ƒ | ƒ Gd Gn  Hd  S(   Ns   cannot create:s   sending ...t   writes   bytes inR   s   i.e.s	   bytes/sec(   t   createt   IOErrorR   t   errorR7   t   opent   readR	   t   _send_noreplyR/   R1   R   (   R   R   RA   t   msgt   dataR   R   R   (    (    s*   /usr/lib64/python2.7/Demo/pdist/cmptree.pyR5   ‚   s"    	

c         C   sP   d } z  t  |  | | ƒ } d } | SWd  | sK d | f GH|  j | ƒ n  Xd  S(   Ni    i   s#   *** recvfile of %r failed, deleting(   t   recvfile_realt   delete(   R   R   RA   RL   t   rv(    (    s*   /usr/lib64/python2.7/Demo/pdist/cmptree.pyR3   ›   s    c         C   sc  y |  j  | ƒ Wn& t t j f k
 r9 } d G| GHd  SXd Gt ƒ  t | d ƒ } t j ƒ  } d } d } | j d | | | ƒ } | j ƒ  xe | | }	 | j d | |	 | ƒ }
 | j	 | ƒ } |
 } | sÒ Pn  | j
 | ƒ | j | ƒ |	 } q‘ W| j ƒ  } t j ƒ  } | j ƒ  | | } | Gd Gt | ƒ Gd	 G| rQd
 G| | Gd Gn  H| j	 | ƒ d  S(   Ns   cannot create:s   receiving ...R*   i   i   i    RS   s   bytes inR   s   i.e.s	   bytes/seci   (   RO   RP   R   RQ   R7   RR   R	   R.   R/   R0   t   seekRN   t   tellt   closeR   (   R   R   RA   RU   t   fR   t   lengtht   offsett   idt	   newoffsett   newidRV   t   sizeR   R   (    (    s*   /usr/lib64/python2.7/Demo/pdist/cmptree.pyRW   ¦   s@    	

 


c           C   s   t  j j ƒ  d  S(   N(   t   syst   stdoutt   flush(    (    (    s*   /usr/lib64/python2.7/Demo/pdist/cmptree.pyR7   Ì   s    t   __main__(   t   __doc__Rd   R    R
   R	   R   R   R   R$   R   R5   R3   RW   R7   t   __name__(    (    (    s*   /usr/lib64/python2.7/Demo/pdist/cmptree.pyt   <module>   s   	 			P			&	