\e4dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl m Z m Z m Z mZddlmZddlmZmZddlmZddlmZddlZdd lmZddlZdd lmZmZd Z d!d Z!Gd de"Z#Gdde#Z$GddZ%Gdde&e%Z'GddZ(Gdde eefZ)GddZ*Gddee*Z+GddZ,edZ-e.d k(re-yy)"z"Functionality related to packages.) annotationsN)IterableIteratorMappingSequence) BadStatusLine)Any no_type_check) HTTPError)urlopen)gettext)AcquireProgressInstallProgress)BaseDependency DependencyOriginPackageRecordVersion VersionListc tjj|rYtjj||k(r7t |5}t j |j|k(cdddSy#1swYyxYw)z(Return ``True`` if the file is the same.NF)ospathexistsgetsizeopenapt_pkgHasheshashes)rsizerfobjs -/usr/lib/python3/dist-packages/apt/package.py _file_is_samer#6sa ww~~d 5 = $Z 94>>$'..&8 9 9  9 s "A::BceZdZdZy) FetchErrorz(Raised when a file could not be fetched.N__name__ __module__ __qualname____doc__r"r%r%>s2r,r%ceZdZdZy)UntrustedErrorz/Raised when a file did not have a trusted hash.Nr&r+r,r"r.r.Bs9r,r.ceZdZdZGddeZddZddZddZe ddZ e ddZ e dd Z e dd Z e dd Ze dd Ze dd Ze ddZe ddZy)rzA single dependency.c eZdZdZddZddZy)BaseDependency.__dstraQCompare 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:tj||rytj|drtjd|Stj|drtjd|Stj|drtjd|Sy) NTz>>=z==F)str__eq__selfothers r"r7zBaseDependency.__dstr.__eq__Rsszz$&D#&zz$..D#&zz$..D#&zz$..r,c&|j| SN)r7r8s r"__ne__zBaseDependency.__dstr.__ne__^s{{5)) )r,Nr:objectreturnbool)r'r(r)r*r7r=r+r,r"__dstrr1Is   *r,rBc ||_||_yr<)_version_dep)r9versiondeps r"__init__zBaseDependency.__init__as  r,c8|jd|jSNz: rawtyperawstrr9s r"__str__zBaseDependency.__str__e,,r$++//r,czdj|j|j|j|jS)NzC)formatnamerelationrFrLrNs r"__repr__zBaseDependency.__repr__hs1T[[ II MM LL LL   r,cB|jjjS)zThe name of the target package.)rE target_pkgrSrNs r"rSzBaseDependency.namepsyy##(((r,cL|j|jjS)zThe relation (<, <=, =, !=, >=, >, '') in mathematical notation. The empty string will be returned in case of an unversioned dependency. )_BaseDependency__dstrrE comp_typerNs r"rTzBaseDependency.relationus {{499..//r,c.|jjS)avThe 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 )rE comp_type_debrNs r" relation_debzBaseDependency.relation_deb}syy&&&r,c.|jjS)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. )rE target_verrNs r"rFzBaseDependency.versionsyy###r,cg}|jj}|D]\}|j}|jjj }|j |}t||}|j|^|S)zfA list of all Version objects which satisfy this dependency. .. versionadded:: 1.0.0 ) rE all_targets parent_pkgrDpackage_pcache_rawpkg_to_pkgrappend)r9tvers_tvers_tver_pkgcachepkgtvers r"target_versionszBaseDependency.target_versionssy (, (=(=(? E$)$4$4DMM))11E&&t,C3&D LL     r,cZ|jDcgc]}|js|c}Scc}wziA list of all installed Version objects which satisfy this dep. .. versionadded:: 1.0.0 rn is_installedr9rms r"installed_target_versionsz(BaseDependency.installed_target_versions& "&!5!5K9J9JKKK((c|jr(|jd|jd|jS|jS)aString 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  )rFrSr]rNs r"rMzBaseDependency.rawstrs; <<ii[$"3"3!4Adll^D D99 r,c.|jjS)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. rEdep_type_untranslatedrNs r"rLzBaseDependency.rawtypesyy...r,c4|jjdk(S)zWhether this is a PreDepends. PreDependsrzrNs r" pre_dependzBaseDependency.pre_dependsyy..,>>r,N)rFrrGzapt_pkg.Dependencyr@Noner@r6r@z list[Version]r@rA)r'r(r)r*r6rYrHrOrUpropertyrSrTr]rFrnrtrMrLr~r+r,r"rrFs**00 ))00 ' '$$  LL(//??r,rceZdZdZ d fd Zd dZd dZed dZed dZ ed dZ ed dZ ed d Z xZ S)raMRepresent 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||||_||_yr<)superrHrD_rawtype)r9rF base_depsrL __class__s r"rHzDependency.__init__s  #  r,c8|jd|jSrJrKrNs r"rOzDependency.__str__rPr,c8ddjd|DzS)Nz, c32K|]}t|ywr<)repr.0bds r" z&Dependency.__repr__..s0Ibb0IjoinrNs r"rUzDependency.__repr__s#tyy0ID0I'IJJr,c|Sr<r+rNs r"or_dependencieszDependency.or_dependenciess r,c2djd|DS)axString 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 | c34K|]}|jywr<)rMrs r"rz$Dependency.rawstr..s3"))3srrNs r"rMzDependency.rawstrszz3d333r,c|jS)aType 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 )rrNs r"rLzDependency.rawtypes}}r,cfg}|D])}|jD]}||vs|j|+|S)zlA list of all Version objects which satisfy this Or-group of deps. .. versionadded:: 1.0.0 )rnrf)r9rgrrms r"rnzDependency.target_versionssH " 'B** 'u$LL& ' ' r,cZ|jDcgc]}|js|c}Scc}wrprqrss r"rtz$Dependency.installed_target_versionsrurv)rFrrzlist[BaseDependency]rLr6r@rr)r@rr)r'r(r)r*rHrOrUrrrMrLrnrt __classcell__)rs@r"rrs  +? JM  0K 4 4    LLr,rc eZdZdZddZddZy)raThe 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. cv|j|_|j|_|j|_|j|_|j|_|j |_|j |_|jjj|}|r|jrd|_ yd|_ yNTF) archive componentlabelorigincodenamesite not_automaticrd_list find_index is_trustedtrusted)r9rl packagefile indexfiles r"rHzOrigin.__init__+s"** $.. && !(( #,, $$ (66KK%%00= --DL DLr,c d|jd|jd|jd|jd|jd|j d S)Nz>> 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. c8tj||_yr<)r TagSection_rec)r9 record_strs r"rHzRecord.__init__\s&&z2 r,c,t|jSr<)hashrrNs r"__hash__zRecord.__hash___sDIIr,c,t|jSr<)r6rrNs r"rOzRecord.__str__b499~r,c |j|Sr<rr9keys r" __getitem__zRecord.__getitem__esyy~r,c||jvSr<rrs r" __contains__zRecord.__contains__hsdiir,cHt|jjSr<)iterrkeysrNs r"__iter__zRecord.__iter__ksDIINN$%%r,c#pK|jjD]}||j|fyw)z6An iterator over the (key, value) items of the record.N)rrrs r" iteritemszRecord.iteritemsns399>># &Ctyy~% % &s46Nc:|jj||S)zReturn record[key] if key in record, else *default*. The parameter *default* must be either a string or None. )rgetr9rdefaults r"rz Record.getss yy}}S'**r,c||jvS)z deprecated form of ``key in x``.rrs r"has_keyzRecord.has_keyzsdiir,c,t|jSr<)lenrrNs r"__len__zRecord.__len__~rr,)rr6r@rr@intr)rr6r@r6)rr?r@rAr@z Iterator[str])r@zIterable[tuple[object, str]]r<)rr6rr?r@r?)rr6r@rA)r'r(r)r*rHrrOrrrrrrrr+r,r"rrHs9&3 && + r,rceZdZdZd2dZd3dZd4dZd5dZd5dZd5dZ d5dZ d6d Z d7d Z d8d Z d8d Zed9d Zed:dZed;dZed7dZed8dZed7dZed8dZed;dZed;dZed8dZedd Z#ed?d!Z$ed@d"Z%ed@d#Z&ed@d$Z'ed@d%Z(edAd&Z)ed8d'Z*ed8d(Z+ed8d)Z,ed8d*Z-edBd+Z.dCd,Z/ed?d-Z0ed 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 ) rcfullnamerversion_comparerver_strrFAttributeError TypeErrorNotImplemented)r9r: self_name other_names r"_cmpz Version._cmps & --I//J:%Z'**4::+=+=u}}M M & &..tzz/A/A5II &%% &  &s91A.A.3A.. B<8)B$!B<$B83B<7B88B<c*|j|dk(SNrrr8s r"r7zVersion.__eq__yy1$$r,c*|j|dk\Srrr8s r"__ge__zVersion.__ge__rr,c*|j|dkDSrrr8s r"__gt__zVersion.__gt__yy!##r,c*|j|dkSrrr8s r"__le__zVersion.__le__rr,c*|j|dkSrrr8s r"__lt__zVersion.__lt__rr,cV |j|dk7S#t$r tcYSwxYwr)rrrr8s r"r=zVersion.__ne__s0 "99U#q( ( "! ! "s ((c.|jjSr<)rrrNs r"rzVersion.__hash__szzr,cL|jjd|jS)Nr5rcrSrFrNs r"rOzVersion.__str__s",,##$Adll^44r,cPd|jjd|jdS)Nz K NN6$,, < = >r,c.|jjS)zZReturn the path to the file inside the archive. .. versionadded:: 0.7.10 )rfilenamerNs r"rdzVersion.filename }}%%%r,c.|jjS)zKReturn the md5sum of the binary. .. versionadded:: 0.7.10 )rmd5_hashrNs r"md5z Version.md5rer,c.|jjS)zLReturn the sha1sum of the binary. .. versionadded:: 0.7.10 )r sha1_hashrNs r"sha1z Version.sha1s }}&&&r,c.|jjS)zNReturn the sha256sum of the binary. .. versionadded:: 0.7.10 )r sha256_hashrNs r"sha256zVersion.sha256s }}(((r,cNt|jdjS)zGet the tasks of the package. A set of the names of the tasks this package belongs to. .. versionadded:: 0.8.0 Task)setrDr&rNs r"tasksz Version.taskss!4;;v&,,.//r,c#K|jjD]^\}}|jjjj |}|s8|j |jj`yw)zVReturn an iterator over all available urls. .. versionadded:: 0.7.10 N) rrrcrdrr archive_urirrd)r9rrbrs r"_urisz Version._urissf %)JJ$8$8 D K ,,22==kJI++DMM,B,BCC Ds AA;*A;c4t|jS)z^Return a list of all available uris for the binary. .. versionadded:: 0.7.10 )listrurNs r"urisz Version.uriss DJJL!!r,cf tt|jS#t$rYywxYw)zNReturn a single URI for the binary. .. versionadded:: 0.7.10 N)r'rru StopIterationrNs r"uriz Version.uris/  TZZ\*+ +  s !$ 00Nc *| tjjdd}tjj |j j}tjj||}t||j|j jr7tjd|ztjj|S|jj d\}}|j"j$j&j)|}|sL|r |j*s>t-d|j"j.d|j0dt3|dd d |j4s t7d |j j} |s| j8st-d |ztj:|xs(t<j>j@jC} tjD| |j4| |j|| } | jG| jH| jJk7r%tMd| jNd| jPtjj|S)aCFetch 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: %srCould not fetch rx source package: Source describez  is not trustedzNo URI for this binary.8The item %r could not be fetched: No trusted hash found.destfile The item  could not be fetched: ))rconfigfind_brrbasenamerrdrr#r rloggingdebugabspathrrrcrdrrrr.rSrFgetattrr{ ValueErrorusableAcquireaptprogresstextr AcquireFilerunstatus STAT_DONEr%r error_text) r9destdirrallow_unauthenticatedbaserpfileoffsetindexracqacqfiles r" fetch_binaryzVersion.fetch_binarys* ! ($+NN$9$93U% !ww 6 6777<<. 499dmm.B.B C MM>I J77??8, , ,,Q/ v $$**55e<%%E4D4D LL%%LLE:{;  xx67 7%%% MPXX oohM#,,*;*;*K*K*MN%% 6499dX   >>W.. .##W%7%79  wwx((r,c | tjjdd}tj}tj|xs(t j jj}d}|j}|jxs|jj} |jxs|jj} |j!| } | r2| |j"k7r#|j!| } | r| |j"k7r#| st%d|zt'} |s]|j(j*sGt-d|jj.d|j"d|j(j0d|j2D]} t4j6j9| j6}t4j6j;||}| j<d k(r|}t?|| j@| jBrtEjFd |z|s$| jBjHst-d |z| jKtjL||j(jO| j6| jB| j@|| !|jQ|t%d|z|jRD]@}|jT|jVk7stYd |jZd|j\|r|jdztj^|j"z}t4j6j;||}tajbdd||gt4j6je|St4j6je|S)a9Get 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}FzNo source for %rrrxrrr,r~rrrr-z dpkg-sourcez-x)3rrr SourceRecordsrrrrrrr3rcr4r9rrrrFrrwrrr.rSrfilesrrrrtyper#r rrrrrfrrtritemsrrr%rrupstream_version subprocess check_callr)r9rrunpackrsrcrr,rDr6r: source_lookuprfilrritemoutdirs r" fetch_sourcezVersion.fetch_source4s4 ! ($+NN$9$93U% !##%oohM#,,*;*;*K*K*MN''A4<<+A+A **@djj.@.@ ;/ #++ =JJ{3M#++ =/$67 7%)=)= <<$$dllCII4F4FH  99 C77##CHH-Dww||GT2Hxx5 Xsxx< BXMN)SZZ->->$-/78 LL##II))#((3JJHH%   0  ;/$67 7II D{{dnn, }}doo7  [[3&)A)A#++)NNFWW\\'62F  ! !=$V"D E77??6* *77??3' 'r,)rcrrzapt_pkg.Versionr@r)r:r r@z int | Anyr>)r:rr@rA)r:r?r@z bool | Anyrr)r@zapt_pkg.PackageRecords)r@zapt_pkg.PackageRecords | Noner)r@ str | None)r@r)rHr6r@list[Dependency]r@z list[str])r@r)r@z list[Origin])r@zset[str]r)rNN)rr6rAcquireProgress | Noner bool | Noner@r6)rNTN) rr6rrrrArrr@r6)4r'r(r)r*rHrr7rrrrr=rrOrUrrrrrrr r r rrrFrrrr1r6r:r=rBrDrMrQrUrYr\r_rardrhrkrnrrrurxr{rrr+r,r"rrsV5 &:%%$%$" 5T--33))&&--KK""CC ''""44l**&&''NN ,,,8811>>3311&&&&''))00D""+/-1 @)@))@) + @) @)H+/-1 ^(^()^( ^( + ^( ^(r,rcdeZdZdZd ddZddZddZddZddZddZ dd Z dd Z dd Z d dd Z y)raProvide 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) Ncv||_|jj|_|r|j||_yyr<)_packagerj version_list _versions)r9rcslice_s r"rHzVersionList.__init__s2  22 !^^F3DN r,cPt|tr|j|j|S t |j|j |S#t $r=|j D]+}|j|k(st |j|ccYSYnwxYwtd|z)NzVersion: %r not found.) r#slicerrrrrrrGr9rvers r"rzVersionList.__getitem__s dE ">>$--6 6 74==$..*>? ? 7~~ 7;;$&"4==#66 7 7 /4899s"A'B9BBBc8ddjd|DzS)Nz[%s]rc32K|]}t|ywr<)r6)rrs r"rz&VersionList.__str__..s"<3s8")rrNs r"rUzVersionList.__repr__s"TYY[00r,c.fdjDS)z*Return an iterator over all value objects.c3JK|]}tj|ywr<)rr)rrr9s r"rz'VersionList.__iter__..sF s+Fs #)rrNs`r"rzVersionList.__iter__sFt~~FFr,ct|tr |j}|jD]}|j|k(syyr)r#rrFrrrs r"rzVersionList.__contains__s< dG $<> C{{d" r,c0t|t|k(Sr<)rwr8s r"r7zVersionList.__eq__sDzT%[((r,c,t|jSr<)rrrNs r"rzVersionList.__len__s4>>""r,cT|jDcgc]}|jc}Scc}w)z*Return a list of all versions, as strings.)rr)r9rs r"rzVersionList.keyss'+~~6 666s%c0 ||S#t$r|cYSwxYw)zReturn the key or the default.)rrs r"rzVersionList.gets% 9  N s  r<)rcrrz slice | Noner@r)rzint | slice | strr@r r)r@zIterator[Version])rr?r@rA)r:r r@rArr)rr6rVersion | Noner@r)r'r(r)r*rHrrOrUrrr7rrrr+r,r"rrs:&4 :>1G)# 7r,rcZeZdZdZd'dZd(dZd(dZd)dZed*dZ e jd+dZ ed*dZ ed(d Z ed(d Z ed(d Zed,d Zed-d Zd(dZed-dZed-dZed-dZed-dZed-dZed-dZed-dZed-dZed-dZed-dZed-dZed.dZ d/ d0dZed1dZed-dZ ed-dZ!ed-d Z"d2d!Z#d3d4d"Z$ d5 d6d#Z%d7d8d$Z&d7d9d%Z'd:d&Z(y);rzRepresentation 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.||_||_d|_y)zInit the Package objectrN)rjrd _changelog)r9pcachepkgiters r"rHzPackage.__init__s  r,c|jSr<rSrNs r"rOzPackage.__str__s yyr,cdj|jj|jj|jjS)Nz.)rRrjrSr rrNs r"rUzPackage.__repr__s8?FF IINN II " " IILL  r,c4|j|jkSr<rr8s r"rzPackage.__lt__syy5::%%r,c~|jjj|j}| t ||Sy)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)rdr?get_candidate_verrjr)r9rs r" candidatezPackage.candidates8||%%77 B  4& &r,c|jj|jjj|j|j |jj y)z)Set the candidate version of the package.N)rdcache_pre_changer?set_candidate_verrjrcache_post_change)r9rFs r"rzPackage.candidate sF %%' 00GMMJ &&(r,cp|jj t||jjSy)z`Return the currently installed version of the package. .. versionadded:: 0.7.9 N)rj current_verrrNs r"rzPackage.installeds. 99 ,4!6!67 7r,c8|jjdS)a}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. Trj get_fullnamerNs r"rSz Package.namesyy%%d++r,c8|jjdS)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.3FrrNs r"rzPackage.fullname-syy%%e,,r,c.|jjS)zZReturn the name of the package, without architecture. .. versionadded:: 0.7.100.3)rjrSrNs r"r4zPackage.shortname7s yy~~r,c.|jjS)znReturn a uniq ID for the package. This can be used eg. to store additional information about the pkg.)rjrrNs r"rz Package.id>s yy||r,c.|jjS)z>Return True if the package is an essential part of the system.)rj essentialrNs r"rzPackage.essentialEsyy"""r,c.|jjS)aReturn 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. )rjr rNs r"r zPackage.architectureJsyy%%%r,c`|jjj|jS)z5Return ``True`` if the package is marked for install.)rdr?marked_installrjrNs r"rzPackage.marked_install[#||%%44TYY??r,c`|jjj|jS)z5Return ``True`` if the package is marked for upgrade.)rdr?marked_upgraderjrNs r"rzPackage.marked_upgrade`rr,c`|jjj|jS)z4Return ``True`` if the package is marked for delete.)rdr? marked_deleterjrNs r"rzPackage.marked_deletee#||%%33DII>>r,c`|jjj|jS)z2Return ``True`` if the package is marked for keep.)rdr? marked_keeprjrNs r"rzPackage.marked_keepjs#||%%11$))<    4!4!4;ll$$// : ;r,c`|jjj|jS)z@Return whether the package is marked as automatically installed.)rdr?is_auto_installedrjrNs r"rzPackage.is_auto_installeds#||%%77 BBr,c`|jjj|jS)z6Return ``True`` if the package update is being phased.)rdr?phasing_appliedrjrNs r"rzPackage.phasing_applieds#||%%55dii@@r,c*|j|jfD][}d|z} t|d5}|jj dj j dcdddcSgS#1swYnxYwm#t$rYxwxYw)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.listrbrrN)rSrrreadr$r(r&OSError)r9rSrrs r"installed_fileszPackage.installed_filessIIt}}, D/$6D $%P$>>+227;AACII$OPP  PPP  s( BB BBNc^ |jdk7r |jS|js tdS||jjdjdk(rd}nW|jjdjdk(rd}n.td}t |t r|S|jd S|jj}d }|jj}|jj} tj}|j|r|js|jj|jk(r|j}|j}nNtj|j|dkDr|j}|j}|j|r |j#d d } t%| d kDr| d}~ |d} |j'd rd |dz} |j#dd } t%| d kDrdj)| d d}~ ||| ||dz}t+j,} t+j.d|r'|j1r t+j.| yt3|} d}dt5j6|z} |r'|j1r t+j.| y| j9}|sn|jd }t5j:||}|rzt=|j>dd}|rd|vr|j#dd d }|jAd }|rd|vr|j#dd d }|rtj||dkrn||z }t%|dk(r,td}t |t s|jd }||_ t+j.| |jS#t $rYQwxYw#tB$r|jjdjdk(rtd||fz}n td}t |t r|cYt+j.| S|jd cYt+j.| StDtFf$r]td}t |t r|cYt+j.| S|jd cYt+j.| SwxYw#t+j.| wxYw)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. rz$The list of changes is not availableNrDebianzshttp://packages.debian.org/changelogs/pool/%(src_section)s/%(prefix)s/%(src_pkg)s/%(src_pkg)s_%(src_ver)s/changelogUbuntuzuhttp://changelogs.ubuntu.com/changelogs/pool/%(src_section)s/%(prefix)s/%(src_pkg)s/%(src_pkg)s_%(src_ver)s/changelogrmain/rlib:) src_sectionprefixsrc_pkgsrc_verr!z^%s \((.*)\)(.*)$rFzThe 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.)$rrr"rarr#r6r$r6rr:rrrrFr SystemErrorr&rr*rsocketgetdefaulttimeoutsetdefaulttimeoutis_setr reescapereadlinematchrrgroupr rr)r9r{ cancel_lockresrrrr src_records section_splitr src_ver_splittimeoutchangelog_file changelogregexpline_rawr0rr changelog_vers r" get_changelogzPackage.get_changelogs( ??b ?? "~~;< < ;~~%%a(//8;9 ''*11X=9 >?c3'J::g....,, ..((..// 2 "//1K$$W-"**>>00K4G4GG)11G)11G**;+>+>H1L)11G)11G$$W- c1- }  !'*K    e $WQZ'F c1- }  !ggmAB/0G &   **,N .K /((+;#5#5#7N  $ $W -K") ."))G2DE"{'9'9';!|  $ $W -y .668H#$??73DHHVT2E%,DNNIt$L $ )9(1Q(?(BI(- A (SM-A,9,?,?Q,G,JM& ' 7 7 y QUV V!%I=By>Q& !"H II%i5$-$4$4W$= "+8  $ $W -u   ~ />>))!,33x?!!'*+CBCCc3'J  $ $W -::g..  $ $W -]+ /6c3'J  $ $W -::g..  $ $W - /  $ $W -sh:O;'P 8P C=P ; PP AT(T?TT'+TT)T:TTTT,ct|S)zcReturn a VersionList() object for all available versions. .. versionadded:: 0.7.9 )rrNs r"versionszPackage.versionsgs 4  r,c`|jjj|jS)z5Return True if the to-be-installed package is broken.)rdr?is_inst_brokenrjrNs r"r+zPackage.is_inst_brokenorr,c`|jjj|jS)z/Return True if the installed package is broken.)rdr? is_now_brokenrjrNs r"r-zPackage.is_now_brokentrr,cP|jjtjk(S)z8Checks whether the package is is the config-files state.)rj current_staterCURSTATE_CONFIG_FILESrNs r"has_config_fileszPackage.has_config_filesysyy&&'*G*GGGr,c|jj|jjj|j|jj y)zMark a package for keep.N)rdrr? mark_keeprjrrNs r"r3zPackage.mark_keeps> %%' ((3 &&(r,c*|jj|jjj|j||r|jjj dkDrt j|jj}|j|j|j|j|j|j|j|jjy)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. rN) rdrr? mark_deleterj broken_countrProblemResolverclearprotectremoveresolver)r9auto_fixpurgefixs r"r5zPackage.mark_deletes %%' **499e<  ..;;a?))$,,*@*@AC IIdii KK " JJtyy ! KKM &&(r,c|jj|jjj|j|||r|jjj dkDrpt j|jj}|j|j|j|j|jd|jjy)a0Mark 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. rTN) rdrr? mark_installrjr6rr7r8r9r;r)r9r< auto_inst from_userfixers r"r@zPackage.mark_installs %%' ++DIIy)L  ..;;a?++DLL,B,BCE KK " MM$)) $ MM$  &&(r,c|jr0|j}|j||j|ytj j d|jjzy)zMark a package for upgrade.)rBz4MarkUpgrade() called on a non-upgradeable pkg: '%s' N) rrr@ mark_autosysstderrwriterjrS)r9rBautos r" mark_upgradezPackage.mark_upgradesZ   ))D     2 NN4  JJ  K))..! r,cd|jjj|j|y)aMark 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)rdr?rErj)r9rIs r"rEzPackage.mark_autos" ((D9r,cP|jjj||y)aCommit 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)rdr?commit)r9 fprogress iprogresss r"rMzPackage.commits %%i;r,)rz apt.Cacherzapt_pkg.Packager@rr)r:rr@rA)r@r)rFrr@rrrr)NN)r{rrzthreading.Event | Noner@r6)r@r)r@rTF)r<rAr=rAr@r)TTT)r<rArArArBrAr@r)T)rBrAr@r)rIrAr@r)rNrrOrr@r))r'r(r)r*rHrOrUrrrsetterrrSrr4rrr rrrrrrrrrrrrrr'r)r+r-r1r3r5r@rJrErMr+r,r"rrs  &  ))  , ,--  ## &"@@@@??==BBBB11UU ; ;CCAA "MQyy3Iy yv!!@@??HH ) )*PT))04)HL) )4 : .sA66("QYYKs1::,c!,,qIsAAzarch: %sz homepage: %szrec: 2vcardrPz8Running install on random upgradable pkgs with AutoFix: rz Broken: %s zInstCount: %s z.Randomly remove some packages with AutoFix: %szError trying to remove: %s z DelCount: %s )*printrandomrinitrrr OpProgressCacherSrrr=rrFr rar6rrr1rrr rYr\rrr rrDr'rrandintr@r?r6 inst_countrr5r del_count)rYrrkrlrGirSs r"_testras +, LLN||  ++-H IIh E  C + ! )cff  % (>(> >? % (>(> >? S]]22 23 S]]22 23 % (B(B BC 3==#8#8 89 S]]66 67 .3;; &' -#--// /0 )CMM,E,E EF *S]]-J-J JK !=!= => s}}11 12 s}}99 9: S]]55 56}}))  HH,,    *s}}11 12 .3==11 12 '3==''( %/ ' ' )* = H!L (C  >>!Q'1,$$Q' ( meoo:::; !;!;;<= G  ; >BC (#JJL @D~~a#q(@$K++A. @ meoo:::; o 9 99: ;#@7$>?@s>RR54R5__main__)rr6r rrzapt_pkg.HashStringListr@rA)/r* __future__rrrrrrrF threadingcollections.abcrrrr http.clientrtypingr r urllib.errorr urllib.requestr rr r"apt.progress.textrapt.progress.baserr__all__r# Exceptionr%r.rrwrrrrrrrar'r+r,r"rns*)"  AA%%"" > 33:Z:H?H?VJLn%JLZ' ' T7WS#X 7tP(P(fM(7#M`n<n