
    8.g4                       S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
JrJrJrJr  SSKJr  SSKJrJr  SSKJr  SSKJr  SSKrSS	KJr  SSKrSS
KJrJr  Sr S!S jr! " S S\"5      r# " S S\#5      r$ " S S5      r% " S S\&\%   5      r' " S S5      r( " S S\\\4   5      r) " S S5      r* " S S\\*   5      r+ " S S5      r,\S 5       r-\.S :X  a  \-" 5         gg)"z"Functionality related to packages.    )annotationsN)IterableIteratorMappingSequence)BadStatusLine)Anyno_type_check)	HTTPError)urlopen)gettext)AcquireProgressInstallProgress)BaseDependency
DependencyOriginPackageRecordVersionVersionListc                $   [         R                  R                  U 5      (       a[  [         R                  R                  U 5      U:X  a8  [	        U 5       n[
        R                  " U5      R                  U:H  sSSS5        $ g! , (       d  f       g= f)z(Return ``True`` if the file is the same.NF)ospathexistsgetsizeopenapt_pkgHasheshashes)r   sizer   fobjs       -/usr/lib/python3/dist-packages/apt/package.py_file_is_samer#   6   s^    	ww~~d 5 =$Z4>>$'..&8 Z Zs   #B
Bc                      \ rS rSrSrSrg)
FetchError>   z(Raised when a file could not be fetched. N__name__
__module____qualname____firstlineno____doc____static_attributes__r'       r"   r%   r%   >   s    2r/   r%   c                      \ rS rSrSrSrg)UntrustedErrorB   z/Raised when a file did not have a trusted hash.r'   Nr(   r'   r/   r"   r1   r1   B   s    9r/   r1   c                      \ rS rSrSr " S S\5      rSS jrSS jrSS jr	\
SS j5       r\
SS	 j5       r\
SS
 j5       r\
SS j5       r\
SS j5       r\
SS j5       r\
SS j5       r\
SS j5       r\
SS j5       rSrg)r   F   zA single dependency.c                  ,    \ rS rSrSrSS jrSS jrSrg)BaseDependency.__dstrI   a)  Compare helper for compatibility with old third-party code.

Old third-party code might still compare the relation with the
previously used relations (<<,<=,==,!=,>=,>>,) instead of the curently
used ones (<,<=,=,!=,>=,>,). This compare helper lets < match to <<,
> match to >> and = match to ==.
c                `   [         R                  X5      (       a  g[         R                  U S5      (       a  [         R                  SU5      $ [         R                  U S5      (       a  [         R                  SU5      $ [         R                  U S5      (       a  [         R                  SU5      $ g)	NT<z<<>z>>=z==F)str__eq__selfothers     r"   r=   BaseDependency.__dstr.__eq__R   s}    zz$&&D#&&zz$..D#&&zz$..D#&&zz$..r/   c                .    U R                  U5      (       + $ N)r=   r>   s     r"   __ne__BaseDependency.__dstr.__ne__^   s    {{5)))r/   r'   Nr@   objectreturnbool)r)   r*   r+   r,   r-   r=   rD   r.   r'   r/   r"   __dstrr6   I   s    	
		*r/   rJ   c                    Xl         X l        g rC   )_version_dep)r?   versiondeps      r"   __init__BaseDependency.__init__a   s    	r/   c                8    U R                    SU R                   3$ Nz: rawtyperawstrr?   s    r"   __str__BaseDependency.__str__e       ,,r$++//r/   c                z    SR                  U R                  U R                  U R                  U R                  5      $ )NzC<BaseDependency: name:{!r} relation:{!r} version:{!r} rawtype:{!r}>)formatnamerelationrN   rU   rW   s    r"   __repr__BaseDependency.__repr__h   s1    T[[IIMMLLLL	
 	
r/   c                B    U R                   R                  R                  $ )zThe name of the target package.)rM   
target_pkgr]   rW   s    r"   r]   BaseDependency.namep   s     yy##(((r/   c                L    U R                  U R                  R                  5      $ )zThe relation (<, <=, =, !=, >=, >, '') in mathematical notation.

The empty string will be returned in case of an unversioned dependency.
)_BaseDependency__dstrrM   	comp_typerW   s    r"   r^   BaseDependency.relationu   s     {{499..//r/   c                .    U R                   R                  $ )aF  The relation (<<, <=, =, !=, >=, >>, '') in Debian notation.

The empty string will be returned in case of an unversioned dependency.
For more details see the Debian Policy Manual on the syntax of
relationship fields:
https://www.debian.org/doc/debian-policy/ch-relationships.html#s-depsyntax  # noqa

.. versionadded:: 1.0.0
)rM   comp_type_debrW   s    r"   relation_debBaseDependency.relation_deb}   s     yy&&&r/   c                .    U R                   R                  $ )zThe target version or an empty string.

Note that the version is only an empty string in case of an unversioned
dependency. In this case the relation is also an empty string.
)rM   
target_verrW   s    r"   rN   BaseDependency.version   s     yy###r/   c                   / nU R                   R                  5       nU H\  nUR                  nU R                  R                  R
                  nUR                  U5      n[        Xc5      nUR                  U5        M^     U$ )zVA list of all Version objects which satisfy this dependency.

.. versionadded:: 1.0.0
)	rM   all_targets
parent_pkgrL   package_pcache_rawpkg_to_pkgr   append)r?   tvers_tvers_tver_pkgcachepkgtvers           r"   target_versionsBaseDependency.target_versions   sr     (,		(=(=(?E$)$4$4DMM))11E&&t,C3&DLL  r/   c                j    U R                    Vs/ s H  oR                  (       d  M  UPM     sn$ s  snf zYA list of all installed Version objects which satisfy this dep.

.. versionadded:: 1.0.0
r}   is_installedr?   r|   s     r"   installed_target_versions(BaseDependency.installed_target_versions   *     "&!5!5K!59J9J!5KKK   00c                    U R                   (       a(  U R                   SU R                   SU R                    3$ U R                  $ )aY  String represenation of the dependency.

Returns the string representation of the dependency as it would be
written in the debian/control file.  The string representation does not
include the type of the dependency.

Example for an unversioned dependency:
  python3

Example for a versioned dependency:
  python3 >= 3.2

.. versionadded:: 1.0.0
 )rN   r]   rj   rW   s    r"   rV   BaseDependency.rawstr   s;      <<ii[$"3"3!4Adll^DD99r/   c                .    U R                   R                  $ )zType of the dependency.

This should be one of 'Breaks', 'Conflicts', 'Depends', 'Enhances',
'PreDepends', 'Recommends', 'Replaces', 'Suggests'.

Additional types might be added in the future.
rM   dep_type_untranslatedrW   s    r"   rU   BaseDependency.rawtype   s     yy...r/   c                4    U R                   R                  S:H  $ )zWhether this is a PreDepends.
PreDependsr   rW   s    r"   
pre_dependBaseDependency.pre_depend   s     yy..,>>r/   )rM   rL   N)rN   r   rO   zapt_pkg.DependencyrH   NonerH   r<   rH   zlist[Version]rH   rI   )r)   r*   r+   r,   r-   r<   re   rP   rX   r_   propertyr]   r^   rj   rN   r}   r   rV   rU   r   r.   r'   r/   r"   r   r   F   s    * *00
 ) ) 0 0 
' 
' $ $   L L  ( / / ? ?r/   r   c                     ^  \ rS rSrSr        SU 4S jjrSS jrSS jr\SS j5       r	\SS j5       r
\SS j5       r\SS	 j5       r\SS
 j5       rSrU =r$ )r      a5  Represent an Or-group of dependencies.

Attributes defined here:
    or_dependencies - The possible choices
    rawstr - String represenation of the Or-group of dependencies
    rawtype - The type of the dependencies in the Or-group
    target_version - A list of Versions which satisfy this Or-group of deps
c                <   > [         TU ]  U5        Xl        X0l        g rC   )superrP   rL   _rawtype)r?   rN   	base_depsrU   	__class__s       r"   rP   Dependency.__init__   s     	#r/   c                8    U R                    SU R                   3$ rS   rT   rW   s    r"   rX   Dependency.__str__   rZ   r/   c                8    SSR                  S U  5       5      -  $ )Nz<Dependency: [%s]>, c              3  8   #    U  H  n[        U5      v   M     g 7frC   )repr.0bds     r"   	<genexpr>&Dependency.__repr__.<locals>.<genexpr>   s     0IDbbD   joinrW   s    r"   r_   Dependency.__repr__   s    #tyy0ID0I'IJJr/   c                    U $ rC   r'   rW   s    r"   or_dependenciesDependency.or_dependencies   s    r/   c                2    SR                  S U  5       5      $ )a@  String represenation of the Or-group of dependencies.

Returns the string representation of the Or-group of dependencies as it
would be written in the debian/control file.  The string representation
does not include the type of the Or-group of dependencies.

Example:
  python2 >= 2.7 | python3

.. versionadded:: 1.0.0
z | c              3  8   #    U  H  oR                   v   M     g 7frC   )rV   r   s     r"   r   $Dependency.rawstr.<locals>.<genexpr>   s     3d))dr   r   rW   s    r"   rV   Dependency.rawstr   s     zz3d333r/   c                    U R                   $ )zType of the Or-group of dependency.

This should be one of 'Breaks', 'Conflicts', 'Depends', 'Enhances',
'PreDepends', 'Recommends', 'Replaces', 'Suggests'.

Additional types might be added in the future.

.. versionadded:: 1.0.0
)r   rW   s    r"   rU   Dependency.rawtype   s     }}r/   c                r    / nU  H.  nUR                    H  nX1;  d  M
  UR                  U5        M     M0     U$ )z\A list of all Version objects which satisfy this Or-group of deps.

.. versionadded:: 1.0.0
)r}   ru   )r?   rv   r   r|   s       r"   r}   Dependency.target_versions  s<      "B**$LL& +  r/   c                j    U R                    Vs/ s H  oR                  (       d  M  UPM     sn$ s  snf r   r   r   s     r"   r   $Dependency.installed_target_versions  r   r   )r   rL   )rN   r   r   zlist[BaseDependency]rU   r<   rH   r   r   )rH   r   r   )r)   r*   r+   r,   r-   rP   rX   r_   r   r   rV   rU   r}   r   r.   __classcell__)r   s   @r"   r   r      s      +? JM 	 0K   4 4 
 
 
 
 L Lr/   r   c                  ,    \ rS rSrSrSS jrSS jrSrg)	r   i  a  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
    codename  - The Codename, as set in the Release file
    site      - The hostname of the site.
    trusted   - Boolean value whether this is trustworthy.
c                   UR                   U l         UR                  U l        UR                  U l        UR                  U l        UR                  U l        UR
                  U l        UR                  U l        UR                  R                  R                  U5      nU(       a  UR                  (       a  SU l        g SU l        g NTF)archive	componentlabelorigincodenamesitenot_automaticrs   _list
find_index
is_trustedtrusted)r?   r{   packagefile	indexfiles       r"   rP   Origin.__init__+  s    "**$.. &&
!((#,,$$	(66KK%%00=	--DL DLr/   c                    SU R                   < SU R                  < SU R                  < SU R                  < SU R                  < SU R
                  < S3$ )Nz<Origin component:z	 archive:z origin:z label:z site:z isTrusted:r:   )r   r   r   r   r   r   rW   s    r"   r_   Origin.__repr__:  s8    
 NNLLKKJJIILL

 
	
r/   )r   r   r   r   r   r   r   r   N)r{   r   r   zapt_pkg.PackageFilerH   r   r   )r)   r*   r+   r,   r-   rP   r_   r.   r'   r/   r"   r   r     s    
!
r/   r   c                      \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSSS jjrSS jrSS jrSrg
)r   iH  a  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                :    [         R                  " U5      U l        g rC   )r   
TagSection_rec)r?   
record_strs     r"   rP   Record.__init__\  s    &&z2	r/   c                ,    [        U R                  5      $ rC   )hashr   rW   s    r"   __hash__Record.__hash___  s    DIIr/   c                ,    [        U R                  5      $ rC   )r<   r   rW   s    r"   rX   Record.__str__b      499~r/   c                     U R                   U   $ rC   r   r?   keys     r"   __getitem__Record.__getitem__e  s    yy~r/   c                    XR                   ;   $ rC   r   r   s     r"   __contains__Record.__contains__h  s    iir/   c                H    [        U R                  R                  5       5      $ rC   )iterr   keysrW   s    r"   __iter__Record.__iter__k  s    DIINN$%%r/   c              #  r   #    U R                   R                  5        H  nXR                   U   4v   M     g7f)z6An iterator over the (key, value) items of the record.N)r   r   r   s     r"   	iteritemsRecord.iteritemsn  s+     99>>#Cyy~%% $s   57Nc                8    U R                   R                  X5      $ )zoReturn record[key] if key in record, else *default*.

The parameter *default* must be either a string or None.
)r   getr?   r   defaults      r"   r   
Record.gets  s    
 yy}}S**r/   c                    XR                   ;   $ )z deprecated form of ``key in x``.r   r   s     r"   has_keyRecord.has_keyz  s    iir/   c                ,    [        U R                  5      $ rC   )lenr   rW   s    r"   __len__Record.__len__~  r   r/   r   )r   r<   rH   r   rH   intr   )r   r<   rH   r<   )r   rG   rH   rI   rH   zIterator[str])rH   zIterable[tuple[object, str]]rC   )r   r<   r   rG   rH   rG   )r   r<   rH   rI   )r)   r*   r+   r,   r-   rP   r   rX   r   r   r   r   r   r   r   r.   r'   r/   r"   r   r   H  s9    &3 &&
+ r/   r   c                  d   \ rS rSrSrS4S jrS5S jrS6S jrS7S jrS7S jr	S7S jr
S7S	 jrS8S
 jrS9S jrS:S jrS:S jr\S;S j5       r\S<S j5       r\S=S j5       r\S9S j5       r\S:S j5       r\S9S j5       r\S:S j5       r\S=S j5       r\S=S j5       r\S:S j5       r\S>S j5       r\S:S j5       r\S:S j5       r\S:S j5       r\S:S j5       r\S:S j5       r \S:S j5       r!\S9S j5       r"\S?S  j5       r#S@S! jr$\SAS" j5       r%\SBS# j5       r&\SBS$ j5       r'\SBS% j5       r(\SBS& j5       r)\SCS' j5       r*\S:S( j5       r+\S:S) j5       r,\S:S* j5       r-\S:S+ j5       r.\SDS, j5       r/SES- jr0\SAS. j5       r1\S>S/ j5       r2   SF       SGS1 jjr3    SH         SIS2 jjr4S3r5g0)Jr   i  zRepresentation of a package version.

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

.. versionadded:: 0.7.9
c                z    Xl         X l        U R                   R                  R                  R	                  U 5        g rC   )rr   _candrs   _weakversionsadd)r?   rr   cands      r"   rP   Version.__init__  s*    
**..t4r/   c                    U R                   R                  nUR                   R                  nX#:  a  gX#:  a  g[        R                  " U R                  R
                  UR                  5      $ ! [         aG     [        R                  " U R                  R
                  U5      s $ ! [         a    [        s s $ f = ff = f)a  Compares against another apt.Version object or a version string.

This method behaves like Python 2's cmp builtin and returns an integer
according to the outcome.  The return value is negative in case of
self < other, zero if self == other and positive if self > other.

The comparison includes the package name and architecture if other is
an apt.Version object.  If other isn't an apt.Version object it'll be
assumed that other is a version string (without package name/arch).

.. versionchanged:: 1.0.0
   )
rr   fullnamer   version_comparer   ver_strrN   AttributeError	TypeErrorNotImplemented)r?   r@   	self_name
other_names       r"   _cmpVersion._cmp  s    	&--I//J%'**4::+=+=u}}MM 	&&..tzz/A/A5II &%%&		&s9   1A/ A/ 4A/ /
C :*B'$C 'B<7C ;B<<C c                *    U R                  U5      S:H  $ Nr   r  r>   s     r"   r=   Version.__eq__      yy1$$r/   c                *    U R                  U5      S:  $ r  r  r>   s     r"   __ge__Version.__ge__  r  r/   c                *    U R                  U5      S:  $ r  r  r>   s     r"   __gt__Version.__gt__      yy!##r/   c                *    U R                  U5      S:*  $ r  r  r>   s     r"   __le__Version.__le__  r  r/   c                *    U R                  U5      S:  $ r  r  r>   s     r"   __lt__Version.__lt__  r  r/   c                X     U R                  U5      S:g  $ ! [         a	    [        s $ f = fr  )r  r  r  r>   s     r"   rD   Version.__ne__  s0    	"99U#q(( 	"!!	"s    ))c                .    U R                   R                  $ rC   )r   r   rW   s    r"   r   Version.__hash__  s    zzr/   c                L    U R                   R                   SU R                   3$ )Nr;   rr   r]   rN   rW   s    r"   rX   Version.__str__  s"    ,,##$Adll^44r/   c                T    SU R                   R                  < SU R                  < S3$ )Nz<Version: package:z	 version:r:   r(  rW   s    r"   r_   Version.__repr__  s(    #DLL$5$5#8	$,,AQQRSSr/   c                    U R                   R                  R                  R                  U R                  R
                  S   5      (       d  [        S5      eU R                   R                  R                  $ )z=Internal helper that moves the Records to the right position.r   zCould not lookup record)rr   rs   _recordslookupr   	file_listLookupErrorrW   s    r"   r-  Version._records  sV     ||##,,33DJJ4H4H4KLL788||##,,,r/   c                
   U R                   R                  nU R                  R                  R                  R                  UR                  R                  S5      5      (       a   U R                  R                  R                  $ g)z2Internal helper to get the translated description.r   N)r   translated_descriptionrr   rs   r-  r.  r/  pop)r?   	desc_iters     r"   _translated_recordsVersion._translated_records  s^     JJ55	<<((//	0C0C0G0G0JKK<<''000r/   c                @    [        U R                  R                  5      $ )z1Return whether this version is a security update.)rI   r   is_security_updaterW   s    r"   r9  Version.is_security_update  s     DJJ1122r/   c                .    U R                   R                  $ )z.Return the size of the package when installed.)r   installed_sizerW   s    r"   r<  Version.installed_size  s     zz(((r/   c                .    U R                   R                  $ )z$Return the homepage for the package.)r-  homepagerW   s    r"   r?  Version.homepage  s     }}%%%r/   c                .    U R                   R                  $ )zReturn the size of the package.)r   r    rW   s    r"   r    Version.size       zzr/   c                .    U R                   R                  $ )z/Return the architecture of the package version.)r   archrW   s    r"   architectureVersion.architecture  rC  r/   c                @    [        U R                  R                  5      $ )z:Return whether the version of the package is downloadable.)rI   r   downloadablerW   s    r"   rI  Version.downloadable  s     DJJ++,,r/   c                    U R                   R                  nUSL=(       a-    UR                  R                  U R                  R                  :H  $ )z[Return wether this version of the package is currently installed.

.. versionadded:: 1.0.0
N)rr   	installedr   id)r?   inst_vers     r"   r   Version.is_installed  s:     <<))t#J(9(9TZZ]](JJr/   c                .    U R                   R                  $ )zReturn the version as a string.)r   r	  rW   s    r"   rN   Version.version       zz!!!r/   c                <    U R                   nUb  UR                  $ S$ )z0Return the short description (one line summary).N)r6  
short_desc)r?   recordss     r"   summaryVersion.summary  s%     **%,%8w!!BdBr/   c                .    U R                   R                  $ )z"return the long description (raw).)r-  	long_descrW   s    r"   raw_descriptionVersion.raw_description  s     }}&&&r/   c                .    U R                   R                  $ )z"Return the section of the package.)r   sectionrW   s    r"   r]  Version.section  rR  r/   c                   SnU R                   nUb  UR                  OSnU(       d"  [        S5      U R                  R                  -  $  [        U[        5      (       d  UR                  S5      n[        UR                  S5      5      n[        U5        U H  nUR                  5       S:X  a  UR                  S5      (       d  US-  nM4  UR                  S	5      (       a(  UR                  S5      (       d	  S
USS -  nOFSUSS -  nO=UR                  S5      (       a%  UR                  S5      (       d  US:X  a  USS nOUnOUnX-  nM     U$ ! [         a.  n[        S5      U R                  R                  U4-  s SnA$ SnAff = f)zReturn 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.
 Nz+Missing description for '%s'.Please report.utf-8z<Invalid unicode in description for '%s' (%s). Please report.
.z

z  z
%s
   z%s
r   r  )r6  rY  _rr   r]   
isinstancer<   decodeUnicodeDecodeErrorr   splitnextstripendswith
startswith)r?   descrU  dscerrlinesraw_linelines           r"   descriptionVersion.description  sz    **#*#6gDEF!! 	)c3''jj) SYYt_%UH~~3&}}T**FND""4((}}T**#hqrl2D!HQRL0D$$S))==&&$"*#AB<D#DLD- . ? " 	)Q""C() )	)s   
&E 
F#F=FFc                     U R                   R                  =(       d    U R                  R                  $ ! [         a    U R                  R                  s $ f = f)z&Return the name of the source package.)r-  
source_pkgrr   	shortname
IndexErrorrW   s    r"   source_nameVersion.source_nameO  sE    	*==++Et||/E/EE 	*<<)))	*   25  AAc                     U R                   R                  =(       d    U R                  R                  $ ! [         a    U R                  R                  s $ f = f)z)Return the version of the source package.)r-  
source_verr   r	  ry  rW   s    r"   source_versionVersion.source_versionW  sE    	&==++Atzz/A/AA 	&::%%%	&r|  c                .    U R                   R                  $ )z.Return the priority of the package, as string.)r   priority_strrW   s    r"   priorityVersion.priority_  s     zz&&&r/   c                    U R                   R                  R                  R                  R	                  U R
                  5      $ )zrReturn the internal policy priority as a number.
See apt_preferences(5) for more information about what it means.
)rr   rs   	_depcachepolicyget_priorityr   rW   s    r"   policy_priorityVersion.policy_priorityd  s/    
 ||##--44AA$**MMr/   c                @    [        U R                  R                  5      $ )zReturn 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   r-  recordrW   s    r"   r  Version.recordk  s     dmm**++r/   c           	        / nU R                   R                  nU HO  n X4    HC  n/ nU H  nUR                  [        X5      5        M     UR                  [	        XU5      5        ME     MQ     U$ ! [
         a     Mb  f = f)a   Return a list of Dependency objects for the given types.

Multiple types can be specified. Possible types are:
'Breaks', 'Conflicts', 'Depends', 'Enhances', 'PreDepends',
'Recommends', 'Replaces', 'Suggests'

Additional types might be added in the future.
)r   depends_listru   r   r   KeyError)r?   typesr  dependstype_dep_ver_listr   dep_ors           r"   get_dependenciesVersion.get_dependenciest  s     **))E$+NL "I".!(()EF #/ ''
4E(JK	 %3    s   AA00
A>=A>c                ^    U R                   R                   Vs/ s H  oS   PM	     sn$ s  snf )z2Return a list of names that this version provides.r   )r   provides_list)r?   ps     r"   providesVersion.provides  s*     #jj6676!6777s   *c                $    U R                  S5      $ )z4Return the list of enhances for the package version.Enhancesr  rW   s    r"   enhancesVersion.enhances       $$Z00r/   c                &    U R                  SS5      $ )z/Return the dependencies of the package version.r   Dependsr  rW   s    r"   dependenciesVersion.dependencies  s     $$\9==r/   c                $    U R                  S5      $ )z-Return the recommends of the package version.
Recommendsr  rW   s    r"   
recommendsVersion.recommends  s     $$\22r/   c                $    U R                  S5      $ )z+Return the suggests of the package version.Suggestsr  rW   s    r"   suggestsVersion.suggests  r  r/   c                    / nU R                   R                   H*  u  p#UR                  [        U R                  U5      5        M,     U$ )z1Return a list of origins for the package version.)r   r/  ru   r   rr   )r?   originsr   _unuseds       r"   r  Version.origins  s<     $(JJ$8$8 KNN6$,,<= %9r/   c                .    U R                   R                  $ )zJReturn the path to the file inside the archive.

.. versionadded:: 0.7.10
)r-  filenamerW   s    r"   r  Version.filename       }}%%%r/   c                .    U R                   R                  $ )z;Return the md5sum of the binary.

.. versionadded:: 0.7.10
)r-  md5_hashrW   s    r"   md5Version.md5  r  r/   c                .    U R                   R                  $ )z<Return the sha1sum of the binary.

.. versionadded:: 0.7.10
)r-  	sha1_hashrW   s    r"   sha1Version.sha1  s     }}&&&r/   c                .    U R                   R                  $ )z>Return the sha256sum of the binary.

.. versionadded:: 0.7.10
)r-  sha256_hashrW   s    r"   sha256Version.sha256  s     }}(((r/   c                N    [        U R                  S   R                  5       5      $ )zqGet the tasks of the package.

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

.. versionadded:: 0.8.0
Task)setr  ri  rW   s    r"   tasksVersion.tasks  s!     4;;v&,,.//r/   c              #    #    U R                   R                   Hd  u  pU R                  R                  R                  R                  U5      nU(       d  M=  UR                  U R                  R                  5      v   Mf     g7f)zFReturn an iterator over all available urls.

.. versionadded:: 0.7.10
N)	r   r/  rr   rs   r   r   archive_urir-  r  )r?   r   r  r   s       r"   _urisVersion._uris  s^     
 %)JJ$8$8 K,,22==kJIy++DMM,B,BCC %9s   AB,Bc                4    [        U R                  5       5      $ )zNReturn a list of all available uris for the binary.

.. versionadded:: 0.7.10
)listr  rW   s    r"   urisVersion.uris  s     DJJL!!r/   c                h     [        [        U R                  5       5      5      $ ! [         a     gf = f)z>Return a single URI for the binary.

.. versionadded:: 0.7.10
N)rj  r   r  StopIterationrW   s    r"   uriVersion.uri  s/    	TZZ\*++ 		s   !$ 
11Nc                |   Uc   [         R                  R                  SS5      n[        R                  R                  U R                  R                  5      n[        R                  R                  X5      n[        XPR                  U R                  R                  5      (       a8  [        R                  " SU-  5        [        R                  R                  U5      $ U R                  R                   S   u  pgU R"                  R$                  R&                  R)                  U5      nU(       dY  U(       a  UR*                  (       dA  [-        SU R"                  R.                  < SU R0                  < S[3        USS	5      < S
35      eU R4                  (       d  [7        S5      eU R                  R                  n	U(       d  U	R8                  (       d  [-        SU-  5      e[         R:                  " U=(       d(    [<        R>                  R@                  RC                  5       5      n
[         RD                  " XR4                  XR                  XES9nU
RG                  5         URH                  URJ                  :w  a'  [M        SURN                  < SURP                  < 35      e[        R                  R                  U5      $ )a  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.

The keyword-only parameter *allow_unauthenticated* specifies whether
to allow unauthenticated downloads. If not specified, it defaults to
the configuration option `APT::Get::AllowUnauthenticated`.

.. versionadded:: 0.7.10
APT::Get::AllowUnauthenticatedF"Ignoring already existing file: %sr   Could not fetch r    source package: Source describez	<unknown> is not trustedzNo URI for this binary.8The item %r could not be fetched: No trusted hash found.destfile	The item  could not be fetched: ))r   configfind_br   r   basenamer-  r  r   r#   r    r   loggingdebugabspathr   r/  rr   rs   r   r   r   r1   r]   rN   getattrr  
ValueErrorusableAcquireaptprogresstextr   AcquireFilerunstatus	STAT_DONEr%   r  
error_text)r?   destdirr  allow_unauthenticatedbaser  pfileoffsetindexr   acqacqfiles               r"   fetch_binaryVersion.fetch_binary  s   * !($+NN$9$93U%! ww 6 6777<<.99dmm.B.BCCMM>IJ77??8,, 

,,Q/$$**55e<%%E4D4D  LL%%LLE:{;  xx677%%% MPXX  oohM#,,*;*;*K*K*MN%%699d
 		>>W...##W%7%79 
 wwx((r/   c                6   Uc   [         R                  R                  SS5      n[         R                  " 5       n[         R                  " U=(       d(    [
        R                  R                  R                  5       5      nSnU R                  nUR                  =(       d    U R                  R                  n	UR                  =(       d    U R                  R                  n
UR!                  U	5      nU(       a8  XR"                  :w  a)  UR!                  U	5      nU(       a  XR"                  :w  a  M)  U(       d  [%        SU -  5      e['        5       nU(       de  UR(                  R*                  (       dJ  [-        SU R                  R.                  < SU R"                  < SUR(                  R0                  < S35      eUR2                   GH-  n[4        R6                  R9                  UR6                  5      n[4        R6                  R;                  X5      nUR<                  S	:X  a  Un[?        XR@                  URB                  5      (       a  [D        RF                  " S
U-  5        M  U(       d)  URB                  RH                  (       d  [-        SU-  5      eURK                  [         RL                  " UUR(                  RO                  UR6                  5      URB                  UR@                  UUS95        GM0     URQ                  5         Uc  [%        SU -  5      eURR                   HD  nURT                  URV                  :w  d  M  [Y        SURZ                  < SUR\                  < 35      e   U(       a  UR                  S-   [         R^                  " UR"                  5      -   n[4        R6                  R;                  UU5      n[`        Rb                  " SSUU/5        [4        R6                  Re                  U5      $ [4        R6                  Re                  U5      $ )a  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.

The keyword-only parameter *allow_unauthenticated* specifies whether
to allow unauthenticated downloads. If not specified, it defaults to
the configuration option `APT::Get::AllowUnauthenticated`.
Nr  FzNo source for %rr  r   r  r  ro  r  r  r  r  r  -zdpkg-sourcez-x)3r   r  r  SourceRecordsr  r  r  r  r   r-  rw  rr   rx  r~  r   r	  r.  rN   r  r  r  r   r1   r]   r  filesr   r   r  r   typer#   r    r   r  r  r  ru   r  r  r  itemsr  r  r%   r  r  upstream_version
subprocess
check_callr  )r?   r  r  unpackr  srcr  ro  r  rz  r  source_lookupr  filr  r  itemoutdirs                     r"   fetch_sourceVersion.fetch_source4  s   4 !($+NN$9$93U%! ##%oohM#,,*;*;*K*K*MN''A4<<+A+A**@djj.@.@

;/++ =JJ{3M ++ =/$677%)=)=  <<$$dllCII4F4FH 
 99C77##CHH-Dww||G2Hxx5 Xxx<<BXMN)SZZ->->$-/78  LL##II))#((3JJHH%	 0 		;/$677IID{{dnn, }}doo7   [[3&)A)A#++)NNFWW\\'62F!!=$V"DE77??6**77??3''r/   )r   rr   )rr   r   r  zapt_pkg.VersionrH   r   )r@   r	   rH   z	int | AnyrF   )r@   r   rH   rI   )r@   rG   rH   z
bool | Anyr   r   )rH   zapt_pkg.PackageRecords)rH   zapt_pkg.PackageRecords | Noner   )rH   
str | None)rH   r   )r  r<   rH   list[Dependency]rH   z	list[str])rH   r  )rH   zlist[Origin])rH   zset[str]r   )r`  NN)r  r<   r  AcquireProgress | Noner  bool | NonerH   r<   )r`  NTN)
r  r<   r  r  r  rI   r  r  rH   r<   )6r)   r*   r+   r,   r-   rP   r  r=   r  r  r  r!  rD   r   rX   r_   r   r-  r6  r9  r<  r?  r    rF  rI  r   rN   rV  rZ  r]  rt  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   r     s\   5
&:%%$%$"5T - -   3 3 ) ) & &     - - K K " " C C
 ' ' " " 4 4l * * & & ' ' N N , ,, 8 8 1 1 > > 3 3 1 1   & & & & ' ' ) ) 0 0D " "   +/-1	@)@) )@)  +	@)
 
@)H +/-1^(^( )^( 	^(
  +^( 
^( ^(r/   r   c                      \ rS rSrSrSSS jjrSS jrSS jrSS jrSS jr	SS	 jr
SS
 jrSS jrSS jrSSS jjrSrg)r   i  ag  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)
Nc                ~    Xl         UR                  R                  U l        U(       a  U R                  U   U l        g g rC   )_packagery   version_list	_versions)r?   rr   slice_s      r"   rP   VersionList.__init__  s0     22!^^F3DN r/   c                b   [        U[        5      (       a  U R                  U R                  U5      $  [	        U R                  U R
                  U   5      $ ! [         a@    U R
                   H-  nUR                  U:X  d  M  [	        U R                  U5      s  s $     Of = f[        SU-  5      e)NzVersion: %r not found.)	rf  slicer   r  r   r  r  r	  r  r?   r	  vers      r"   r   VersionList.__getitem__  s     dE"">>$--66	74==$..*>?? 	7~~;;$&"4==#66 &	7
 /4899s   "A 'B B B B c                8    SSR                  S U  5       5      -  $ )Nz[%s]r   c              3  8   #    U  H  n[        U5      v   M     g 7frC   )r<   )r   r  s     r"   r   &VersionList.__str__.<locals>.<genexpr>  s     "<t3s88tr   r   rW   s    r"   rX   VersionList.__str__  s    "<t"<<==r/   c                (    SU R                  5       -  $ )Nz<VersionList: %r>)r   rW   s    r"   r_   VersionList.__repr__  s    "TYY[00r/   c                0   ^  U 4S jT R                    5       $ )z*Return an iterator over all value objects.c              3  P   >#    U  H  n[        TR                  U5      v   M     g 7frC   )r   r  )r   r  r?   s     r"   r   'VersionList.__iter__.<locals>.<genexpr>  s     F~s++~s   #&)r  rW   s   `r"   r   VersionList.__iter__  s    Ft~~FFr/   c                    [        U[        5      (       a  UR                  nU R                   H  nUR                  U:X  d  M    g   gr   )rf  r   rN   r  r	  r  s      r"   r   VersionList.__contains__  s:    dG$$<<D>>C{{d" " r/   c                0    [        U 5      [        U5      :H  $ rC   )r  r>   s     r"   r=   VersionList.__eq__  s    DzT%[((r/   c                ,    [        U R                  5      $ rC   )r   r  rW   s    r"   r   VersionList.__len__  s    4>>""r/   c                X    U R                    Vs/ s H  oR                  PM     sn$ s  snf )z*Return a list of all versions, as strings.)r  r	  )r?   r  s     r"   r   VersionList.keys  s     '+~~6~~666s   'c                0     X   $ ! [          a    Us $ f = f)zReturn the key or the default.)r0  r   s      r"   r   VersionList.get  s#    	9 	N	s    )r  r  rC   )rr   r   r  zslice | NonerH   r   )r	  zint | slice | strrH   r	   r   )rH   zIterator[Version])r	  rG   rH   rI   )r@   r	   rH   rI   r   r  )r   r<   r   Version | NonerH   r2  )r)   r*   r+   r,   r-   rP   r   rX   r_   r   r   r=   r   r   r   r.   r'   r/   r"   r   r     s?    &4:>1G)#
7 r/   r   c                     \ rS rSrSrS)S jrS*S jrS*S jrS+S jr\	S,S j5       r
\
R                  S-S j5       r
\	S,S	 j5       r\	S*S
 j5       r\	S*S j5       r\	S*S j5       r\	S.S j5       r\	S/S j5       rS*S jr\	S/S j5       r\	S/S j5       r\	S/S j5       r\	S/S j5       r\	S/S j5       r\	S/S j5       r\	S/S j5       r\	S/S j5       r\	S/S j5       r\	S/S j5       r\	S/S j5       r\	S0S j5       r S1     S2S jjr\	S3S j5       r \	S/S j5       r!\	S/S  j5       r"\	S/S! j5       r#S4S" jr$S5S6S# jjr% S7       S8S$ jjr&S9S:S% jjr'S9S;S& jjr(S<S' jr)S(r*g)=r   i  zRepresentation 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                *    X l         Xl        SU l        g)zInit the Package objectr`  N)ry   rs   
_changelog)r?   pcachepkgiters      r"   rP   Package.__init__  s    	r/   c                    U R                   $ rC   r]   rW   s    r"   rX   Package.__str__  s    yyr/   c                    SR                  U R                  R                  U R                  R                  U R                  R                  5      $ )Nz.<Package: name:{!r} architecture={!r} id:{!r}>)r\   ry   r]   rF  rM  rW   s    r"   r_   Package.__repr__  s8    ?FFIINNII""IILL
 	
