
Nc           @   s  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z y d d l	 m
 Z
 m Z Wn e k
 r e Z Z
 n Xy d d l	 m Z Wn e k
 r e Z n Xd d l Z d d l Z d d l m Z d d l m Z m Z m Z d d d	 d
 d d d f Z d   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
 e f d     YZ# d   Z$ e% d k re$   n  d S(   s"   Functionality related to packages.iN(   t   Mappingt   Sequence(   R   (   t   gettext(   t   function_deprecated_byt   AttributeDeprecatedByt   deprecated_argst   BaseDependencyt
   Dependencyt   Origint   Packaget   Recordt   Versiont   VersionListc         C   sY   t  j j |   rU t  j j |   | k rU t |    } t j |  | k SWd QXn  d S(   s(   Return ``True`` if the file is the same.N(   t   ost   patht   existst   getsizet   opent   apt_pkgt   md5sum(   R   t   sizet   md5t   fobj(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   _file_is_same3   s    *t
   FetchErrorc           B   s   e  Z d  Z RS(   s(   Raised when a file could not be fetched.(   t   __name__t
   __module__t   __doc__(    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR   :   s   c           B   sQ   e  Z d  Z d e f d     YZ d d  Z d   Z e j	 rO e
 d  Z n  RS(   sN  A single dependency.

    Attributes defined here:
        name       - The name of the dependency
        relation   - The relation (>,>=,==,<,<=,)
        version    - The version depended on
        rawtype   - The type of the dependendy (e.g. 'Recommends')
        pre_depend - Boolean value whether this is a pre-dependency.
    t   __dstrc           B   s    e  Z d  Z d   Z d   Z RS(   s(   Helper to make > match >> and < match <<c         C   s&   t  j |  |  p% t  j d |  |  S(   Ni   (   t   strt   __eq__(   t   selft   other(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR   L   s    c         C   s&   t  j |  |  o% t  j d |  |  S(   Ni   (   R   R   t   __ne__(   R   R    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR!   O   s    (   R   R   R   R   R!   (    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR   I   s   	c         C   sR   | |  _  t |  d k r* |  j |  p- | |  _ | |  _ | |  _ | |  _ d  S(   Ni   (   t   namet   lent   _BaseDependency__dstrt   relationt   versiont
   pre_dependt   rawtype(   R   R"   t   relt   vert   preR(   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __init__R   s
    	*		c         C   s    d |  j  |  j |  j |  j f S(   Ns=   <BaseDependency: name:%r relation:%r version:%r preDepend:%r>(   R"   R%   R&   R'   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __repr__Y   s    R'   N(   R   R   R   R   R$   t   NoneR,   R-   R   t   _COMPAT_0_7R   t	   preDepend(    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR   >   s   				c           B   s    e  Z d  Z d   Z d   Z RS(   sx   Represent an Or-group of dependencies.

    Attributes defined here:
        or_dependencies - The possible choices
    c         C   s   | |  _  d  S(   N(   t   or_dependencies(   R   t   alternatives(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR,   h   s    c         C   s   t  |  j  S(   N(   t   reprR1   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR-   k   s    (   R   R   R   R,   R-   (    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR   a   s   	t   DeprecatedPropertyc           B   s/   e  Z d  Z d d d d d  Z d d  Z RS(   s   A property which gives DeprecationWarning on access.

    This is only used for providing the properties in Package, which have been
    replaced by the ones in Version.
    c         C   s5   t  j |  | | | |  | p+ | j p+ d |  _ d  S(   Nt    (   t   propertyR,   R   (   R   t   fgett   fsett   fdelt   doc(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR,   v   s    c         C   sT   | d  k	 rA t j d | j j p' | j |  j j f t d  n  t j |  | |  S(   NsR   Accessed deprecated property %s.%s, please see the Version class for alternatives.i   (	   R.   t   warningst   warnt	   __class__R   R7   t   DeprecationWarningR6   t   __get__(   R   t   objt   type_(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR?   z   s
    	N(   R   R   R   R.   R,   R?   (    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR4   o   s   c           B   s    e  Z d  Z d   Z d   Z RS(   sy  The origin of a version.

    Attributes defined here:
        archive   - The archive (eg. unstable)
        component - The component (eg. main)
        label     - The Label, as set in the Release file
        origin    - The Origin, as set in the Release file
        site      - The hostname of the site.
        trusted   - Boolean value whether this is trustworthy.
    c         C   s   | j  |  _  | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j j j |  } | rx | j	 rx t
 |  _ n	 t |  _ d  S(   N(   t   archivet	   componentt   labelt   origint   sitet   not_automatict   _pcachet   _listt
   find_indext
   is_trustedt   Truet   trustedt   False(   R   t   pkgt   packagefilet	   indexfile(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR,      s    c         C   s,   d |  j  |  j |  j |  j |  j |  j f S(   NsH   <Origin component:%r archive:%r origin:%r label:%r site:%r isTrusted:%r>(   RC   RB   RE   RD   RF   RM   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR-      s    (   R   R   R   R,   R-   (    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR      s   
	c           B   sk   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d d  Z d	   Z d
   Z RS(   s"  Record in a Packages file

    Represent a record as stored in a Packages file. You can use this like
    a dictionary mapping the field names of the record to their values::

        >>> record = Record("Package: python-apt\nVersion: 0.8.0\n\n")
        >>> record["Package"]
        'python-apt'
        >>> record["Version"]
        '0.8.0'

    For example, to get the tasks of a package from a cache, you could do::

        package.candidate.record["Tasks"].split()

    Of course, you can also use the :attr:`Version.tasks` property.

    c         C   s   t  j |  |  _ d  S(   N(   R   t
   TagSectiont   _rec(   R   t
   record_str(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR,      s    c         C   s   t  |  j  S(   N(   t   hashRS   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __hash__   s    c         C   s   t  |  j  S(   N(   R   RS   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __str__   s    c         C   s   |  j  | S(   N(   RS   (   R   t   key(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __getitem__   s    c         C   s   | |  j  k S(   N(   RS   (   R   RX   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __contains__   s    c         C   s   t  |  j j    S(   N(   t   iterRS   t   keys(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __iter__   s    c         c   s0   x) |  j  j   D] } | |  j  | f Vq Wd S(   s6   An iterator over the (key, value) items of the record.N(   RS   R\   (   R   RX   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt	   iteritems   s    c         C   s   |  j  j | |  S(   s   Return record[key] if key in record, else *default*.

        The parameter *default* must be either a string or None.
        (   RS   t   get(   R   RX   t   default(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR_      s    c         C   s   | |  j  k S(   s    deprecated form of ``key in x``.(   RS   (   R   RX   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   has_key   s    c         C   s   t  |  j  S(   N(   R#   RS   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __len__   s    N(   R   R   R   R,   RV   RW   RY   RZ   R]   R^   R.   R_   Ra   Rb   (    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR
      s   								c           B   s?  e  Z d  Z d   Z d   Z d   Z d   Z 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 d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z d   Z e d    Z e d    Z  e d    Z! e d    Z" e d     Z# e d!    Z$ e d"    Z% e d#    Z& e d$    Z' e d%    Z( d&   Z) e d'    Z* e d(    Z+ d) d, d*  Z- d) d, e. d+  Z/ RS(-   s   Representation of a package version.

    The Version class contains all information related to a
    specific package version.

    .. versionadded:: 0.7.9
    c         C   s   | |  _  | |  _ d  S(   N(   t   packaget   _cand(   R   Rc   t   cand(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR,      s    	c         C   sH   y t  j |  j j | j  SWn$ t k
 rC t  j |  j j |  SXd  S(   N(   R   t   version_compareRd   t   ver_strR&   t   AttributeError(   R   R    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   _cmp   s    c         C   s0   y |  j  |  d k SWn t k
 r+ t SXd  S(   Ni    (   Ri   t	   TypeErrort   NotImplemented(   R   R    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR      s    c         C   s0   y |  j  |  d k SWn t k
 r+ t SXd  S(   Ni    (   Ri   Rj   Rk   (   R   R    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __ge__   s    c         C   s0   y |  j  |  d k SWn t k
 r+ t SXd  S(   Ni    (   Ri   Rj   Rk   (   R   R    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __gt__   s    c         C   s0   y |  j  |  d k SWn t k
 r+ t SXd  S(   Ni    (   Ri   Rj   Rk   (   R   R    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __le__  s    c         C   s0   y |  j  |  d k  SWn t k
 r+ t SXd  S(   Ni    (   Ri   Rj   Rk   (   R   R    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __lt__	  s    c         C   s0   y |  j  |  d k SWn t k
 r+ t SXd  S(   Ni    (   Ri   Rj   Rk   (   R   R    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR!     s    c         C   s
   |  j  j S(   N(   Rd   RU   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRV     s    c         C   s   d |  j  j |  j f S(   Ns    <Version: package:%r version:%r>(   Rc   R"   R&   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR-     s    c         C   s3   |  j  j j j |  j j d  r/ |  j  j j Sd S(   s=   Internal helper that moves the Records to the right position.i    N(   Rc   RH   t   _recordst   lookupRd   t	   file_list(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRp     s    "c         C   s;   |  j  j } |  j j j j | j j d   |  j j j S(   s2   Internal helper to get the translated description.i    (   Rd   t   translated_descriptionRc   RH   Rp   Rq   Rr   t   pop(   R   t	   desc_iter(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   _translated_records"  s    "c         C   s
   |  j  j S(   s.   Return the size of the package when installed.(   Rd   t   installed_size(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRw   )  s    c         C   s
   |  j  j S(   s$   Return the homepage for the package.(   Rp   t   homepage(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRx   .  s    c         C   s
   |  j  j S(   s   Return the size of the package.(   Rd   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR   3  s    c         C   s
   |  j  j S(   s/   Return the architecture of the package version.(   Rd   t   arch(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   architecture8  s    c         C   s   t  |  j j  S(   s:   Return whether the version of the package is downloadable.(   t   boolRd   t   downloadable(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR|   =  s    c         C   s
   |  j  j S(   s   Return the version as a string.(   Rd   Rg   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR&   B  s    c         C   s
   |  j  j S(   s0   Return the short description (one line summary).(   Rv   t
   short_desc(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   summaryG  s    c         C   s
   |  j  j S(   s"   return the long description (raw).(   Rp   t	   long_desc(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   raw_descriptionL  s    c         C   s
   |  j  j S(   s"   Return the section of the package.(   Rd   t   section(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR   Q  s    c         C   s\  d } |  j  j } y% t | t  s6 t | d  } n  Wn* t k
 rc } t d  |  j j | f SXt | j	 d   } | j
   x | D] } | j   d k r | j d  s | d 7} q q n  | j d  r| j d  s d | d	 } qJd
 | d	 } nF | j d  rD| j d  s.| d k r;| d } qJ| } n | } | | 7} q W| S(   s   Return the formatted long description.

        Return the formatted long description according to the Debian policy
        (Chapter 5.6.13).
        See http://www.debian.org/doc/debian-policy/ch-controlfields.html
        for more information.
        R5   s   utf-8s<   Invalid unicode in description for '%s' (%s). Please report.s   
t   .s   

s     s   
%s
i   s   %s
t    i   (   Rv   R   t
   isinstancet   unicodet   UnicodeDecodeErrort   _Rc   R"   R[   t   splitt   nextt   stript   endswitht
   startswith(   R   t   desct   dsct   errt   linest   raw_linet   line(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   descriptionV  s4    		
	c         C   s9   y |  j  j p |  j j SWn t k
 r4 |  j j SXd S(   s&   Return the name of the source package.N(   Rp   t
   source_pkgRc   t	   shortnamet
   IndexError(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   source_name  s    c         C   s9   y |  j  j p |  j j SWn t k
 r4 |  j j SXd S(   s)   Return the version of the source package.N(   Rp   t
   source_verRd   Rg   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   source_version  s    c         C   s
   |  j  j S(   s.   Return the priority of the package, as string.(   Rd   t   priority_str(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   priority  s    c         C   s   t  |  j j  S(   s   Return a Record() object for this version.

        Return a Record() object for this version which provides access
        to the raw attributes of the candidate version
        (   R
   Rp   t   record(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR     s    c         G   s   g  } |  j  j } x | D] } yw xp | | D]d } g  } xB | D]: } | j t | j j | j | j | d k d |  q@ W| j t |   q- WWq t	 k
 r q Xq W| S(   s8   Return a list of Dependency objects for the given types.t
   PreDependsR(   (
   Rd   t   depends_listt   appendR   t
   target_pkgR"   t	   comp_typet
   target_verR   t   KeyError(   R   t   typesR   t   dependsRA   t   dep_ver_listt	   base_depst   dep_or(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   get_dependencies  s    c         C   s!   g  |  j  j D] } | d ^ q S(   s3    Return a list of names that this version provides.i    (   Rd   t   provides_list(   R   t   p(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   provides  s    c         C   s   |  j  d  S(   s4   Return the list of enhances for the package version.t   Enhances(   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   enhances  s    c         C   s   |  j  d d  S(   s/   Return the dependencies of the package version.R   t   Depends(   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   dependencies  s    c         C   s   |  j  d  S(   s-   Return the recommends of the package version.t
   Recommends(   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt
   recommends  s    c         C   s@   g  } x3 |  j  j D]% \ } } | j t |  j |   q W| S(   s1   Return a list of origins for the package version.(   Rd   Rr   R   R   Rc   (   R   t   originsRP   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR     s    c         C   s
   |  j  j S(   sZ   Return the path to the file inside the archive.

        .. versionadded:: 0.7.10
        (   Rp   t   filename(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR     s    c         C   s
   |  j  j S(   sK   Return the md5sum of the binary.

        .. versionadded:: 0.7.10
        (   Rp   t   md5_hash(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR     s    c         C   s
   |  j  j S(   sL   Return the sha1sum of the binary.

        .. versionadded:: 0.7.10
        (   Rp   t	   sha1_hash(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   sha1  s    c         C   s
   |  j  j S(   sN   Return the sha256sum of the binary.

        .. versionadded:: 0.7.10
        (   Rp   t   sha256_hash(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   sha256  s    c         C   s   t  |  j d j    S(   s   Get the tasks of the package.

        A set of the names of the tasks this package belongs to.

        .. versionadded:: 0.8.0
        t   Task(   t   setR   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   tasks  s    c         c   sV   xO |  j  j D]A \ } } |  j j j j |  } | r | j |  j j  Vq q Wd S(   sV   Return an iterator over all available urls.

        .. versionadded:: 0.7.10
        N(	   Rd   Rr   Rc   RH   RI   RJ   t   archive_uriRp   R   (   R   RP   R   RQ   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   _uris  s    c         C   s   t  |  j    S(   s^   Return a list of all available uris for the binary.

        .. versionadded:: 0.7.10
        (   t   listR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   uris  s    c         C   s   t  |  j    j   S(   sN   Return a single URI for the binary.

        .. versionadded:: 0.7.10
        (   R[   R   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   uri  s    R5   c      	   C   s   t  j j |  j j  } t  j j | |  } t | |  j |  j j  ra d | GHt  j j	 |  St
 j | p| t j j j    } t
 j | |  j |  j j |  j | d | } | j   | j | j k r t d | j | j f   n  t  j j	 |  S(   se  Fetch the binary version of the package.

        The parameter *destdir* specifies the directory where the package will
        be fetched to.

        The parameter *progress* may refer to an apt_pkg.AcquireProgress()
        object. If not specified or None, apt.progress.text.AcquireProgress()
        is used.

        .. versionadded:: 0.7.10
        s"   Ignoring already existing file: %st   destfiles$   The item %r could not be fetched: %s(   R   R   t   basenameRp   R   t   joinR   R   R   t   abspathR   t   Acquiret   aptt   progresst   textt   AcquireProgresst   AcquireFileR   t   runt   statust	   STAT_DONER   R   t
   error_text(   R   t   destdirR   t   baseR   t   acqt   acqfile(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   fetch_binary  s    	!
c         C   s7  t  j   } t  j | p' t j j j    } d	 } |  j } | j	 pN |  j
 j } | j pc |  j j }	 | j |  }
 x( |
 r |	 | j k r | j |  }
 qx W|
 s t d |    n  t   } x | j D] \ } } } } t j j |  } t j j | |  } | d k r| } n  t | | |  r;d | GHq n  | j t  j | | j j |  | | | d |  q W| j   xB | j D]7 } | j | j  k rt! d | j" | j# f   qqW| r#| j
 d t  j$ | j  } t j j | |  } t% j& d d | | g  t j j' |  St j j' |  Sd	 S(
   s[  Get the source code of a package.

        The parameter *destdir* specifies the directory where the source will
        be fetched to.

        The parameter *progress* may refer to an apt_pkg.AcquireProgress()
        object. If not specified or None, apt.progress.text.AcquireProgress()
        is used.

        The parameter *unpack* describes whether the source should be unpacked
        (``True``) or not (``False``). By default, it is unpacked.

        If *unpack* is ``True``, the path to the extracted directory is
        returned. Otherwise, the path to the .dsc file is returned.
        s   No source for %rR   s"   Ignoring already existing file: %sR   s$   The item %r could not be fetched: %st   -s   dpkg-sources   -xN((   R   t   SourceRecordsR   R   R   R   R   R.   Rp   R   Rc   R   R   Rd   Rg   Rq   R&   t
   ValueErrorR   t   filesR   R   R   R   R   R   R   t   indexR   R   t   itemsR   R   R   R   R   t   upstream_versiont
   subprocesst
   check_callR   (   R   R   R   t   unpackt   srcR   R   R   R   R   t   source_lookupR   R   R   R   RA   R   R   t   itemt   outdir(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   fetch_source1  sB    !				
N(0   R   R   R   R,   Ri   R   Rl   Rm   Rn   Ro   R!   RV   R-   R6   Rp   Rv   Rw   Rx   R   Rz   R|   R&   R~   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R.   R   RL   R   (    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR      sV   										/		
	
c           B   se   e  Z d  Z d
 d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d
 d	  Z RS(   s  Provide a mapping & sequence interface to all versions of a package.

    This class can be used like a dictionary, where version strings are the
    keys. It can also be used as a sequence, where integers are the keys.

    You can also convert this to a dictionary or a list, using the usual way
    of dict(version_list) or list(version_list). This is useful if you need
    to access the version objects multiple times, because they do not have to
    be recreated this way.

    Examples ('package.versions' being a version list):
        '0.7.92' in package.versions # Check whether 0.7.92 is a valid version.
        package.versions[0] # Return first version or raise IndexError
        package.versions[0:2] # Return a new VersionList for objects 0-2
        package.versions['0.7.92'] # Return version 0.7.92 or raise KeyError
        package.versions.keys() # All keys, as strings.
        max(package.versions)
    c         C   s5   | |  _  | j j |  _ | r1 |  j | |  _ n  d  S(   N(   t   _packaget   _pkgt   version_listt	   _versions(   R   Rc   t   slice_(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR,   }  s    	c         C   s   t  | t  r" |  j |  j |  Sy t |  j |  j |  SWnD t k
 r x4 |  j D]% } | j | k rW t |  j |  SqW Wn Xt d |   d  S(   Ns   Version: %r not found.(	   R   t   sliceR=   R   R   R   Rj   Rg   R   (   R   R   R*   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRY     s    c         C   s   d |  j    S(   Ns   <VersionList: %r>(   R\   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR-     s    c            s     f d     j  D S(   s*   Return an iterator over all value objects.c         3   s!   |  ] } t    j |  Vq d  S(   N(   R   R   (   t   .0R*   (   R   (    s/   /usr/lib/python2.7/dist-packages/apt/package.pys	   <genexpr>  s    (   R   (   R   (    (   R   s/   /usr/lib/python2.7/dist-packages/apt/package.pyR]     s    c         C   sF   t  | t  r | j } n  x$ |  j D] } | j | k r% t Sq% Wt S(   N(   R   R   R&   R   Rg   RL   RN   (   R   R   R*   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRZ     s    c         C   s   t  |   t  |  k S(   N(   R   (   R   R    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR     s    c         C   s   t  |  j  S(   N(   R#   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRb     s    c         C   s   g  |  j  D] } | j ^ q
 S(   s*   Return a list of all versions, as strings.(   R   Rg   (   R   R*   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR\     s    c         C   s%   y |  | SWn t  k
 r  | SXd S(   s   Return the key or the default.N(   t   LookupError(   R   RX   R`   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR_     s    N(   R   R   R   R.   R,   RY   R-   R]   RZ   R   Rb   R\   R_   (    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR   i  s   								c           B   s(  e  Z d  Z d   Z d   Z d   Z d   Z e e e  Z e d    Z e d    Z	 e d    Z
 e d    Z e d	    Z d
   Z e d    Z e d    Z e d    Z e d    Z e d    Z d   Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z  e d    Z! e d    Z" e d    Z# e d     Z$ e d!    Z% e d"    Z& e d#    Z' e d$    Z( e d%    Z) e d&    Z* e d'    Z+ e d(    Z, e d)    Z- e d*    Z. e d+    Z/ dB dB d,  Z1 e d-    Z2 e d.    Z3 e d/    Z4 e d0    Z5 d1   Z6 e7 e8 e9 d2   Z: e7 e8 e8 e8 d3   Z; d4   Z< e8 d5  Z= d6   Z> e? j@ sf[ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [  [+ [, [- [. [2 n eA d7  ZB eA d8  ZC eA d9  ZD eA d:  ZE eA d;  ZF eA d<  ZG eA d=  ZH eA d>  ZI eA d?  ZJ eA d@  ZK eA dA  ZL eM e1  ZN eM e:  ZO eM e;  ZP eM e6  ZQ eM e<  ZR RS(C   s   Representation of a package in a cache.

    This class provides methods and properties for working with a package. It
    lets you mark the package for installation, check if it is installed, and
    much more.
    c         C   s   | |  _  | |  _ d |  _ d S(   s    Init the Package object R5   N(   R   RH   t
   _changelog(   R   t   pcachet   pkgiter(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR,     s    		c         C   s#   d |  j  j |  j  j |  j  j f S(   Ns(   <Package: name:%r architecture=%r id:%r>(   R   R"   Rz   t   id(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR-     s    c         C   s5   |  j  j j |  j  } | d k	 r1 t |  |  Sd S(   s   Return the candidate version of the package.

        This property is writeable to allow you to set the candidate version
        of the package. Just assign a Version() object, and it will be set as
        the candidate version.
        N(   RH   t	   _depcachet   get_candidate_verR   R.   R   (   R   Re   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt	   candidate  s    c         C   s:   |  j  j   |  j  j j |  j | j  |  j  j   d S(   s)   Set the candidate version of the package.N(   RH   t   cache_pre_changeR   t   set_candidate_verR   Rd   t   cache_post_change(   R   R&   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   __set_candidate  s    c         C   s)   |  j  j d k	 r% t |  |  j  j  Sd S(   s`   Return the currently installed version of the package.

        .. versionadded:: 0.7.9
        N(   R   t   current_verR.   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt	   installed  s    c         C   s   |  j  j t  S(   s|  Return the name of the package, possibly including architecture.

        If the package is not part of the system's preferred architecture,
        return the same as :attr:`fullname`, otherwise return the same
        as :attr:`shortname`

        .. versionchanged:: 0.7.100.3
        As part of multi-arch, this field now may include architecture
        information.
        (   R   t   get_fullnameRL   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR"     s    c         C   s   |  j  j t  S(   s\   Return the name of the package, including architecture.

        .. versionadded:: 0.7.100.3(   R   R   RN   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   fullname  s    c         C   s
   |  j  j S(   sZ   Return the name of the package, without architecture.

        .. versionadded:: 0.7.100.3(   R   R"   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR     s    c         C   s
   |  j  j S(   sn   Return a uniq ID for the package.

        This can be used eg. to store additional information about the pkg.(   R   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR     s    c         C   s
   |  j  j S(   s[   Return the hash of the object.

        This returns the same value as ID, which is unique.(   R   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRV     s    c         C   s
   |  j  j S(   s>   Return True if the package is an essential part of the system.(   R   t	   essential(   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR     s    c         C   s   t  |  j d d  S(   sF   Return the installed version as string.

        .. deprecated:: 0.7.9R&   N(   t   getattrR   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   installedVersion  s    c         C   s   t  |  j d d  S(   sF   Return the candidate version as string.

        .. deprecated:: 0.7.9R&   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   candidateVersion  s    c         C   s   t  |  j d d  S(   sP   Return a list of candidate dependencies.

        .. deprecated:: 0.7.9
        R   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   candidateDependencies  s    c         C   s   t  |  j d g   S(   sP   Return a list of installed dependencies.

        .. deprecated:: 0.7.9
        R   (   R   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   installedDependencies&  s    c         C   s
   |  j  j S(   s  Return the Architecture of the package.

        .. versionchanged:: 0.7.100.3
            This is now the package's architecture in the multi-arch sense,
            previously it was the architecture of the candidate version
            and deprecated.
        (   R   Rz   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRz   .  s    c         C   s   t  |  j d d  S(   sY   Return ``True`` if the candidate is downloadable.

        .. deprecated:: 0.7.9
        R|   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   candidateDownloadable8  s    c         C   s   t  |  j d t  S(   sa   Return ``True`` if the installed version is downloadable.

        .. deprecated:: 0.7.9
        R|   (   R   R   RN   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   installedDownloadable@  s    c         C   sm   y |  j  j j p |  j j SWnI t k
 rh y |  j j j pH |  j j SWqi t k
 rd |  j j SXn Xd S(   sQ   Return the source package name as string.

        .. deprecated:: 0.7.9
        N(   R   Rp   R   R   R"   Rh   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   sourcePackageNameH  s    c         C   s   t  |  j d d  S(   sL   Return the homepage field as string.

        .. deprecated:: 0.7.9
        Rx   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRx   V  s    c         C   s
   |  j  j S(   s"   Return the section of the package.(   R   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR   ^  s    c         C   s   t  |  j d d  S(   sW   Return the priority (of the candidate version).

        .. deprecated:: 0.7.9
        R   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR   c  s    c         C   s   t  |  j d d  S(   sW   Return the priority (of the installed version).

        .. deprecated:: 0.7.9
        R   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   installedPriorityk  s    c         C   s   t  |  j d d  S(   sX   Return the short description (one line summary).

        .. deprecated:: 0.7.9
        R~   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR~   s  s    c         C   s   t  |  j d d  S(   s  Return the formatted long description.

        Return the formatted long description according to the Debian policy
        (Chapter 5.6.13).
        See http://www.debian.org/doc/debian-policy/ch-controlfields.html
        for more information.

        .. deprecated:: 0.7.9
        R   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR   {  s    c         C   s   t  |  j d d  S(   sA   return the long description (raw).

        .. deprecated:: 0.7.9R   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   rawDescription  s    c         C   s   t  |  j d d  S(   sY   Return the Record of the candidate version of the package.

        .. deprecated:: 0.7.9R   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   candidateRecord  s    c         C   s   t  |  j d d  S(   sY   Return the Record of the candidate version of the package.

        .. deprecated:: 0.7.9R   R5   (   R   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   installedRecord  s    c         C   s   |  j  j j |  j  S(   s5   Return ``True`` if the package is marked for install.(   RH   R   t   marked_installR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR    s    c         C   s   |  j  j j |  j  S(   s5   Return ``True`` if the package is marked for upgrade.(   RH   R   t   marked_upgradeR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR	    s    c         C   s   |  j  j j |  j  S(   s4   Return ``True`` if the package is marked for delete.(   RH   R   t   marked_deleteR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR
    s    c         C   s   |  j  j j |  j  S(   s2   Return ``True`` if the package is marked for keep.(   RH   R   t   marked_keepR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR    s    c         C   s   |  j  j j |  j  S(   s!    Package is marked for downgrade (   RH   R   t   marked_downgradeR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR    s    c         C   s   |  j  j j |  j  S(   s7   Return ``True`` if the package is marked for reinstall.(   RH   R   t   marked_reinstallR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR    s    c         C   s   |  j  j d k	 S(   s,   Return ``True`` if the package is installed.N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   is_installed  s    c         C   s   |  j  o |  j j j |  j  S(   s-   Return ``True`` if the package is upgradable.(   R  RH   R   t   is_upgradableR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR    s    	c         C   s   |  j  o |  j j j |  j  S(   s   Return ``True`` if the package is no longer required.

        If the package has been installed automatically as a dependency of
        another package, and if no packages depend on it anymore, the package
        is no longer required.
        (   R  RH   R   t
   is_garbageR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   is_auto_removable  s    	c         C   s   |  j  j j |  j  S(   s@   Return whether the package is marked as automatically installed.(   RH   R   t   is_auto_installedR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR    s    c         C   s   t  |  j d d  S(   sU   Return the size of the candidate deb package.

        .. deprecated:: 0.7.9
        R   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   packageSize  s    c         C   s   t  |  j d d  S(   sU   Return the size of the installed deb package.

        .. deprecated:: 0.7.9
        R   i    (   R   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   installedPackageSize  s    c         C   s   t  |  j d d  S(   s[   Return the size of the candidate installed package.

        .. deprecated:: 0.7.9
        Rw   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   candidateInstalledSize  s    c         C   s   t  |  j d d  S(   s\   Return the size of the currently installed package.


        .. deprecated:: 0.7.9
        Rw   i    (   R   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   installedSize  s    c         C   s^   d |  j  } y8 t | d  # } | j   j d  j d  SWd QXWn t k
 rY g  SXd S(   s   Return a list of files installed by the package.

        Return a list of unicode names of the files which have
        been installed by this package
        s   /var/lib/dpkg/info/%s.listt   rbs   utf-8u   
N(   R"   R   t   readt   decodeR   t   EnvironmentError(   R   R   Rr   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   installed_files  s    &c         C   s  |  j  d k r |  j  S| d k r |  j s. n  |  j j d j d k rP d } q |  j j d j d k rr d } q t d  } t | t  r | S| j d  Sn  |  j j	 } d	 } |  j j
 } |  j j } y t j   } Wn t k
 r n Xx} | j |  rn| j sq n  |  j j | j k r;| j } | j
 } Pn  t j | j |  d k r | j } | j
 } q q W| j d
 d  }	 t |	  d k r|	 d } n  ~	 | d }
 | j d  rd | d }
 n  | j d d  } t |  d k rd j | d  } n  ~ | i | d 6|
 d 6| d 6| d 6} t j   } z3yt j d  | re| j   red St j |  } d } d t j |  } xt r| r| j   rd S| j   } | sPn  | j d  } t j  | |  } | rt! |  j" d d  } | r)d | k r)| j d d  d } n  | j# d  } | rcd | k rc| j d d  d } n  | rt j | |  d k rPqn  | | 7} qWt |  d k rt d  } t | t  s| j d  } qn  | |  _  Wn t j$ k
 r+t d  | | f } t | t  r| S| j d  St% t& j' f k
 rmt d  } t | t  r`| S| j d  SXWd t j |  X|  j  S(   s  
        Download the changelog of the package and return it as unicode
        string.

        The parameter *uri* refers to the uri of the changelog file. It may
        contain multiple named variables which will be substitued. These
        variables are (src_section, prefix, src_pkg, src_ver). An example is
        the Ubuntu changelog::

            "http://changelogs.ubuntu.com/changelogs/pool" \
                "/%(src_section)s/%(prefix)s/%(src_pkg)s" \
                "/%(src_pkg)s_%(src_ver)s/changelog"

        The parameter *cancel_lock* refers to an instance of threading.Lock,
        which if set, prevents the download.
        u    i    t   Debianss   http://packages.debian.org/changelogs/pool/%(src_section)s/%(prefix)s/%(src_pkg)s/%(src_pkg)s_%(src_ver)s/changelogt   Ubuntusu   http://changelogs.ubuntu.com/changelogs/pool/%(src_section)s/%(prefix)s/%(src_pkg)s/%(src_pkg)s_%(src_ver)s/changelogs$   The list of changes is not availables   utf-8t   maint   /i   t   libi   t   :R5   t   src_sectiont   prefixt   src_pkgt   src_veri   s   ^%s \((.*)\)(.*)$R&   s   The list of changes is not available yet.

Please use http://launchpad.net/ubuntu/+source/%s/%s/+changelog
until the changes become available or try again later.sO   Failed to download the list of changes. 
Please check your Internet connection.N((   R   R.   R   R   RE   R   R   R   R  R   R   R   R   R   t   SystemErrorRq   R&   Rf   R   R#   R   R   t   sockett   getdefaulttimeoutt   setdefaulttimeoutt   isSett   urllib2t   urlopent   ret   escapeRL   t   readlinet   matchR   R   t   groupt	   HTTPErrort   IOErrort   httplibt   BadStatusLine(   R   R   t   cancel_lockt   resR$  R"  R   R%  t   src_recordst   section_splitR#  t   src_ver_splitt   timeoutt   changelog_filet	   changelogt   regexpt   line_rawR   R0  R   t   changelog_ver(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   get_changelog  s    			#				
		 %c         C   s   t  |  j d d  S(   sf   Return a list of `Origin()` objects for the candidate version.

        .. deprecated:: 0.7.9
        R   N(   R   R   R.   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   candidateOrigin  s    c         C   s
   t  |   S(   sc   Return a VersionList() object for all available versions.

        .. versionadded:: 0.7.9
        (   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   versions  s    c         C   s   |  j  j j |  j  S(   s5   Return True if the to-be-installed package is broken.(   RH   R   t   is_inst_brokenR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRD    s    c         C   s   |  j  j j |  j  S(   s/   Return True if the installed package is broken.(   RH   R   t   is_now_brokenR   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRE    s    c         C   s4   |  j  j   |  j  j j |  j  |  j  j   d S(   s   Mark a package for keep.N(   RH   R   R   t	   mark_keepR   R   (   R   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRF    s    c         C   s   |  j  j   |  j  j j |  j |  | r |  j  j j d k r t j |  j  j  } | j |  j  | j	 |  j  | j
 |  j  | j   | j   n  |  j  j   d S(   s+  Mark a package for deletion.

        If *auto_fix* is ``True``, the resolver will be run, trying to fix
        broken packages.  This is the default.

        If *purge* is ``True``, remove the configuration files of the package
        as well.  The default is to keep the configuration.
        i    N(   RH   R   R   t   mark_deleteR   t   broken_countR   t   ProblemResolvert   cleart   protectt   removet   install_protectt   resolveR   (   R   t   auto_fixt   purget   fix(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRG    s    

c         C   s   |  j  j   |  j  j j |  j | |  | r |  j  j j d k r t j |  j  j  } | j |  j  | j	 |  j  | j
 t  n  |  j  j   d S(   s0  Mark a package for install.

        If *autoFix* is ``True``, the resolver will be run, trying to fix
        broken packages.  This is the default.

        If *autoInst* is ``True``, the dependencies of the packages will be
        installed automatically.  This is the default.

        If *fromUser* is ``True``, this package will not be marked as
        automatically installed. This is the default. Set it to False if you
        want to be able to automatically remove the package at a later stage
        when no other package depends on it.
        i    N(   RH   R   R   t   mark_installR   RH  R   RI  RJ  RK  RN  RL   R   (   R   RO  t	   auto_instt	   from_usert   fixer(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRR    s    c         C   sS   |  j  r5 |  j j j |  j  } |  j d |  n t j j d |  j j	  d S(   s   Mark a package for upgrade.RT  s1   MarkUpgrade() called on a non-upgrable pkg: '%s'
N(
   R  RH   R   R  R   RR  t   syst   stderrt   writeR"   (   R   RT  (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   mark_upgrade  s
    	c         C   s   |  j  j j |  j |  d S(   s  Mark a package as automatically installed.

        Call this function to mark a package as automatically installed. If the
        optional parameter *auto* is set to ``False``, the package will not be
        marked as automatically installed anymore. The default is ``True``.
        N(   RH   R   t	   mark_autoR   (   R   t   auto(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyRZ    s    c         C   s   |  j  j j | |  d S(   s  Commit the changes.

        The parameter *fprogress* refers to a apt_pkg.AcquireProgress() object,
        like apt.progress.text.AcquireProgress().

        The parameter *iprogress* refers to an InstallProgress() object, as
        found in apt.progress.base.
        N(   RH   R   t   commit(   R   t	   fprogresst	   iprogress(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR\    s    	t   marked_installedR  R	  R
  R  R  R  R  R  R  R  N(S   R   R   R   R,   R-   R   t   _Package__set_candidateR6   R   R"   R   R   R   RV   R   R4   R   R   R   R   Rz   R  R  R  Rx   R   R   R  R~   R   R  R  R  R  R	  R
  R  R  R  R  R  R  R  R  R  R  R  R  R.   RA  RB  RC  RD  RE  RF  R   RL   RN   RG  RR  RY  RZ  R\  R   R/   R   t   markedInstalledt   markedInstallt   markedUpgradet   markedDeletet
   markedKeept   markedDowngradet   markedReinstallt   isInstalledt   isUpgradablet   isAutoRemovablet   installedFilesR   t   getChangelogt
   markDeletet   markInstallt   markKeept   markUpgrade(    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyR	     s   							
				
			c          C   s  d GHd d l  }  t j   t j j j   } t j |  } | d } d | j GHd | j	 GHd | j
 j GHd | j j GHd	 | j j GHd
 | j
 j GHd | j
 j GHd | j
 j GHd | j
 j GHd | j GHd | j
 j GHd | j
 j GHd | j
 j GHd | j
 j GHd | j
 j GHd | j j GHd | j j GHx/ | j
 j D]! } d j d   | j D  GHqIWd | j
 j GHd | j
 j GHd G| j
 j GH| d j   GHx t t  f D]r } d | GHxB | D]: } | j! r|  j" d d  d k r| j# |  qqqWd | j$ j% GHd  | j$ j& GHqWHx t t  f D] } d! | GHt j |  } xa | j'   D]S } |  j" d d  d k rfy | | j( |  Wqt) k
 rd" | GHqXqfqfWd | j$ j% GHd# | j$ j* GHq;Wd S($   s
   Self-test.s   Self-test for the Package moduliNs	   apt-utilss	   Name: %s s   ID: %s s   Priority (Candidate): %s s   Priority (Installed): %s s   Installed: %s s   Candidate: %s s   CandidateDownloadable: %ss   CandidateOrigins: %ss   SourcePkg: %s s   Section: %s s   Summary: %ss   Description (formatted) :
%ss   Description (unformatted):
%ss   InstalledSize: %s s   PackageSize: %s s   Dependencies: %ss   Recommends: %st   ,c         s   s1   |  ]' } d  | j  | j | j | j f Vq d S(   s   %s (%s) (%s) (%s)N(   R"   R&   R%   R'   (   R   t   o(    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pys	   <genexpr>Z  s   s   arch: %ss   homepage: %ss   rec: t   2vcards;   Running install on random upgradable pkgs with AutoFix: %s i    i   s   Broken: %s s   InstCount: %s s.   Randomly remove some packages with AutoFix: %ss   Error trying to remove: %s s   DelCount: %s (+   t   randomR   t   initR   R   R   t
   OpProgresst   CacheR"   R   R   R   R   R&   R|   R   R   R   R~   R   R   Rw   R   R   R   R   R1   Rz   Rx   R   RA  RL   RN   R  t   randintRR  R   RH  t
   inst_countR\   RG  R&  t	   del_count(   Rt  R   t   cacheRO   t   dept   iR"   (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   _test@  sd    

			t   __main__(&   R   R4  R   RV  R-  R'  R   R+  R;   t   collectionsR    R   t   ImportErrort   objectR   t   apt.progress.textR   R   R   t   apt.deprecationR   R   R   t   __all__R   t	   ExceptionR   R   R   R6   R4   R   R
   R   R   R	   R~  R   (    (    (    s/   /usr/lib/python2.7/dist-packages/apt/package.pyt   <module>   sL   
	#!: K  	: