xkd):dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddlmZddlmZmZmZmZmZmZmZmZmZmZmZddlZddlZddlm Z m!Z!dd lm"Z#d Z$d Z%Gd d e&Z'Gdde'Z(Gdde)Z*Gddee*Z+Gdde)Z,GddeeefZ-Gdde)Z.Gddee.Z/Gdde)Z0edZ1e2dkr e1dSdS) z"Functionality related to packages.)print_functionN) BadStatusLine) HTTPError)urlopen) AnyIterableIteratorListOptionalSetTupleUnion no_type_checkMappingSequence)AcquireProgressInstallProgress)gettext)BaseDependency DependencyOriginPackageRecordVersion VersionListctj|rgtj||krDt |5}t j|j|kcdddS#1swxYwYdS)z(Return ``True`` if the file is the same.NF)ospathexistsgetsizeopenapt_pkgHasheshashes)rsizer$fobjs -/usr/lib/python3/dist-packages/apt/package.py _file_is_samer(Gs w~~d9 5 5 = = $ZZ 94>$''.&8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 5sA<<BBceZdZdZdS) FetchErrorz(Raised when a file could not be fetched.N__name__ __module__ __qualname____doc__r'r*r*Ps2222r1r*ceZdZdZdS)UntrustedErrorz/Raised when a file did not have a trusted hash.Nr+r0r1r'r3r3Ts9999r1r3ceZdZdZGddeZdZdZdZe dZ e dZ e d Z e d Z e d Ze d Ze d Ze dZe dZdS)rzA single dependency.ceZdZdZdZdZdS)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 ==. ct||rdSt|drtd|St|drtd|St|drtd|SdS) NTz>>=z==F)str__eq__selfothers r'r<zBaseDependency.__dstr.__eq__dszz$&& tD#&& zz$...D#&& zz$...D#&& zz$...ur1c.|| SN)r<r=s r'__ne__zBaseDependency.__dstr.__ne__qs{{5))) )r1N)r,r-r.r/r<rBr0r1r'__dstrr6[s<      * * * * *r1rCc"||_||_dSrA)_version_dep)r>versiondeps r'__init__zBaseDependency.__init__us  r1c$|jd|jSNz: rawtyperawstrr>s r'__str__zBaseDependency.__str__z<<<55r1c Hd|jd|jd|jd|jd S)Nz=, >, '') in mathematical notation. The empty string will be returned in case of an unversioned dependency. )_BaseDependency__dstrrF comp_typerOs r'rUzBaseDependency.relations{{49.///r1c|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 )rF comp_type_debrOs r' relation_debzBaseDependency.relation_debsy&&r1c|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. )rF target_verrOs r'rGzBaseDependency.versionsy##r1cg}|j}|D]T}|j}|jjj}||}t||}||U|S)zfA list of all Version objects which satisfy this dependency. .. versionadded:: 1.0.0 ) rF all_targets parent_pkgrEpackage_pcache_rawpkg_to_pkgrappend)r>tvers_tvers_tver_pkgcachepkgtvers r'target_versionszBaseDependency.target_versionss|&&((  E#DM)1E&&t,,C3&&D LL     r1c$d|jDS)iA list of all installed Version objects which satisfy this dep. .. versionadded:: 1.0.0 c g|] }|j | Sr0 is_installed.0rns r' z. KKK9JKKKKr1rorOs r'installed_target_versionsz(BaseDependency.installed_target_versionsLK!5KKKKr1cP|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  )rGrTr^rOs r'rNzBaseDependency.rawstrs6" < !%D,=,=,=t||L L9 r1c|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. rFdep_type_untranslatedrOs r'rMzBaseDependency.rawtypesy..r1c"|jjdkS)zWhether this is a PreDepends. PreDependsrrOs r' pre_dependzBaseDependency.pre_dependsy.,>>r1N)r,r-r.r/r;rZrIrPrVpropertyrTrUr^rGrorzrNrMrr0r1r'rrXsg********4 666   ))X) 00X0 ' 'X '$$X$X LLXLX* / /X /??X???r1rceZdZdZfdZdZdZedZedZ edZ edZ ed 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 cttt||||_||_dSrA)superrrIrE_rawtype)r>rG base_depsrM __class__s r'rIzDependency.__init__s3 j$((333  r1c$|jd|jSrKrLrOs r'rPzDependency.__str__rQr1cFddd|DzS)Nz, c34K|]}t|VdSrA)reprrvbds r' z&Dependency.__repr__..s(0I0Ibb0I0I0I0I0I0Ir1joinrOs r'rVzDependency.__repr__s(#tyy0I0ID0I0I0I'I'IJJr1c|SrAr0rOs r'or_dependencieszDependency.or_dependencies s  r1c@dd|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 | c3$K|] }|jV dSrA)rNrs r'rz$Dependency.rawstr..s$33")333333r1rrOs r'rNzDependency.rawstrs%zz33d333333r1c|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 )rrOs r'rMzDependency.rawtypes }r1cZg}|D]%}|jD]}||vr||&|S)zlA list of all Version objects which satisfy this Or-group of deps. .. versionadded:: 1.0.0 )rorg)r>rhrrns r'rozDependency.target_versions,sT ' 'B* ' 'u$$LL&&& ' r1c$d|jDS)rqc g|] }|j | Sr0rsrus r'rwz8Dependency.installed_target_versions..Arxr1ryrOs r'rzz$Dependency.installed_target_versions:r{r1)r,r-r.r/rIrPrVrrrNrMrorz __classcell__)rs@r'rrs     666KKKX 4 4X 4  X   X LLXLLLLLr1rceZdZdZdZdZdS)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. c|j|_|j|_|j|_|j|_|j|_|j|_|j|_|jj |}|r|j r d|_ dSd|_ dSNTF) archive componentlabelorigincodenamesite not_automaticre_list find_index is_trustedtrusted)r>rm packagefile indexfiles r'rIzOrigin.__init__Qs"* $. & !( #, $ (6K%00==  !- !DLLL DLLLr1c hd|jd|jd|jd|jd|jd|jd 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||_dSrA)r" TagSection_rec)r> record_strs r'rIzRecord.__init__s&z22 r1c*t|jSrA)hashrrOs r'__hash__zRecord.__hash__sDIr1c*t|jSrA)r;rrOs r'rPzRecord.__str__49~~r1c|j|SrArr>keys r' __getitem__zRecord.__getitem__sy~r1c||jvSrArrs r' __contains__zRecord.__contains__sdir1cNt|jSrA)iterrkeysrOs r'__iter__zRecord.__iter__sDINN$$%%%r1c#dK|jD]}||j|fVdS)z6An iterator over the (key, value) items of the record.N)rrrs r' iteritemszRecord.iteritemssG9>>## & &Cty~% % % % % & &r1Nc8|j||S)zReturn record[key] if key in record, else *default*. The parameter *default* must be either a string or None. )rgetr>rdefaults r'rz Record.gets y}}S'***r1c||jvS)z deprecated form of ``key in x``.rrs r'has_keyzRecord.has_keysdir1c*t|jSrA)lenrrOs r'__len__zRecord.__len__rr1rA)r,r-r.r/rIrrPrrrrrrrr0r1r'rrps&333   &&&&&& ++++   r1rceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zed ZedZedZedZedZedZedZedZedZedZedZedZedZedZedZedZedZ edZ!dZ"ed Z#ed!Z$ed"Z%ed#Z&ed$Z'ed%Z(ed&Z)ed'Z*ed(Z+ed)Z,ed*Z-d+Z.ed,Z/ed-Z0d3d0Z1 d4d2Z2d/S)5rzRepresentation of a package version. The Version class contains all information related to a specific package version. .. versionadded:: 0.7.9 cj||_||_|jjj|dSrA)rd_candre _weakversionsadd)r>rdcands r'rIzVersion.__init__s2   *..t44444r1c. |jj}|jj}||krdS||krdStj|jj|jS#t$r< tj|jj|cYS#t$r tcYcYSwxYwwxYw)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 ) rdfullnamer"version_comparerver_strrGAttributeError TypeErrorNotImplemented)r>r? self_name other_names r'_cmpz Version._cmps & -I/J:%%rZ''q*4:+=u}MM M & & & &.tz/A5IIIII & & &%%%%%% &  &s9AA#A BA:7B:B BBBc4||dkSNrrr=s r'r<zVersion.__eq__yy1$$r1c4||dkSrrr=s r'__ge__zVersion.__ge__rr1c4||dkSrrr=s r'__gt__zVersion.__gt__yy!##r1c4||dkSrrr=s r'__le__zVersion.__le__rr1c4||dkSrrr=s r'__lt__zVersion.__lt__rr1cd ||dkS#t$r tcYSwxYwr)rrrr=s r'rBzVersion.__ne__sE "99U##q( ( " " "! ! ! ! "s //c|jjSrA)rrrOs r'rzVersion.__hash__s zr1c.|jjd|jS)Nr:rdrTrGrOs r'rPzVersion.__str__s,+++T\\::r1c2d|jjd|jdS)Nz desc_iters r'_translated_recordszVersion._translated_recordssPJ5 <  ( / / 0C0G0G0J0J K K 1<'0 0tr1c|jjS)z.Return the size of the package when installed.)rinstalled_sizerOs r'rzVersion.installed_sizesz((r1c|jjS)z$Return the homepage for the package.)rhomepagerOs r'rzVersion.homepage!s}%%r1c|jjS)zReturn the size of the package.)rr%rOs r'r%z Version.size'zr1c|jjS)z/Return the architecture of the package version.)rarchrOs r' architecturezVersion.architecture-rr1c4t|jjS)z:Return whether the version of the package is downloadable.)boolr downloadablerOs r'rzVersion.downloadable3sDJ+,,,r1cV|jj}|duo|jj|jjkS)zkReturn wether this version of the package is currently installed. .. versionadded:: 1.0.0 N)rd installedrid)r>inst_vers r'rtzVersion.is_installed9s,<)t#J(9TZ](JJr1c|jjS)zReturn the version as a string.)rrrOs r'rGzVersion.versionCz!!r1c&|j}||jndS)z0Return the short description (one line summary).N)r short_desc)r>recordss r'summaryzVersion.summaryIs*%,%8w!!dBr1c|jjS)z"return the long description (raw).)r long_descrOs r'raw_descriptionzVersion.raw_descriptionPs}&&r1c|jjS)z"Return the section of the package.)rsectionrOs r'rzVersion.sectionVrr1cd}|j}||jnd}|std|jjzS t |t s|d}n5#t$r(}td|jj|fzcYd}~Sd}~wwxYwt| d}t||D]}| dkr| ds|dz }5|d r1| dsd |d dz}nNd |d dz}n@|d r)| ds|dkr |dd}n|}n|}||z }|S)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-8zdescrdscerrlinesraw_linelines r' descriptionzVersion.description\s*#*#6gD EFF !  )c3'' *jj))! ) ) )Q"C() ) ) ) ) ) ) ) SYYt__%% U   H~~3&&}}T**#FND""4(( }}T**1#hqrrl2DD!HQRRL0DD$$S)) ==&&$$"**#ABBtypesrBdependstype_ dep_ver_listrdep_ors r'get_dependencieszVersion.get_dependenciess *)  E $+ENLLL "I".GG!((f)E)EFFFF '' 4E(J(JKKKK L     sAA.. A;:A;c.d|jjDS)z2Return a list of names that this version provides.cg|] }|d S)rr0)rvps r'rwz$Version.provides..s777!777r1)r provides_listrOs r'provideszVersion.providess87dj67777r1c,|dS)z4Return the list of enhances for the package version.EnhancesrIrOs r'enhanceszVersion.enhances$$Z000r1c.|ddS)z/Return the dependencies of the package version.rDependsrQrOs r' dependencieszVersion.dependenciess$$\9===r1c,|dS)z-Return the recommends of the package version. RecommendsrQrOs r' recommendszVersion.recommendss$$\222r1c,|dS)z+Return the suggests of the package version.SuggestsrQrOs r'suggestszVersion.suggestsrSr1c~g}|jjD]-\}}|t|j|.|S)z1Return a list of origins for the package version.)rrrgrrd)r>originsr_unuseds r'r^zVersion.originssH$(J$8 > > K NN6$, << = = = =r1c|jjS)zZReturn the path to the file inside the archive. .. versionadded:: 0.7.10 )rfilenamerOs r'razVersion.filename}%%r1c|jjS)zKReturn the md5sum of the binary. .. versionadded:: 0.7.10 )rmd5_hashrOs r'md5z Version.md5rbr1c|jjS)zLReturn the sha1sum of the binary. .. versionadded:: 0.7.10 )r sha1_hashrOs r'sha1z Version.sha1s}&&r1c|jjS)zNReturn the sha256sum of the binary. .. versionadded:: 0.7.10 )r sha256_hashrOs r'sha256zVersion.sha256s}((r1cZt|jdS)zGet the tasks of the package. A set of the names of the tasks this package belongs to. .. versionadded:: 0.8.0 Task)setr@r"rOs r'tasksz Version.tasks s%4;v&,,..///r1c#K|jjD]L\}}|jjj|}|r!||jjVMdS)zVReturn an iterator over all available urls. .. versionadded:: 0.7.10 N) rrrdrerr archive_urirra)r>rr_rs r'_urisz Version._uris+ss %)J$8 D D K ,2==kJJI D++DM,BCCCCC D Dr1cDt|S)z^Return a list of all available uris for the binary. .. versionadded:: 0.7.10 )listrrrOs r'urisz Version.uris6sDJJLL!!!r1c tt|S#t$rYdSwxYw)zNReturn a single URI for the binary. .. versionadded:: 0.7.10 N)r#rrr StopIterationrOs r'uriz Version.uri?sG TZZ\\**++ +   44 s -0 >>rNc n| tjdd}tj|jj}tj||}t||j |jj r6tj d|ztj|S|jjd\}}|jjj|}|s@|r|js7t-d|jjd|jdt3|d d d |jst7d |jj } |s| jst-d |ztj|p"t<jj !} tj"| |j| |j ||} | #| j$| j%krtMd| j'd| j(tj|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 NAPT::Get::AllowUnauthenticatedF"Ignoring already existing file: %srCould not fetch r} 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: ))r"configfind_brrbasenamerrarr(r%r$loggingdebugabspathrrrdrerrrr3rTrGgetattrrx ValueErrorusableAcquireaptprogresstextr AcquireFilerunstatus STAT_DONEr*r error_text) r>destdirrallow_unauthenticatedbaserpfileoffsetindexr$acqacqfiles r' fetch_binaryzVersion.fetch_binaryKs/" ! ($+N$9$93U%% !w 6777<<.. 49dm.B C C - M>I J J J7??8,, , ,Q/ v $*55e<<% % E4D  .L%%%LLLE:z::::  x 8677 7%%   MPXX ohM#,*;*K*K*M*MNN% 649dX     >W. . .*###W%7%79  wx(((r1Tc | tjdd}tj}tj|p"t jj}d}|j }|j p |j j } |j p |jj} || } | r-| |jkr"|| } | r | |jk"| st%d|zt'} |s>|jjs2t-d|j jd|jd|jjd|jD]} t4j| j}t4j||}| jd kr|}t?|| j | j!rtEj#d |z|s| j!j$st-d |z| %tj&||j'| j| j!| j || |(|t%d|z|j)D]1}|j*|j+krtYd |j-d|j.2|r{|j dztj/|jz}t4j||}taj1dd||gt4j2|St4j2|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`. NrzFzNo source for %rr|r}r}rr(r{rrrr-z dpkg-sourcez-x)3r"rr SourceRecordsrrrrrrr/rdr0r5rrrrGrrtrrr3rTr~filesrrrrtyper(r%r$rrrrgrrqritemsrrr*rrupstream_version subprocess check_callr)r>rrunpackrsrcrr(r@r2r6 source_lookuprfilrritemoutdirs r' fetch_sourcezVersion.fetch_sourcesS. ! ($+N$9$93U%% !#%%ohM#,*;*K*K*M*MNN'A4<+A *@dj.@ ;//  4#+ = =JJ{33M 4#+ = = 8/$677 7% )=  .<$$$dlllCI4F4F4FH  9  C7##CH--Dw||GT22Hx5  Xsx<<  BXMNNN) SZ-> $-/78 LL#I))#(33JH%       ;/$677 7I  D{dn,, j}}}doo7-  ([3&)A#+)N)NNFW\\'622F  !=$V"D E E E7??6** *7??3'' 'r1)rNN)rNTN)3r,r-r.r/rIrr<rrrrrBrrPrVrrrrrr%rrrtrGrrrr-r2r6r9r>r@rIrNrRrVrYr\r^rarerhrkrorrrurxrrr0r1r'rrsl555 &&&<%%%%%%$$$%%%$$$""";;;VVV--X-X))X) &&X& X X --X- KKXK""X" CCXC ''X' ""X" 55X5n**X*&&X&''X' NNXN,,X,.88X8 11X1 >>X> 33X3 11X1 X&&X&&&X&''X'))X)00X0 D D D""X"  X <)<)<)<)~MQ[([([([([([(r1rcReZdZdZd dZdZdZdZdZdZ d Z d Z d Z d d Z dS)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) Ncb||_|jj|_|r|j||_dSdSrA)_packagerk version_list _versions)r>rdslice_s r'rIzVersionList.__init__s9  2  4!^F3DNNN 4 4r1cDt|tr||j|S t |j|j|S#t $r1|jD]&}|j|krt |j|ccYS'YnwxYwtd|z)NzVersion: %r not found.) rslicerrrrrrrCr>rvers r'rzVersionList.__getitem__s dE " " 7>>$-66 6 74=$.*>?? ? 7 7 7~ 7 7;$&&"4=#6666666' 7 7 7 /48999sA5B  B  B cFddd|DzS)Nz[%s]rc34K|]}t|VdSrA)r;rvrs r'rz&VersionList.__str__..s("<"<3s88"<"<"<"<"<")rrOs r'rVzVersionList.__repr__s"TYY[[00r1c*fdjDS)z*Return an iterator over all value objects.c3BK|]}tj|VdSrA)rr)rvrr>s r'rz'VersionList.__iter__..s/FF s++FFFFFFr1rrOs`r'rzVersionList.__iter__s"GFFFt~FFFFr1cnt|tr|j}|jD]}|j|krdSdSr)rrrGrrrs r'rzVersionList.__contains__sJ dG $ $   C{d""tt#ur1cBt|t|kSrA)rtr=s r'r<zVersionList.__eq__)sDzzT%[[((r1c*t|jSrA)rrrOs r'rzVersionList.__len__-s4>"""r1c$d|jDS)z*Return a list of all versions, as strings.cg|] }|j Sr0)rrs r'rwz$VersionList.keys..6s666 666r1rrOs r'rzVersionList.keys3s76t~6666r1c8 ||S#t$r|cYSwxYw)zReturn the key or the default.)rrs r'rzVersionList.get8s5 9    NNN s  rA)r,r-r.r/rIrrPrVrrr<rrrr0r1r'rrs&4444::: >>>111GGG )))### 777 r1rcheZdZdZdZdZdZdZedZ e j dZ edZ ed Z ed Z ed Zed Zed ZdZedZedZedZedZedZedZedZedZedZedZedZd(dZedZedZedZ edZ!d Z"d)d#Z#d*d$Z$d+d%Z%d+d&Z&d'Z'dS),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. c0||_||_d|_dS)zInit the Package objectrN)rkre _changelog)r>pcachepkgiters r'rIzPackage.__init__Is  r1c|jSrArTrOs r'rPzPackage.__str__Ps yr1cVd|jjd|jjd|jjdS)Nzrs r' candidatezPackage.candidate`s9|%77 BB  4&& &tr1c|j|jj|j|j|jdS)z)Set the candidate version of the package.N)recache_pre_changer;set_candidate_verrkrcache_post_change)r>rGs r'rzPackage.candidatensQ %%''' 00GMJJJ &&(((((r1cR|jjt||jjSdS)z`Return the currently installed version of the package. .. versionadded:: 0.7.9 N)rk current_verrrOs r'r zPackage.installedvs) 9 ,4!677 7tr1c6|jdS)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. Trk get_fullnamerOs r'rTz Package.namesy%%d+++r1c6|jdS)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.3FrrOs r'rzPackage.fullnamesy%%e,,,r1c|jjS)zZReturn the name of the package, without architecture. .. versionadded:: 0.7.100.3)rkrTrOs r'r0zPackage.shortnames y~r1c|jjS)znReturn a uniq ID for the package. This can be used eg. to store additional information about the pkg.)rkr rOs r'r z Package.ids y|r1c|jjS)z>Return True if the package is an essential part of the system.)rk essentialrOs r'rzPackage.essentialsy""r1c|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. )rkrrOs r'rzPackage.architecturesy%%r1cJ|jj|jS)z5Return ``True`` if the package is marked for install.)rer;marked_installrkrOs r'rzPackage.marked_install|%44TY???r1cJ|jj|jS)z5Return ``True`` if the package is marked for upgrade.)rer;marked_upgraderkrOs r'rzPackage.marked_upgraderr1cJ|jj|jS)z4Return ``True`` if the package is marked for delete.)rer; marked_deleterkrOs r'rzPackage.marked_delete|%33DI>>>r1cJ|jj|jS)z2Return ``True`` if the package is marked for keep.)rer; marked_keeprkrOs r'rzPackage.marked_keeps|%11$)<<rTrrs r'installed_fileszPackage.installed_files sIt},  D/$6D $%%H$>>++227;;AA$GGHHHHHHHHHHHHHHHHHHH#     s4A<:A0! A<0A4 4A<7A4 8A<< B B Nc |jdkr|jS|jstdS|w|jjdjdkrd}nY|jjdjdkrd}n;td}t |t r|S|d S|jj}d }|jj }|jj } tj }| |rm|js|jj |jkr|j}|j }nAtj|j|dkr|j}|j }| |mn#t $rYnwxYw|d d } t%| d kr| d}~ |d} |d r d |dz} |dd } t%| d krd| d d}~ ||| ||dz}t+j} t+jd|r+|r t+j| dSt3|} d}dt5j|z} |r+|r t+j| dS| }|sn|d }t5j||}|rt=|jdd}|r d|vr|dd d }| d }|r d|vr|dd d }|rtj||dkrn||z }t%|dkr9td}t |t s|d }||_n#tB$r|jjdjdkrtd||fz}ntd}t |t r|cYt+j| S|d cYt+j| StDtFf$rhtd}t |t r|cYt+j| S|d cYt+j| SwxYw t+j| n#t+j| wxYw|jS)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_verrz^%s \((.*)\)(.*)$TrGzThe 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.)$rrrr^rrr;r r2rr6r"rrrGr SystemErrorr"rr&rsocketgetdefaulttimeoutsetdefaulttimeoutis_setrreescapereadlinematchrr grouprIOErrorr)r>rx cancel_lockresrrrr  src_records section_splitr src_ver_splittimeoutchangelog_file changelogregexpline_rawr,rr  changelog_vers r' get_changelogzPackage.get_changelogs& ?b ? "~ =;<< < ;~%a(/8;;9 '*1X==9 >??c3''/J::g...., .(./ 2 "/11K$$W-- 2"*>0K4GGG)1G)1G*;+>HH1LL)1G)1G$$W-- 2    D   c1-- }   ! !'*K    e $ $ (WQZ'F c1-- }   ! !ggmABB/00G &    *,,N .K /(+++;#5#5#7#7N  $W - - - - -K") .")G2D2DE&""{'9'9';';"!|  $W - - - - -y .6688H#$??733DHVT22E"%,DNIt$L$L $C )9)9(1Q(?(?(BI(- A (KSM-A-A,9,?,?Q,G,G,JM&" ' 7 y Q QUV V V!%I=&By>>Q&& !"H I II%i55>$-$4$4W$=$= "+ / / />)!,3x??!!'*+CCBCCCc3''/JJ  $W - - - -::g....  $W - - - -]+ / / /6c3''/JJ  $W - - - -::g....  $W - - - - /% 8  $W - - - -F $W - - - -sn E E,+E,/*O00?O0D(O0.T"0A T T"&T ;T"6T T"T 2T"T  T""T8c t|S)zcReturn a VersionList() object for all available versions. .. versionadded:: 0.7.9 )rrOs r'versionszPackage.versionss4   r1cJ|jj|jS)z5Return True if the to-be-installed package is broken.)rer;is_inst_brokenrkrOs r'r$zPackage.is_inst_brokenrr1cJ|jj|jS)z/Return True if the installed package is broken.)rer; is_now_brokenrkrOs r'r&zPackage.is_now_brokenrr1c6|jjtjkS)z8Checks whether the package is is the config-files state.)rk current_stater"CURSTATE_CONFIG_FILESrOs r'has_config_fileszPackage.has_config_filessy&'*GGGr1c|j|jj|j|jdS)zMark a package for keep.N)rerr; mark_keeprkrrOs r'r,zPackage.mark_keepsM %%''' ((333 &&(((((r1TFc|j|jj|j||r|jjjdkrt j|jj}||j| |j| |j| |j dS)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) rerr; mark_deleterk broken_countr"ProblemResolverclearprotectremoveresolver)r>auto_fixpurgefixs r'r.zPackage.mark_deletes %%''' **49e<<<   .;a??)$,*@AAC IIdi KK " " " JJty ! ! ! KKMMM &&(((((r1c|j|jj|j|||r||jjjdkrgt j|jj}||j| |j| d|j dS)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) rerr; mark_installrkr/r"r0r1r2r4r)r>r5 auto_inst from_userfixers r'r9zPackage.mark_installs %%''' ++DIy)LLL   .;a??+DL,BCCE KK " " " MM$) $ $ $ MM$    &&(((((r1c|jr4|j}||||dStjd|jjzdS)zMark a package for upgrade.)r;z4MarkUpgrade() called on a non-upgradeable pkg: '%s' N) rrr9 mark_autosysstderrwriterkrT)r>r;autos r' mark_upgradezPackage.mark_upgrade's{   )D     2 2 2 NN4  J  K).!     r1cP|jj|j|dS)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)rer;r>rk)r>rBs r'r>zPackage.mark_auto5s' ((D99999r1cF|jj||dS)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)rer;commit)r> fprogress iprogresss r'rFzPackage.commit?s% %%i;;;;;r1)NNTF)TTT)T)(r,r-r.r/rIrPrVrrrsetterr rTrr0r rrrrrrrrrtrrrrr r"r$r&r*r,r.r9rCr>rFr0r1r'rrAsy   &&&  X )))X , ,X ,--X-XX##X# &&&$@@X@ @@X@ ??X? ==X= BBXB BBXB 11X1 UUXU  ; ;X ;CCXCX"xxxxt!!X!@@X@ ??X? HHXH)))))))*))))2    :::: < < < < .isW()vvvqyyy!***alllSr1zarch: %sz homepage: %szrec: 2vcardrIz8Running 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 )*printrandomr"initrrr OpProgressCacherTr rr9r rGrr^r2rrr-rrr%rVrYrrrrr@r rrandintr9r;r/ inst_countrr.r  del_count)rRrrlrmrHirTs r'_testrZLsY +,,,MMM LNNN| ++--H Ih  E  C + !!! )cf  % (> >??? % (> >??? S]2 2333 S]2 2333 % (B BCCC 3=#8 8999 S]6 6777 .3; &''' -#-/ /000 )CM,E EFFF *S]-J JKKK != =>>> s}1 1222 s}9 9::: S]5 5666})   HH,       *s}1 1222 .3=1 1222 '3='((( %/ ' ' ) )*** == H!LLL ( (C  (>>!Q''1,,$$Q''' meo::;;; !;;<<<< GGG  ; ; >BCCC (##JJLL @ @D~~a##q((@$K++A...."@@@7$>?????@) meo::;;; o 99:::: ; ;sO99PP__main__)3r/ __future__rrrr?rr r threading http.clientr urllib.errorrurllib.requestrtypingrrr r r r r rrrrr"apt.progress.textrapt.progress.baserrrr__all__r( Exceptionr*r3objectrrrrrrrrZr,r0r1r'rgs*)(%%%%%% %%%%%%""""""""""""                           !  33333333:::::Z:::V?V?V?V?V?VV?V?V?rPLPLPLPLPLn%PLPLPLf) ) ) ) ) V) ) ) XAAAAAWS#X AAAHp(p(p(p(p(fp(p(p(fWWWWW(7#WWWtH<H<H<H<H