r/   c                4    U R                   UR                   :  $ rC   r:  r>   s     r"   r!  Package.__lt__  s    yy5::%%r/   c                ~    U R                   R                  R                  U R                  5      nUb  [	        X5      $ g)zReturn 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)rs   r  get_candidate_verry   r   )r?   r  s     r"   	candidatePackage.candidate   s6     ||%%77		B4&&r/   c                    U R                   R                  5         U R                   R                  R                  U R                  UR
                  5        U R                   R                  5         g)z)Set the candidate version of the package.N)rs   cache_pre_changer  set_candidate_verry   r   cache_post_change)r?   rN   s     r"   rB  rC    sF     	%%'00GMMJ&&(r/   c                p    U R                   R                  b  [        X R                   R                  5      $ g)zPReturn the currently installed version of the package.

.. versionadded:: 0.7.9
N)ry   current_verr   rW   s    r"   rL  Package.installed  s,     99  ,4!6!677r/   c                8    U R                   R                  S5      $ )aE  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.
Try   get_fullnamerW   s    r"   r]   Package.name  s     yy%%d++r/   c                8    U R                   R                  S5      $ )zReturn the name of the package, including architecture.

Note that as for :meth:`architecture`, this returns the
native architecture for Architecture: all packages.

.. versionadded:: 0.7.100.3FrL  rW   s    r"   r  Package.fullname-  s     yy%%e,,r/   c                .    U R                   R                  $ )zRReturn the name of the package, without architecture.

