
 Hc           @   sv  d  d k  Z  d  d k Z d  d k Z d  d k Z d  d k Z d  d k Td  d k Z d  d k Z d  d k Z d e	 f d     YZ
 d e
 f d     YZ d e	 f d     YZ d	 e f d
     YZ d e	 f d     YZ d e f d     YZ d d d     YZ e d j od d  d k Z e i   e   Z e i e  Z e i e  Z e i e  e   Z e i e  n d S(   iN(   t   *t
   OpProgressc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   s    Abstract class to implement reporting on cache opening
        Subclass this class to implement simple Operation progress reporting
    c         C   s   d  S(   N(    (   t   self(    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   __init__%   s    c         C   s   d  S(   N(    (   R   t   percent(    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   update'   s    c         C   s   d  S(   N(    (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   done)   s    (   t   __name__t
   __module__t   __doc__R   R   R   (    (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR   !   s   		t   OpTextProgressc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   s0    A simple text based cache open reporting class c         C   s   t  i |   d  S(   N(   R   R   (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR   .   s    c         C   s.   t  i i d |  i | f  t  i i   d  S(   Ns   %s: %.2i  (   t   syst   stdoutt   writet   subOpt   flush(   R   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR   0   s    c         C   s   t  i i d |  i  d  S(   Ns
   %s: Done
(   R   R   R   t   op(   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR   3   s    (   R   R   R	   R   R   R   (    (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR
   ,   s   		t   FetchProgressc           B   s   e  Z d  Z d Z d Z d Z d Z d Z h  d e <d e <d e <d	 e <d
 e <Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z RS(   sm    Report the download/fetching progress
        Subclass this class to implement fetch progress reporting
    i    i   i   i   i   t   Donet   Queuedt   Failedt   Hitt   Ignoredc         C   s   d |  _  d |  _ d  S(   Ng        (   t   etaR   (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR   I   s    		c         C   s   d  S(   N(    (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   startN   s    c         C   s   d  S(   N(    (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   stopQ   s    c         C   s   d  S(   N(    (   R   t   urit   descrt
   shortDescrt   status(    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   updateStatusT   s    c         C   sc   |  i  |  i d t |  i |  i  |  _ |  i d j o$ |  i |  i  t |  i  |  _ n t S(   sv    called periodically (to update the gui), importend to
            return True to continue or False to cancel
        g      Y@i    (	   t   currentBytest   currentItemst   floatt
   totalBytest
   totalItemsR   t
   currentCPSR   t   True(   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   pulseW   s    +$c         C   s   d  S(   N(    (   R   t   mediumt   drive(    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   mediaChange_   s    (   R   R   R	   t   dlDonet   dlQueuedt   dlFailedt   dlHitt	   dlIgnoredt   dlStatusStrR   R   R   R   R&   R)   (    (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR   8   s"   								t   TextFetchProgressc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   s3    Ready to use progress object for terminal windows c         C   s   h  |  _  d  S(   N(   t   items(   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR   d   s    c         C   s;   | |  i  j o d |  i | | f GHn | |  i | <d  S(   Ns   %s %s(   R+   R/   R1   (   R   R   R   R   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR   f   s    c         C   s   t  i |   |  i d j o> d |  i t i t |  i   t i t |  i   f } n d |  i } d | Gt	 i
 i   t S(   Ni    s   [%2.f%%] %sB/s %ss   %2.f%% [Working]s   %s(   R   R&   R$   R   t   apt_pkgt	   SizeToStrt   intt	   TimeToStrR   R   R   R   R%   (   R   t   s(    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR&   j   s    	 c         C   s	   d GHd  S(   Ns   Done downloading            (    (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR   u   s    c         C   sL   t  } d | | f GHt i i   } | d j p | d j o
 t } n | S(   s    react to media change events sb   Media change: please insert the disc labeled                '%s' in the drive '%s' and press entert   ct   C(   R%   R   t   stdint   readlinet   false(   R   R'   R(   t   resR6   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR)   w   s    
(   R   R   R	   R   R   R&   R   R)   (    (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR0   b   s   				t   DumbInstallProgressc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   se    Report the install progress
        Subclass this class to implement install progress reporting
    c         C   s   d  S(   N(    (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR      s    c         C   s   d  S(   N(    (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   startUpdate   s    c         C   s
   | i    S(   N(   t	   DoInstall(   R   t   pm(    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   run   s    c         C   s   d  S(   N(    (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   finishUpdate   s    c         C   s   d  S(   N(    (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   updateInterface   s    (   R   R   R	   R   R>   RA   RB   RC   (    (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR=      s   				t   InstallProgressc           B   sV   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(	   s    A InstallProgress that is pretty useful.
        It supports the attributes 'percent' 'status' and callbacks
        for the dpkg errors and conffiles and status changes 
     c         C   s   t  i |   d |  _ t i   \ } } | |  _ t i | d  |  _ t i |  i i	   t i
 t i  d |  _ d |  _ d |  _ d  S(   Ng?t   rt    g        (   R=   R   t   selectTimeoutt   ost   pipet   writefdt   fdopent   statusfdt   fcntlt   filenot   F_SETFLt
   O_NONBLOCKt   readR   R   (   R   RQ   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR      s    		"		c         C   s   d S(   s4    called when a error is detected during the install N(    (   R   t   pkgt   errormsg(    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   error   s    c         C   s   d S(   s7    called when a conffile question from dpkg is detected N(    (   R   t   currentt   new(    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   conffile   s    c         C   s   d S(   s     called when the status changed N(    (   R   RR   R   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   statusChange   s    c   
   
   C   s  |  i  d  j oyC x< |  i i d  p( |  i t i |  i  i   d  7_ q WWn> t j
 o2 \ } } | t j o t t	 j o	 | GHq n X|  i i d  oR|  i } y% t
 i | d d  \ } } } } Wn" t j
 o } d |  _ d  Sn X| d j o |  i | |  n | d j oI t i d  i |  }	 |	 o& |  i |	 i d  |	 i d	   qn| | d
 j on t |  |  i j p | |  i j o# |  i | t |  | i    n t |  |  _ t
 i |  |  _ n d |  _ qn d  S(   Ns   
i   t   :i   RF   t   pmerrort
   pmconffiles   \s*'(.*)'\s*'(.*)'.*i   t   pmstatus(   RL   t   NoneRQ   t   endswithRH   RN   t   OSErrort   EAGAINt   errnort   EWOULDBLOCKt   stringt   splitt
   ValueErrorRT   t   ret   compilet   matchRW   t   groupR!   R   R   RX   t   strip(
   R   t   errnot   errstrR6   R   RR   R   t
   status_strt   eRh   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyRC      s8     -	%		*#c         C   s
   t  i   S(   N(   RH   t   fork(   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyRo      s    c         C   sx   xh t  o` t i |  i g g  g  |  i  |  i   t i |  i t i  \ } } | |  i j o Pq q Wt i	 |  S(   N(
   R%   t   selectRL   RG   RC   RH   t   waitpidt	   child_pidt   WNOHANGt   WEXITSTATUS(   R   t   pidR<   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt	   waitChild   s     

c         C   sU   |  i    } | d j o# | i |  i  } t i |  n | |  _ |  i   } | S(   Ni    (   Ro   R?   RJ   RH   t   _exitRr   Rv   (   R   R@   Ru   R<   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyRA      s    	(   R   R   R	   R   RT   RW   RX   RC   Ro   Rv   RA   (    (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyRD      s   	
				"		t   CdromProgressc           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   si    Report the cdrom add progress
        Subclass this class to implement cdrom add progress reporting
    c         C   s   d  S(   N(    (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR      s    c         C   s   d S(   s;    update is called regularly so that the gui can be redrawn N(    (   R   t   textt   step(    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyR      s    c         C   s   d  S(   N(    (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   askCdromName   s    c         C   s   d  S(   N(    (   R   (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyt   changeCdrom   s    (   R   R   R	   R   R   R{   R|   (    (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pyRx      s
   			t   __main__(    (   R   RH   Rf   RM   Rc   Rk   Rp   R2   t   aptt   objectR   R
   R   R0   R=   RD   Rx   R   t   initt   progresst   GetCachet   cachet   GetDepCachet   depcachet   Initt	   fprogresst   Update(    (    (    s0   /usr/lib/python2.5/site-packages/apt/progress.pys   <module>   s0   
*N
		