
5Z6Nc           @   s]  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l m Z d  d l m Z d  d l m	 Z	 m
 Z
 m Z d  d l 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 e f d     YZ d e f d     YZ d   Z d   Z d   Z e d k rYe   n  d S(   iN(   t   Package(   t   gettext(   t   AttributeDeprecatedByt   function_deprecated_byt   deprecated_argst   FetchCancelledExceptionc           B   s   e  Z d  Z RS(   sA   Exception that is thrown when the user cancels a fetch operation.(   t   __name__t
   __module__t   __doc__(    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   "   s   t   FetchFailedExceptionc           B   s   e  Z d  Z RS(   s-   Exception that is thrown when fetching fails.(   R   R   R   (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR	   &   s   t   LockFailedExceptionc           B   s   e  Z d  Z RS(   s,   Exception that is thrown when locking fails.(   R   R   R   (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR
   *   s   t   Cachec           B   sQ  e  Z d  Z d' d' e d  Z d   Z d   Z d   Z d' d  Z	 d   Z
 d   Z d   Z d	   Z d
   Z d   Z d   Z e e d   Z e d    Z e d    Z e d    Z d   Z d   Z d' d' d  Z d   Z e e d  Z e d' d e d' d   Z e d    Z e d' d' d   Z d   Z  d   Z! d   Z" d   Z# d   Z$ e d    Z% e d     Z& e d!    Z' e d"    Z( e d#    Z) e* j+ rOe, e  Z- e, e  Z. e/ d$  Z0 e/ d%  Z1 e/ d&  Z2 e, e  Z3 e, e  Z4 e, e  Z5 e, e  Z6 e, e  Z7 e, e!  Z8 e, e"  Z9 n  RS((   s  Dictionary-like package cache.

    This class has all the packages that are available in it's
    dictionary.

    Keyword arguments:
    progress -- a OpProgress object
    rootdir -- a alternative root directory. if that is given
               the system sources.list and system lists/ files are
               not read, only files relative to the given rootdir
    memonly -- build the cache in memory only
    c         C   sc  d  |  _ d  |  _ d  |  _ d  |  _ i  |  _ t j   |  _ t	   |  _
 t	   |  _ d |  _ d  |  _ |  j d |  j  |  j d |  j  | r t j j	 d d  n  | rRt j j | d  r t j t j | d  n  t j j | d  rt j t j | d  n  t j j	 d |  t j j	 d	 | d
  |  j |  t j   n  |  j |  d  S(   Nit   cache_post_opent   cache_post_changes   Dir::Cache::pkgcachet    s   /etc/apt/apt.confs   /etc/apt/apt.conf.dt   Dirs   Dir::State::statuss   /var/lib/dpkg/status(   t   Nonet   _cachet	   _depcachet   _recordst   _listt
   _callbackst   weakreft   WeakValueDictionaryt   _weakreft   sett   _sett   _fullnamesett   _changes_countt   _sorted_sett   connectt   _inc_changes_countt   apt_pkgt   configt   ost   patht   existst   read_config_filet   isdirt   read_config_dirt   _check_and_create_required_dirst   init_systemt   open(   t   selft   progresst   rootdirt   memonly(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   __init__<   s6    							c         C   s   |  j  d 7_  d S(   s   Increase the number of changesi   N(   R   (   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   `   s    c         C   s   d d g } d d d d g } xE | D]= } t  j j | |  s% d G| | GHt  j | |  q% q% Wx> | D]6 } t  j j | |  sm t | | d  j   qm qm Wd	 S(
   sf   
        check if the required apt directories/files are there and if
        not create them
        s   /var/lib/dpkg/statuss   /etc/apt/sources.lists   /var/lib/dpkgs	   /etc/apt/s   /var/cache/apt/archives/partials   /var/lib/apt/lists/partials
   creating: t   wN(   R"   R#   R$   t   makedirsR*   t   close(   R+   R-   t   filest   dirst   dt   f(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR(   d   s    		c         C   s5   | |  j  k r1 x |  j  | D] } |   q Wn  d S(   s#    internal helper to run a callback N(   R   (   R+   t   namet   callback(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   _run_callbacksy   s    c         C   s  | d
 k r! t j j j   } n  | |  _ |  j d  t j |  |  _	 t j
 |  j	  |  _ t j |  j	  |  _ t j   |  _ |  j j   |  j j   |  j j   d
 |  _ |  j j   t t j j d   |  _ t d  | _ d } } t |  j	 j  } x |  j	 j D] } | d
 k	 rX| d | k  rX| j | t |  d  | } n  | j  r|  j j! | j" d t#   |  j r|  j j! | j" d t$   qn  | d 7} qW| j%   |  j d	  d
 S(   sY    Open the package cache, after that it can be used like
            a dictionary
        t   cache_pre_opens   APT::t   Architecturess   Building data structuresi    id   t   prettyi   R   Ns   APT::Architectures(&   R   t   aptR,   t   baset
   OpProgresst   op_progressR9   R    R   R   t   DepCacheR   t   PackageRecordsR   t
   SourceListR   t   read_main_listR   t   clearR   R   R   t   boolR!   t
   value_listt   _have_multi_archt   _t   opt   lent   packagest   updatet   floatt   has_versionst   addt   get_fullnamet   Truet   Falset   done(   R+   R,   t   it   lastt   sizet   pkg(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR*      s:    		
			"
c         C   s   y |  j  | SWnp t k
 r | |  j k s= | |  j k rn t |  } t |  |  j |  } |  j  | <| St d |   n Xd S(   s"    look like a dictionary (get key) s!   The cache has no package named %rN(   R   t   KeyErrorR   R   t   strR    R   (   R+   t   keyRX   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   __getitem__   s    !c         c   sK   |  j  d  k r$ t |  j  |  _  n  x |  j  D] } |  | Vq. Wt  d  S(   N(   R   R   t   sortedR   t   StopIteration(   R+   t   pkgname(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   __iter__   s
    c         C   s   | |  j  k p | |  j k S(   N(   R   R   (   R+   R[   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   has_key   s    c         C   s   | |  j  k p | |  j k S(   N(   R   R   (   R+   R[   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   __contains__   s    c         C   s   t  |  j  S(   N(   RK   R   (   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   __len__   s    c         C   s   t  |  j  S(   N(   t   listR   (   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   keys   s    c         C   s   g  } |  j  j } x |  j j D]z } | |  s | j d t  } y | j |  j |  Wq t k
 r t	 |  |  } |  j | <| j |  q Xq q W| S(   s    Get the marked changes R<   (
   R   t   marked_keepR   RL   RQ   RR   t   appendR   RY   R    (   R+   t   changesRf   RX   R7   t   package(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   get_changes   s    c         C   s(   |  j    |  j j |  |  j   d S(   s   Upgrade all packages.

        If the parameter *dist_upgrade* is True, new dependencies will be
        installed as well (and conflicting packages may be removed). The
        default value is False.
        N(   t   cache_pre_changeR   t   upgradeR   (   R+   t   dist_upgrade(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyRl      s    
c         C   s>   t  j |  j  } t  j   } | j | |  j |  j  | j S(   s;   Get the size of the packages that are required to download.(   R    t   PackageManagerR   t   Acquiret   get_archivesR   R   t   fetch_needed(   R+   t   pmt   fetcher(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   required_download   s    c         C   s
   |  j  j S(   s8   Get the size of the additional required space on the fs.(   R   t   usr_size(   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   required_space   s    c         C   s   t    } |  j j } t t j t j f  } x[ |  j j D]M } | |  } | r: | j	 r: | j
 | k r: | j | j d t   q: q: W| S(   sA   Return the packages not downloadable packages in reqreinst state.R<   (   R   R   t   get_candidate_vert	   frozensetR    t   INSTSTATE_REINSTREQt   INSTSTATE_HOLD_REINSTREQR   RL   t   downloadablet
   inst_stateRP   RQ   RR   (   R+   t	   reqreinstRw   t   statesRX   t   cand(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   req_reinstall_pkgs   s    		 c         C   s   | j    } t } t } d } x^ | j D]S } | j | j k rF q( n  | j r[ t } q( n  | d | j | j f 7} t } q( W| | j	 k r t
 |   n | r t |   n  | S(   NR   s   Failed to fetch %s %s
(   t   runRS   t   itemst   statust	   STAT_DONEt	   STAT_IDLERR   t   desc_urit
   error_textt   RESULT_CANCELLEDR   R	   (   R+   Rs   t   rest   failedt	   transientt   err_msgt   item(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   _run_fetcher   s$    	
c         C   s   t  j j d  d } t  j |  } | d k  rD t d |   n  z0 | j | |  j |  j  sf t S|  j	 |  SWd t
 j |  Xd S(   s    fetch the needed archives s   Dir::Cache::Archivest   locki    s   Failed to lock %sN(   R    R!   t   find_dirt   get_lockR
   Rp   R   R   RS   R   R"   R2   (   R+   Rs   Rr   t   lockfileR   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   _fetch_archives  s    c         C   s   | d k	 r' | d k	 r' t d   n  | d k rH t j j j   } n  | d k rf t j |  } n  |  j | t j	 |  j
   S(   s	  Fetch the archives for all packages marked for install/upgrade.

        You can specify either an :class:`apt.progress.base.AcquireProgress()`
        object for the parameter *progress*, or specify an already
        existing :class:`apt_pkg.Acquire` object for the parameter *fetcher*.

        The return value of the function is undefined. If an error occured,
        an exception of type :class:`FetchFailedException` or
        :class:`FetchCancelledException` is raised.

        .. versionadded:: 0.8.0
        s'   Takes a progress or a an Acquire objectN(   R   t
   ValueErrorR=   R,   t   textt   AcquireProgressR    Ro   R   Rn   R   (   R+   R,   Rs   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   fetch_archives,  s    	c         C   sA   y |  j  | } Wn t k
 r% t SXt | j o9 | j  Sd S(   s0   Return whether the package is a virtual package.N(   R   RY   RS   RF   t   has_providesRO   (   R+   R_   RX   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   is_virtual_packageD  s
    c         C   s  t    } |  j j } y+ |  j | } | j r? | r? t |  SWn t k
 rZ t |  SXx | j D] \ } } }	 |	 j }
 | s |	 | |
  k re |
 j	 d t
  } y | j |  j |  Wq t k
 r t |  |
  } |  j | <| j |  q Xqe qe Wt |  S(   s2  Return a list of all packages providing a package.
        
        Return a list of packages which provide the virtual package of the
        specified name. 

        If 'candidate_only' is False, return all packages with at
        least one version providing the virtual package. Otherwise,
        return only those packages where the candidate version
        provides the virtual package.

        If 'include_nonvirtual' is True then it will search for all
        packages providing pkgname, even if pkgname is not itself
        a virtual pkg.
        R<   (   R   R   Rw   R   RO   Rd   RY   t   provides_listt
   parent_pkgRQ   RR   RP   R   R    (   R+   R_   t   candidate_onlyt   include_nonvirtualt	   providersRw   t   vpt   providest   providesvert   versionRX   R7   Ri   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   get_providing_packagesM  s$    		i    c         C   s  t  j j d  d } t  j |  } | d k  rD t d |   n  | r t  j j d  } t  j j d  } t  j j d  }	 t  j j d t j j	 |   t  j j d d  t  j j d d	  t  j
   }
 |
 j   n	 |  j }
 z | d
 k rt j j j   } n  y |  j j | |
 |  } Wn t k
 rH} t |   n X| rb| rbt    n | SWd
 t j |  | rt  j j d |  t  j j d |  t  j j d |	  n  Xd
 S(   s  Run the equivalent of apt-get update.

        You probably want to call open() afterwards, in order to utilise the
        new cache. Otherwise, the old cache will be used which can lead to
        strange bugs.

        The first parameter *fetch_progress* may be set to an instance of
        apt.progress.FetchProgress, the default is apt.progress.FetchProgress()
        .
        sources_list -- Update a alternative sources.list than the default.
         Note that the sources.list.d directory is ignored in this case
        s   Dir::State::ListsR   i    s   Failed to lock %ss   Dir::Etc::sourcelists   Dir::Etc::sourcepartss   APT::List-Cleanupt   xxxt   0N(   R    R!   R   R   R
   t   findR   R"   R#   t   abspathRC   RD   R   R   R=   R,   R>   R   R   RM   t   SystemErrorR	   R2   (   R+   t   fetch_progresst   pulse_intervalt   raise_on_errort   sources_listR   R   t   old_sources_listt   old_sources_list_dt   old_cleanupt   slistR   t   e(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyRM   r  s<    	c         C   sk   y | j    Wn t k
 r+ | j   n X| j |  } y | j   Wn t k
 rf | j   n X| S(   s   
        The first parameter *pm* refers to an object returned by
        apt_pkg.PackageManager().

        The second parameter *install_progress* refers to an InstallProgress()
        object of the module apt.progress.
        (   t   startUpdatet   AttributeErrort   start_updateR   t   finishUpdatet   finish_update(   R+   Rr   t   install_progressR   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   install_archives  s    
c         C   s   | d k r! t j j j   } n  | d k rB t j j j   } n  t j |  j  } t j	 |  } x t
 r |  j | |  } |  j | |  } | | j k r Pn@ | | j k r t d   n" | | j k r n t d |   | j   qf W| | j k S(   sC  Apply the marked changes to the cache.

        The first parameter, *fetch_progress*, refers to a FetchProgress()
        object as found in apt.progress, the default being
        apt.progress.FetchProgress().

        The second parameter, *install_progress*, is a
        apt.progress.InstallProgress() object.
        s   installArchives() faileds<   internal-error: unknown result code from InstallArchives: %sN(   R   R=   R,   R>   R   t   InstallProgressR    Rn   R   Ro   RR   R   R   t   RESULT_COMPLETEDt   RESULT_FAILEDR   t   RESULT_INCOMPLETEt   shutdown(   R+   R   R   Rr   Rs   R   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   commit  s&    	
c         C   s   |  j  j   d S(   s    Unmark all changes N(   R   t   init(   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyRE     s    c         C   s   |  j  d  d S(   s@    called internally if the cache has changed, emit a signal then R   N(   R9   (   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR     s    c         C   s   |  j  d  d S(   sS    called internally if the cache is about to change, emit
            a signal then Rk   N(   R9   (   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyRk     s    c         C   s7   | |  j  k r g  |  j  | <n  |  j  | j |  d S(   sZ    connect to a signal, currently only used for
            cache_{post,pre}_{changed,open} N(   R   Rg   (   R+   R7   R8   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR     s    c         C   s   t  j |  j  S(   s  Return an ActionGroup() object for the current cache.

        Action groups can be used to speedup actions. The action group is
        active as soon as it is created, and disabled when the object is
        deleted or when release() is called.

        You can use the action group as a context manager, this is the
        recommended way::

            with cache.actiongroup():
                for package in my_selected_packages:
                    package.mark_install()

        This way, the ActionGroup is automatically released as soon as the
        with statement block is left. It also has the benefit of making it
        clear which parts of the code run with a action group and which
        don't.
        (   R    t   ActionGroupR   (   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   actiongroup  s    c         C   sa   t  j j t j j d   } x< t  j t  j j | d   D] } t j | d  r= t	 Sq= Wt
 S(   s   Return True if the dpkg was interrupted
        
        All dpkg operations will fail until this is fixed, the action to
        fix the system if dpkg got interrupted is to run 
        'dpkg --configure -a' as root.
        s   Dir::State::statust   updatess   [0-9]*(   R"   R#   t   dirnameR    R!   t	   find_filet   listdirt   joint   fnmatchRR   RS   (   R+   t   dpkg_status_dirR6   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   dpkg_journal_dirty  s    	%c         C   s
   |  j  j S(   s7   Return the number of packages with broken dependencies.(   R   t   broken_count(   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   !  s    c         C   s
   |  j  j S(   s2   Return the number of packages marked for deletion.(   R   t	   del_count(   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   delete_count&  s    c         C   s
   |  j  j S(   s6   Return the number of packages marked for installation.(   R   t
   inst_count(   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   install_count+  s    c         C   s
   |  j  j S(   s-   Return the number of packages marked as keep.(   R   t
   keep_count(   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   0  s    Rt   Rv   R   N(:   R   R   R   R   RS   R/   R   R(   R9   R*   R\   R`   Ra   Rb   Rc   Re   Rj   R   Rl   t   propertyRt   Rv   R   R   R   R   R   RR   R   RM   R   R   RE   R   Rk   R   R   R   R   R   R   R   R    t   _COMPAT_0_7R   t   _runCallbackst
   getChangesR   t   requiredDownloadt   additionalRequiredSpacet   reqReinstallPkgst   _runFetchert   _fetchArchivest   isVirtualPackaget   getProvidingPackagest   installArchivest   cachePostChanget   cachePreChange(    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   .   sj   $			(											$2+						t   ProblemResolverc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   su   Resolve problems due to dependencies and conflicts.

    The first argument 'cache' is an instance of apt.Cache.
    c         C   s"   t  j | j  |  _ | |  _ d  S(   N(   R    R   R   t	   _resolverR   (   R+   t   cache(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR/   J  s    c         C   s   |  j  j | j  d S(   s'   Reset the package to the default state.N(   R   RE   t   _pkg(   R+   Ri   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyRE   N  s    c         C   s   |  j  j   d S(   s/   mark protected packages for install or removal.N(   R   t   install_protect(   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   R  s    c         C   s   |  j  j | j  d S(   s)   Protect a package so it won't be removed.N(   R   t   protectR   (   R+   Ri   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   V  s    c         C   s   |  j  j | j  d S(   s   Mark a package for removal.N(   R   t   removeR   (   R+   Ri   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   Z  s    c         C   s+   |  j  j   |  j j   |  j  j   d S(   s:   Resolve dependencies, try to remove packages where needed.N(   R   Rk   R   t   resolveR   (   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   ^  s    c         C   s+   |  j  j   |  j j   |  j  j   d S(   s4   Resolve dependencies, do not try to remove packages.N(   R   Rk   R   t   resolve_by_keepR   (   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   d  s    (
   R   R   R   R/   RE   R   R   R   R   R   (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   D  s   						t   Filterc           B   s   e  Z d  Z d   Z RS(   s    Filter base class c         C   s   t  S(   sn    Filter function, return True if the package matchs a
            filter criteria and False otherwise
        (   RR   (   R+   RX   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   applyq  s    (   R   R   R   R   (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   n  s   t   MarkedChangesFilterc           B   s   e  Z d  Z d   Z RS(   s(    Filter that returns all marked changes c         C   s'   | j  s | j s | j r t St Sd  S(   N(   t   marked_installt   marked_deletet   marked_upgradeRR   RS   (   R+   RX   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   {  s    (   R   R   R   R   (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR   x  s   t   FilteredCachec           B   s   e  Z d  Z d d d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z e j r e e  Z e e  Z e e  Z n  RS(   sa    A package cache that is filtered.

        Can work on a existing cache or create a new one
    c         C   si   | d  k r t |  |  _ n	 | |  _ |  j j d |  j  |  j j d |  j  i  |  _ g  |  _ d  S(   NR   R   (   R   R   R   R   t   filter_cache_post_changet	   _filteredt   _filters(   R+   R   R,   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR/     s    		c         C   s   t  |  j  S(   N(   RK   R   (   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyRc     s    c         C   s   |  j  | S(   N(   R   (   R+   R[   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR\     s    c         c   s$   x |  j  D] } |  j | Vq
 Wd  S(   N(   R   R   (   R+   R_   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR`     s    c         C   s   |  j  j   S(   N(   R   Re   (   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyRe     s    c         C   s   | |  j  k S(   N(   R   (   R+   R[   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyRa     s    c         C   s   | |  j  k S(   N(   R   (   R+   R[   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyRb     s    c         C   sX   i  |  _  xH |  j D]= } x4 |  j D]) } | j |  r# d |  j  | j <Pq# q# Wq Wd S(   s    internal helper to refilter i   N(   R   R   R   R   R7   (   R+   RX   R6   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   _reapply_filter  s    	c         C   s*   g  |  _  |  j  j |  |  j j   d S(   s   Set the current active filter.N(   R   Rg   R   R   (   R+   t   filter(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt
   set_filter  s    	c         C   s   |  j    d S(   s;   Called internally if the cache changes, emit a signal then.N(   R   (   R+   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR     s    c         C   s   t  |  j |  S(   s)   we try to look exactly like a real cache.(   t   getattrR   (   R+   R[   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   __getattr__  s    N(   R   R   R   R   R/   Rc   R\   R`   Re   Ra   Rb   R   R   R   R   R    R   R   t   _reapplyFiltert	   setFiltert   filterCachePostChange(    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyR     s"   
													c           C   s	   d GHd  S(   Ns   cache pre changed(    (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   cache_pre_changed  s    c           C   s	   d GHd  S(   Ns   cache post changed(    (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   cache_post_changed  s    c          C   s  d GHt  j   t t j j j    }  |  j d t  |  j d t	  d |  k GH|  d } | j
 GHt |   GHx- |  j   D] } |  | j
 | k s| t  q| W|  j   |  j   } t |  GHx | D] } | j
 s t  q Wx6 d d g D]( } t j j |  s t j |  q q Wt  j j d d  t  j |  j  } t  j t j j j    } |  j | |  d GHt |   } | j j d t  | j j d t	  | j j   | j t    t |  GHx- | j   D] } | | | j
 k st  qWt |  GHd	 GHt d
 t j j j    } | j j d t  | j j d t	  | j j   | j t    t |  GHx- | j   D] } | | | j
 k s~t  q~Wt |  GHd S(   s   Internal test code.s   Cache self testRk   R   t   aptitudes   /tmp/pytests   /tmp/pytest/partials   Dir::Cache::Archivess.   Testing filtered cache (argument is old cache)s$   Testing filtered cache (no argument)R,   N(    R    R   R   R=   R,   R   R?   R   R   R   R7   RK   Re   t   AssertionErrorRl   Rj   R"   R#   R$   t   mkdirR!   R   Rn   R   Ro   R   R   R   R   R   R   R>   (   R   RX   R_   Rh   R   Rr   Rs   t   filtered(    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   _test  sV    


t   __main__(   R   R"   R   R    R=   R    R   RI   t   apt.deprecationR   R   R   t   apt.progress.textt   IOErrorR   R	   R
   t   objectR   R   R   R   R   R   R   R   R   (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cache.pyt   <module>   s,     *

I			8