.. versionadded:: 0.7.100.3)ry   r]   rW   s    r"   rx  Package.shortname7  s    
 yy~~r/   c                .    U R                   R                  $ )zfReturn a uniq ID for the package.

This can be used eg. to store additional information about the pkg.)ry   rM  rW   s    r"   rM  
Package.id>  s    
 yy||r/   c                .    U R                   R                  $ )z>Return True if the package is an essential part of the system.)ry   	essentialrW   s    r"   rV  Package.essentialE  s     yy"""r/   c                .    U R                   R                  $ )a  Return the Architecture of the package.

Note that for Architecture: all packages, this returns the
native architecture, as they are internally treated like native
packages. To get the concrete architecture, look at the
:attr:`Version.architecture` attribute.

.. 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.
)ry   rF  rW   s    r"   rF  Package.architectureJ  s     yy%%%r/   c                `    U R                   R                  R                  U R                  5      $ )z5Return ``True`` if the package is marked for install.)rs   r  marked_installry   rW   s    r"   r[  Package.marked_install[  #     ||%%44TYY??r/   c                `    U R                   R                  R                  U R                  5      $ )z5Return ``True`` if the package is marked for upgrade.)rs   r  marked_upgradery   rW   s    r"   r_  Package.marked_upgrade`  r]  r/   c                `    U R                   R                  R                  U R                  5      $ )z4Return ``True`` if the package is marked for delete.)rs   r  marked_deletery   rW   s    r"   rb  Package.marked_deletee  #     ||%%33DII>>r/   c                `    U R                   R                  R                  U R                  5      $ )z2Return ``True`` if the package is marked for keep.)rs   r  marked_keepry   rW   s    r"   rf  Package.marked_keepj  s#     ||%%11$))<<r/   c                `    U R                   R                  R                  U R                  5      $ )zPackage is marked for downgrade)rs   r  marked_downgradery   rW   s    r"   ri  Package.marked_downgradeo  #     ||%%66tyyAAr/   c                `    U R                   R                  R                  U R                  5      $ )z7Return ``True`` if the package is marked for reinstall.)rs   r  marked_reinstallry   rW   s    r"   rm  Package.marked_reinstallt  rk  r/   c                2    U R                   R                  SL$ )z,Return ``True`` if the package is installed.N)ry   rI  rW   s    r"   r   Package.is_installedy  s     yy$$D00r/   c                    U R                   =(       a/    U R                  R                  R                  U R                  5      $ )z-Return ``True`` if the package is upgradable.)r   rs   r  is_upgradablery   rW   s    r"   rr  Package.is_upgradable~  s.       TT\\%;%;%I%I$))%TTr/   c                    U R                   =(       d    U R                  =(       a/    U R                  R                  R	                  U R
                  5      $ )zReturn ``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   r[  rs   r  
is_garbagery   rW   s    r"   is_auto_removablePackage.is_auto_removable  s>     4!4!4;ll$$//		:	;r/   c                `    U R                   R                  R                  U R                  5      $ )z@Return whether the package is marked as automatically installed.)rs   r  is_auto_installedry   rW   s    r"   ry  Package.is_auto_installed  s#     ||%%77		BBr/   c                `    U R                   R                  R                  U R                  5      $ )z6Return ``True`` if the package update is being phased.)rs   r  phasing_appliedry   rW   s    r"   r|  Package.phasing_applied  s#     ||%%55dii@@r/   c                :   U R                   U R                  4 H[  nSU-  n [        US5       nUR                  5       R	                  S5      R                  5       R                  S5      sSSS5        s  $    / $ ! , (       d  f       Mp  = f! [         a     M  f = f)zReturn a list of files installed by the package.

Return a list of unicode names of the files which have
been installed by this package
z/var/lib/dpkg/info/%s.listrbra  rb  N)r]   r  r   readrg  rk  ri  OSError)r?   r]   r   r/  s       r"   installed_filesPackage.installed_files  s     IIt}},D/$6D$%$>>+227;AACII$O &% - 	 &% s.   B<A:*	B:
B		B	B
BBNc                V   U R                   S:w  a  U R                   $ U R                  (       d  [        S5      $ Uc  U R                  R                  S   R                  S:X  a  SnO]U R                  R                  S   R                  S:X  a  SnO3[        S5      n[        U[        5      (       a  U$ UR                  S	5      $ U R                  R                  nS
nU R                  R                  nU R                  R                  n [        R                  " 5       nUR                  U5      (       a  UR                  (       d  M)  U R                  R                  UR                  :X  a  UR                  nUR                  nOU[        R                  " UR                  U5      S:  a  UR                  nUR                  nUR                  U5      (       a  M  UR#                  SS5      n	[%        U	5      S:  a  U	S   nA	US   n
UR'                  S5      (       a  SUS   -   n
UR#                  SS5      n[%        U5      S:  a  SR)                  USS 5      nAUUU
UUS.-  n[*        R,                  " 5       n  [*        R.                  " S5        U(       a-  UR1                  5       (       a   [*        R.                  " U5        g[3        U5      nSnS[4        R6                  " U5      -  n U(       a-  UR1                  5       (       a   [*        R.                  " U5        gUR9                  5       nU(       d  OUR                  S	5      n[4        R:                  " UU5      nU(       a  [=        U R>                  SS5      nU(       a  SU;   a  UR#                  SS5      S   nURA                  S5      nU(       a  SU;   a  UR#                  SS5      S   nU(       a  [        R                  " UU5      S::  a  OUU-  nGM  [%        U5      S:X  a1  [        S5      n[        U[        5      (       d  UR                  S	5      nXl          [*        R.                  " U5        U R                   $ ! [          a     GNf = f! [B         a    U R                  R                  S   R                  S:X  a  [        S5      XG4-  nO[        S5      n[        U[        5      (       a  Us [*        R.                  " U5        $ UR                  S	5      s [*        R.                  " U5        $ [D        [F        4 ad    [        S5      n[        U[        5      (       a  Us [*        R.                  " U5        $ UR                  S	5      s [*        R.                  " U5        $ f = f! [*        R.                  " U5        f = f)a-  
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.Event,
which if set, prevents the download.
r`  z$The list of changes is not availableNr   Debianzshttp://packages.debian.org/changelogs/pool/%(src_section)s/%(prefix)s/%(src_pkg)s/%(src_pkg)s_%(src_ver)s/changelogUbuntuzuhttp://changelogs.ubuntu.com/changelogs/pool/%(src_section)s/%(prefix)s/%(src_pkg)s/%(src_pkg)s_%(src_ver)s/changelogra  main/r  lib   :)src_sectionprefixsrc_pkgsrc_verrd  z^%s \((.*)\)(.*)$rN   zThe 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.zOFailed to download the list of changes. 
Please check your Internet connection.)$r5  rB  re  r  r   rf  r<   rg  rz  r]  r  r   r  r.  rN   r  SystemErrorri  r   rm  r   socketgetdefaulttimeoutsetdefaulttimeoutis_setr   reescapereadlinematchr  rL  groupr   r  r   )r?   r  cancel_lockresr  r  r]  r  src_recordssection_splitr  src_ver_splittimeoutchangelog_file	changelogregexpline_rawrs  r  rL  changelog_vers                        r"   get_changelogPackage.get_changelog  s   ( ??b ??"~~;<<;~~%%a(//8;9 
 ''*11X=9  >?c3''J::g.. ..,, ..(( ..//	2
 "//1K $$W--"**>>00K4G4GG)11G)11G**;+>+>H1L)11G)11G $$W--  c1-}!'*K e$$WQZ'F  c1-}!ggmAB/0G&	
 
 **,N	.K/((+ ;#5#5#7#7N $$W-K ")	."))G2DE"{'9'9';';!| $$W-y  .668H# $??73D HHVT2E %,DNNIt$L	$	)9(1Q(?(BI(-A(SM-A,9,?,?Q,G,JM & ' 7 7y QUV V!%I= B y>Q& !"H II%i55$-$4$4W$=	"+8 $$W-u  		~  />>))!,33x?! !*+C BCCc3''J $$W- ::g.. $$W- ]+ /6 c3''J $$W- ::g..$$W-/ $$W-si   Q% 92Q6 AQ6 D$Q6 %
Q32Q36A#VV 1VV 1VV #V4V VV V(c                    [        U 5      $ )zSReturn a VersionList() object for all available versions.

.. versionadded:: 0.7.9
)r   rW   s    r"   versionsPackage.versionsg  s     4  r/   c                `    U R                   R                  R                  U R                  5      $ )z5Return True if the to-be-installed package is broken.)rs   r  is_inst_brokenry   rW   s    r"   r  Package.is_inst_brokeno  r]  r/   c                `    U R                   R                  R                  U R                  5      $ )z/Return True if the installed package is broken.)rs   r  is_now_brokenry   rW   s    r"   r  Package.is_now_brokent  rd  r/   c                P    U R                   R                  [        R                  :H  $ )z8Checks whether the package is is the config-files state.)ry   current_stater   CURSTATE_CONFIG_FILESrW   s    r"   has_config_filesPackage.has_config_filesy  s     yy&&'*G*GGGr/   c                    U R                   R                  5         U R                   R                  R                  U R                  5        U R                   R                  5         g)zMark a package for keep.N)rs   rE  r  	mark_keepry   rG  rW   s    r"   r  Package.mark_keep  s>    %%'((3&&(r/   c                8   U R                   R                  5         U R                   R                  R                  U R                  U5        U(       a  U R                   R                  R
                  S:  a  [        R                  " U R                   R                  5      nUR                  U R                  5        UR                  U R                  5        UR                  U R                  5        UR                  5         U R                   R                  5         g)a  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.
r   N)rs   rE  r  mark_deletery   broken_countr   ProblemResolverclearprotectremoveresolverG  )r?   auto_fixpurgefixs       r"   r  Package.mark_delete  s     	%%'**499e<..;;a?))$,,*@*@ACIIdii KK		"JJtyy!KKM&&(r/   c                   U R                   R                  5         U R                   R                  R                  U R                  X#5        U(       a  U R                   R                  R
                  S:  aq  [        R                  " U R                   R                  5      nUR                  U R                  5        UR                  U R                  5        UR                  S5        U R                   R                  5         g)a  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.
r   TN)rs   rE  r  mark_installry   r  r   r  r  r  r  rG  )r?   r  	auto_inst	from_userfixers        r"   r  Package.mark_install  s      	%%'++DIIyL..;;a?++DLL,B,BCEKK		"MM$))$MM$&&(r/   c                    U R                   (       a-  U R                  nU R                  US9  U R                  U5        g[        R
                  R                  SU R                  R                  -  5        g)zMark a package for upgrade.)r  z4MarkUpgrade() called on a non-upgradeable pkg: '%s'
N)	rr  ry  r  	mark_autosysstderrwritery   r]   )r?   r  autos      r"   mark_upgradePackage.mark_upgrade  sZ    ))D	2NN4  JJK))..!r/   c                d    U R                   R                  R                  U R                  U5        g)zMark 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)rs   r  r  ry   )r?   r  s     r"   r  Package.mark_auto  s"     	((D9r/   c                N    U R                   R                  R                  X5        g)zCommit 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)rs   r  commit)r?   	fprogress	iprogresss      r"   r  Package.commit  s     	%%i;r/   )r5  rs   ry   )r6  z	apt.Cacher7  zapt_pkg.PackagerH   r   r   )r@   r   rH   rI   )rH   r2  )rN   r   rH   r   r   r   r  )NN)r  r  r  zthreading.Event | NonerH   r<   )rH   r   )rH   r   TF)r  rI   r  rI   rH   r   )TTT)r  rI   r  rI   r  rI   rH   r   )T)r  rI   rH   r   )r  rI   rH   r   )r  r   r  r   rH   r   )+r)   r*   r+   r,   r-   rP   rX   r_   r!  r   rB  setterrL  r]   r  rx  rM  rV  rF  r[  r_  rb  rf  ri  rm  r   rr  rv  ry  r|  r  r  r  r  r  r  r  r  r  r  r  r  r.   r'   r/   r"   r   r     s   
& 
 
 ) )   , , - -     # #&" @ @ @ @ ? ? = = B B B B 1 1 U U 	; 	; C C A A  " MQyy3Iy	yv ! ! @ @ ? ? H H))* PT))04)HL)	)4:	<r/   r   c                 	   [        S5        SSKn [        R                  " 5         [        R
                  R                  R                  5       n[        R                  " U5      nUS   n[        SUR                  -  5        [        SUR                  -  5        [        SUR                  R                  -  5        [        SUR                  R                  -  5        [        S	UR                  R                  -  5        [        S
UR                  R                  -  5        [        SUR                  R                  -  5        [        SUR                  R                   -  5        [        SUR                  R"                  -  5        [        SUR$                  -  5        [        SUR                  R&                  -  5        [        SUR                  R(                  -  5        [        SUR                  R*                  -  5        [        SUR                  R,                  -  5        [        SUR                  R.                  -  5        [        SUR                  R0                  -  5        [        SUR                  R2                  -  5        UR                  R0                   H.  n[        SR5                  S UR6                   5       5      5        M0     [        SUR                  R8                  -  5        [        SUR                  R:                  -  5        [        SUR                  R<                  5        [        US   R?                  5       5        S H  n[        SU5        U H?  nUR@                  (       d  M  U RC                  SS5      S:X  d  M.  URE                  U5        MA     [        SURF                  RH                  -  5        [        S URF                  RJ                  -  5        M     [        5         S H  n[        S!U-  5        [        R                  " U5      nURM                  5        H/  nU RC                  SS5      S:X  d  M   X&   RO                  U5        M1     [        SURF                  RH                  -  5        [        S#URF                  RR                  -  5        M     g! [P         a    [        S"U-  5         M  f = f)$z
Self-test.zSelf-test for the Package modulr   Nz	apt-utilsz	Name: %s zID: %s zPriority (Candidate): %s zPriority (Installed): %s zInstalled: %s zCandidate: %s zCandidateDownloadable: %szCandidateOrigins: %szSourcePkg: %s zSection: %s zSummary: %szDescription (formatted) :
%szDescription (unformatted):
%szInstalledSize: %s zPackageSize: %s zDependencies: %szRecommends: %s,c           	   3     #    U  H;  nUR                    S UR                   SUR                   SUR                   S3v   M=     g7f)z (z) ()N)r]   rN   r^   r   )r   os     r"   r   _test.<locals>.<genexpr>  s@      ,A 66("QYYKs1::,c!,,qI,s   AAzarch: %szhomepage: %szrec: 2vcardr  z8Running install on random upgradable pkgs with AutoFix: r  zBroken: %s zInstCount: %s z.Randomly remove some packages with AutoFix: %szError trying to remove: %s zDelCount: %s )*printrandomr   initr  r  r  
OpProgressCacher]   rM  rB  r  rL  rN   rI  r  rz  r]  rV  rt  rZ  r<  r    r  r  r   r   rF  r?  r  r  rr  randintr  r  r  
inst_countr   r  r  	del_count)r  r  rz   r{   rO   ir]   s          r"   _testr    s    

+,LLN||  ++-HIIhE

C	+
 !	)cff
	
%(>(>
>?	
%(>(>
>?	
S]]22
23	
S]]22
23	
%(B(B
BC	
 3==#8#8
89	
S]]66
67	.3;;
&'	-#--//
/0	
)CMM,E,E
EF	
*S]]-J-J
JK	
!=!=
=>	
s}}11
12	
s}}99
9:	
S]]55
56}}))HH ,, 	
 * 
*s}}11
12	.3==11
12	'3==''(	%/
'
'
)*H!LC   >>!Q'1,$$Q'  	meoo:::;!;!;;<  
G>BC		(#JJLD~~a#q(@K++A. ! 	meoo:::;o 9 99:  # @7$>?@s   R11SS__main__)r   r<   r    r   r   zapt_pkg.HashStringListrH   rI   )/r-   
__future__r   r  r   r  r  r  r  	threadingcollections.abcr   r   r   r   http.clientr   typingr	   r
   urllib.errorr   urllib.requestr   r   r   re  apt.progress.textr  apt.progress.baser   r   __all__r#   	Exceptionr%   r1   r   r  r   r   r   r   r   r   r  r)   r'   r/   r"   <module>r     s   * ) "  	 	   
  A A % % " "     >3 3:Z :H? H?VJLn% JLZ'
 '
T7WS#X 7tP( P(fM(7# M`n< n<b ;; ;;~ z	G r/   