ó
fÛMc           @   s.  d  Z  d d l Z d d l Z d d l Z d d l m Z m Z d d l Z d d l m	 Z	 m
 Z
 g  Z d e	 j f d „  ƒ  YZ d e e
 j f d „  ƒ  YZ d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e	 j f d „  ƒ  YZ d e e	 j f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   s«   Deprecated progress reporting classes.

This module provides classes for compatibility with python-apt 0.7. They are
completely deprecated and should not be used anymore.
iÿÿÿÿN(   t   AttributeDeprecatedByt   function_deprecated_by(   t   baset   textt
   OpProgressc           B   s/   e  Z d  Z d „  Z e d ƒ Z e d ƒ Z RS(   s7   Abstract class to implement reporting on cache opening.c         C   s*   t  j j |  ƒ t j d t d d ƒd  S(   Ns&   apt.progress.OpProgress is deprecated.t
   stackleveli   (   R   R   t   __init__t   warningst   warnt   DeprecationWarning(   t   self(    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR   +   s    	t   subopt   op(   t   __name__t
   __module__t   __doc__R   R    t   subOpt   Op(    (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR   (   s   	t   OpTextProgressc           B   s   e  Z d  Z d „  Z RS(   s/   A simple text based cache open reporting class.c         C   s*   t  j j |  ƒ t j d t d d ƒd  S(   Ns*   apt.progress.OpTextProgress is deprecated.R   i   (   R   R   R   R   R   R	   (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR   7   s    	(   R   R   R   R   (    (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR   4   s   t   FetchProgressc           B   sš   e  Z d  Z e d ƒ \ Z Z Z Z Z i d e 6d e 6d e 6d e 6d e 6Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z RS(   s&   Report the download/fetching progress.i   t   Donet   Queuedt   Failedt   Hitt   Ignoredc         C   sY   d |  _  d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ t j d t	 d d ƒd  S(   Ng        i    s)   apt.progress.FetchProgress is deprecated.R   i   (
   t   etat   percentt   currentBytest   currentItemst
   totalBytest
   totalItemst
   currentCPSR   R   R	   (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR   E   s    								c         C   s   d S(   s    Called when the fetching starts.N(    (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   startQ   s    c         C   s   d S(   s(   Called when all files have been fetched.N(    (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   stopT   s    c         C   s   d S(   sw   Called when the status of an item changes.

        This happens eg. when the downloads fails or is completed.
        N(    (   R
   t   urit   descrt   short_descrt   status(    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   updateStatusW   s    c         C   s   d S(   sÅ   Called when the status of an item changes.

        This happens eg. when the downloads fails or is completed. This
        version include information on current filesize and partial size
        N(    (   R
   R"   R#   R$   R%   t	   file_sizet   partial_size(    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   update_status_full]   s    c         C   sa   |  j  |  j d t |  j |  j ƒ |  _ |  j d k r] |  j |  j  t |  j ƒ |  _ n  t S(   so   Called periodically to update the user interface.

        Return True to continue or False to cancel.
        g      Y@i    (	   R   R   t   floatR   R   R   R   R   t   True(   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   pulsee   s    c         C   sa   |  j  |  j d t |  j |  j ƒ |  _ |  j d k r] |  j |  j  t |  j ƒ |  _ n  t S(   s´   Called periodically to update the user interface.
        This function includes details about the items being fetched
        Return True to continue or False to cancel.

        g      Y@i    (	   R   R   R*   R   R   R   R   R   R+   (   R
   t   items(    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   pulse_itemsq   s    c         C   s   d S(   s   react to media change events.N(    (   R
   t   mediumt   drive(    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   mediaChange~   s    (   R   R   R   t   ranget   dlDonet   dlQueuedt   dlFailedt   dlHitt	   dlIgnoredt   dlStatusStrR   R    R!   R&   R)   R,   R.   R1   (    (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR   =   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   t  j |  ƒ i  |  _ d  S(   N(   R   R   R-   (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR   …   s    c         C   s9   | |  j  k r( d |  j | | f GHn  | |  j | <d S(   sw   Called when the status of an item changes.

        This happens eg. when the downloads fails or is completed.
        s   %s %sN(   R4   R8   R-   (   R
   R"   R#   R$   R%   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR&   ‰   s    c         C   sy   t  j |  ƒ |  j d k rS d |  j t j |  j ƒ t j t |  j ƒ ƒ f } n d |  j } d | Gt	 j
 j ƒ  t S(   so   Called periodically to update the user interface.

        Return True to continue or False to cancel.
        i    s   [%2.f%%] %sB/s %ss   %2.f%% [Working]s   %s(   R   R,   R   R   t   apt_pkgt   size_to_strt   time_to_strt   longR   t   syst   stdoutt   flushR+   (   R
   t   s(    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR,   ’   s    	c         C   s	   d GHd S(   s(   Called when all files have been fetched.s   Done downloading            N(    (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR!   £   s    c         C   s   d | | f GHt  ƒ  d k S(   s   react to media change events.sS   Media change: please insert the disc labeled '%s' in the drive '%s' and press entert   ct   C(   RB   RC   (   t	   raw_input(   R
   R/   R0   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR1   §   s    (   R   R   R   R   R&   R,   R!   R1   (    (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR9   ‚   s   					t   CdromProgressc           B   s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   s   Report the cdrom add progress.c         C   s   t  j d t d d ƒd  S(   Ns)   apt.progress.CdromProgress is deprecated.R   i   (   R   R   R	   (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR   ²   s    	c         C   s   d S(   s   Ask for a cdrom nameN(    (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   askCdromName¶   s    c         C   s   d S(   s   Change cdromN(    (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   changeCdrom¹   s    c         C   s   d S(   s   Update.N(    (   R
   R   t   current(    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   update¼   s    (   R   R   R   R   RF   RG   RI   (    (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyRE   ¯   s
   			t   DumbInstallProgressc           B   sM   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   s   Report the install progress.c         C   s*   t  j j |  ƒ t j d t d d ƒd  S(   Ns-   apt.progress.*InstallProgress are deprecated.R   i   (   R   t   InstallProgressR   R   R   R	   (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR   Ã   s    	c         C   s„   t  |  d ƒ r: t  |  d ƒ r: t j |  j d ƒ |  _ n  t  |  d ƒ rt t  |  d ƒ rt t j |  j d ƒ |  _ n  t j j	 |  ƒ S(   Nt   writefdt   write_streamt   wt   statusfdt   status_streamt   r(
   t   hasattrt   ost   fdopenRL   RM   RO   RP   R   RK   t   update_interface(   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   updateInterfaceÈ   s
    c         C   s
   |  j  ƒ  S(   N(   RV   (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyRU   Ò   s    c         C   s   t  j j |  ƒ S(   N(   R   RK   t   start_update(   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   startUpdateÕ   s    c         C   s
   |  j  ƒ  S(   N(   RX   (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyRW   Ø   s    c         C   s   t  j j |  ƒ S(   N(   R   RK   t   finish_update(   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   finishUpdateÛ   s    c         C   s
   |  j  ƒ  S(   N(   RZ   (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyRY   Þ   s    (
   R   R   R   R   RV   RU   RX   RW   RZ   RY   (    (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyRJ   À   s   		
				RK   c           B   s>   e  Z d  Z e d ƒ Z d „  Z d „  Z d „  Z d „  Z RS(   s©   An InstallProgress that is pretty useful.

    It supports the attributes 'percent' 'status' and callbacks for the dpkg
    errors and conffiles and status changes.
    t   select_timeoutc         C   s   t  j j |  | | | ƒ S(   N(   R   RK   t   status_change(   R
   t   pkgR   R%   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   statusChangeë   s    c         C   s   |  j  | | | ƒ S(   N(   R^   (   R
   R]   R   R%   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR\   î   s    c         C   s   t  j j |  ƒ S(   N(   R   RK   t
   wait_child(   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt	   waitChildñ   s    c         C   s
   |  j  ƒ  S(   N(   R`   (   R
   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyR_   ô   s    (	   R   R   R   R    t   selectTimeoutR^   R\   R`   R_   (    (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyRK   â   s   			t   DpkgInstallProgressc           B   s#   e  Z d  Z d Z d Z d „  Z RS(   s9   Progress handler for a local Debian package installation.t    c         C   s>   | |  _  t j j | ƒ j d ƒ d |  _ t j j |  | ƒ S(   s*   Start installing the given Debian package.t   _i    (	   t   debfileRS   t   patht   basenamet   splitt   debnameR   RK   t   run(   R
   Re   (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyRj   þ   s    	"(   R   R   R   Re   Ri   Rj   (    (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyRb   ø   s   (   R   RS   R>   R:   t   apt.deprecationR    R   R   t   apt.progressR   R   t   __all__R   R   t   objectR   R9   RE   RK   RJ   Rb   (    (    (    s4   /usr/lib/python2.7/dist-packages/apt/progress/old.pyt   <module>   s   	E-"