D[c@sdZddlmZddlZddlZddlZddlZddlZy4ddlm Z ddl m Z ddl m Z Wn7ek rddlm Z ddlm Z m Z nXddlmZmZddlZddlZdd lmZd d d d dddfZejjdkr4eZndZdefdYZ d e!fdYZ"d e#fdYZ$d e!fdYZ%defdYZ&de!fdYZ'defdYZ(d e!fdYZ)dZ*e+dkr e*ndS(s"Functionality related to packages.i(tprint_functionN(t BadStatusLine(t HTTPError(turlopen(RR(tMappingtSequence(tgettexttBaseDependencyt DependencytOrigintPackagetRecordtVersiont VersionListicCsYtjj|rUtjj||krUt|}tj||kSWdQXndS(s(Return ``True`` if the file is the same.N(tostpathtexiststgetsizetopentapt_pkgtmd5sum(Rtsizetmd5tfobj((s//usr/lib/python2.7/dist-packages/apt/package.pyt _file_is_same4s*t FetchErrorcBseZdZRS(s(Raised when a file could not be fetched.(t__name__t __module__t__doc__(((s//usr/lib/python2.7/dist-packages/apt/package.pyR;scBseZdZdefdYZdZedZedZedZ edZ edZ d Z RS( sA single dependency.t__dstrcBs eZdZdZdZRS(sQCompare 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 ==. cCstj||rtStj|dr8tjd|Stj|drZtjd|Stj|dr|tjd|StSdS(Nts>>t=s==(tstrt__eq__tTruetFalse(tselftother((s//usr/lib/python2.7/dist-packages/apt/package.pyR"KscCs|j| S(N(R"(R%R&((s//usr/lib/python2.7/dist-packages/apt/package.pyt__ne__Ws(RRRR"R'(((s//usr/lib/python2.7/dist-packages/apt/package.pyRBs cCs ||_dS(N(t_dep(R%tdep((s//usr/lib/python2.7/dist-packages/apt/package.pyt__init__ZscCs |jjjS(sThe name of the target package.(R(t target_pkgtname(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR,]scCs|j|jjS(sThe relation (<, <=, !=, =, >=, >, ). Note that the empty string is a valid string as well, if no version is specified. (t_BaseDependency__dstrR(t comp_type(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytrelationbscCs |jjS(s\The target version or None. It is None if and only if relation is the empty string.(R(t target_ver(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytversionkscCs |jjS(sType of the dependency. This should be one of 'Breaks', 'Conflicts', 'Depends', 'Enhances', 'PreDepends', 'Recommends', 'Replaces', 'Suggests'. Additional types might be added in the future. (R(tdep_type_untranslated(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytrawtypers cCs|jjdkS(sWhether this is a PreDepends.t PreDepends(R(R2(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt pre_depend}scCs d|j|j|j|jfS(Ns=(R,R/R1R5(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt__repr__s( RRRR!R-R*tpropertyR,R/R1R3R5R6(((s//usr/lib/python2.7/dist-packages/apt/package.pyR?s   cBs&eZdZdZedZRS(sxRepresent an Or-group of dependencies. Attributes defined here: or_dependencies - The possible choices cCs$tt|j|j|dS(N(tsuperRR*textend(R%t alternatives((s//usr/lib/python2.7/dist-packages/apt/package.pyR*scCs|S(N((R%((s//usr/lib/python2.7/dist-packages/apt/package.pytor_dependenciess(RRRR*R7R;(((s//usr/lib/python2.7/dist-packages/apt/package.pyRs cBs eZdZdZdZRS(sThe 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. cCs|j|_|j|_|j|_|j|_|j|_|j|_|j|_|jjj |}|r|j rt |_ n t |_ dS(N(tarchivet componenttlabeltorigintcodenametsitet not_automatict_pcachet_listt find_indext is_trustedR#ttrustedR$(R%tpkgt packagefilet indexfile((s//usr/lib/python2.7/dist-packages/apt/package.pyR*s        cCs,d|j|j|j|j|j|jfS(NsH(R=R<R?R>RARG(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR6s  (RRRR*R6(((s//usr/lib/python2.7/dist-packages/apt/package.pyR s  cBskeZdZdZdZdZdZdZdZdZ d dZ d Z d Z RS( s"Record in a Packages file Represent a record as stored in a Packages file. You can use this like a dictionary mapping the field names of the record to their values:: >>> record = Record("Package: python-apt\nVersion: 0.8.0\n\n") >>> record["Package"] 'python-apt' >>> record["Version"] '0.8.0' For example, to get the tasks of a package from a cache, you could do:: package.candidate.record["Tasks"].split() Of course, you can also use the :attr:`Version.tasks` property. cCstj||_dS(N(Rt TagSectiont_rec(R%t record_str((s//usr/lib/python2.7/dist-packages/apt/package.pyR*scCs t|jS(N(thashRL(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt__hash__scCs t|jS(N(R!RL(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt__str__scCs |j|S(N(RL(R%tkey((s//usr/lib/python2.7/dist-packages/apt/package.pyt __getitem__scCs ||jkS(N(RL(R%RQ((s//usr/lib/python2.7/dist-packages/apt/package.pyt __contains__scCst|jjS(N(titerRLtkeys(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt__iter__sccs0x)|jjD]}||j|fVqWdS(s6An iterator over the (key, value) items of the record.N(RLRU(R%RQ((s//usr/lib/python2.7/dist-packages/apt/package.pyt iteritemsscCs|jj||S(sReturn record[key] if key in record, else *default*. The parameter *default* must be either a string or None. (RLtget(R%RQtdefault((s//usr/lib/python2.7/dist-packages/apt/package.pyRXscCs ||jkS(s deprecated form of ``key in x``.(RL(R%RQ((s//usr/lib/python2.7/dist-packages/apt/package.pythas_keyscCs t|jS(N(tlenRL(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt__len__sN(RRRR*RORPRRRSRVRWtNoneRXRZR\(((s//usr/lib/python2.7/dist-packages/apt/package.pyR s         cBs]eZdZdZdZdZdZdZdZdZ dZ d Z d Z e d Ze d Ze d Ze dZe dZe dZe dZe dZe dZe dZe dZe dZe dZe dZe dZe dZe dZdZe dZ e dZ!e dZ"e d Z#e d!Z$e d"Z%e d#Z&e d$Z'e d%Z(e d&Z)e d'Z*d(Z+e d)Z,e d*Z-d+d.d,Z/d+d.e0d-Z1RS(/sRepresentation of a package version. The Version class contains all information related to a specific package version. .. versionadded:: 0.7.9 cCs,||_||_|jjjj|dS(N(tpackaget_candRCt _weakversionstadd(R%R^tcand((s//usr/lib/python2.7/dist-packages/apt/package.pyR*s  cCsHytj|jj|jSWn$tk rCtj|jj|SXdS(N(Rtversion_compareR_tver_strR1tAttributeError(R%R&((s//usr/lib/python2.7/dist-packages/apt/package.pyt_cmps cCs0y|j|dkSWntk r+tSXdS(Ni(Rft TypeErrortNotImplemented(R%R&((s//usr/lib/python2.7/dist-packages/apt/package.pyR"s cCs0y|j|dkSWntk r+tSXdS(Ni(RfRgRh(R%R&((s//usr/lib/python2.7/dist-packages/apt/package.pyt__ge__s cCs0y|j|dkSWntk r+tSXdS(Ni(RfRgRh(R%R&((s//usr/lib/python2.7/dist-packages/apt/package.pyt__gt__s cCs0y|j|dkSWntk r+tSXdS(Ni(RfRgRh(R%R&((s//usr/lib/python2.7/dist-packages/apt/package.pyt__le__s cCs0y|j|dkSWntk r+tSXdS(Ni(RfRgRh(R%R&((s//usr/lib/python2.7/dist-packages/apt/package.pyt__lt__ s cCs0y|j|dkSWntk r+tSXdS(Ni(RfRgRh(R%R&((s//usr/lib/python2.7/dist-packages/apt/package.pyR'&s cCs |jjS(N(R_RN(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRO,scCsd|jj|jfS(Ns (R^R,R1(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR6/s cCs3|jjjj|jjdr/|jjjSdS(s=Internal helper that moves the Records to the right position.iN(R^RCt_recordstlookupR_t file_list(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRm3s"cCs;|jj}|jjjj|jjd|jjjS(s2Internal helper to get the translated description.i(R_ttranslated_descriptionR^RCRmRnRotpop(R%t desc_iter((s//usr/lib/python2.7/dist-packages/apt/package.pyt_translated_records9s "cCs |jjS(s.Return the size of the package when installed.(R_tinstalled_size(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRt@scCs |jjS(s$Return the homepage for the package.(Rmthomepage(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRuEscCs |jjS(sReturn the size of the package.(R_R(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRJscCs |jjS(s/Return the architecture of the package version.(R_tarch(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt architectureOscCst|jjS(s:Return whether the version of the package is downloadable.(tboolR_t downloadable(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRyTscCs |jjS(sReturn the version as a string.(R_Rd(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR1YscCs |jjS(s0Return the short description (one line summary).(Rst short_desc(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytsummary^scCs |jjS(s"return the long description (raw).(Rmt long_desc(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytraw_descriptioncscCs |jjS(s"Return the section of the package.(R_tsection(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR~hscCs\d}|jj}y%t|ts6|jd}nWn*tk rc}td|jj|fSXt |j d}t |x|D]}|j dkr|j ds|d7}qqn|jdr|j dsd|d }qJd |d }nF|jd rD|j ds.|dkr;|d }qJ|}n|}||7}qW|S( sReturn 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. tsutf-8s<Invalid unicode in description for '%s' (%s). Please report.s t.s s s %s is%s t i(RsR|t isinstancetunicodetdecodetUnicodeDecodeErrort_R^R,RTtsplittnexttstriptendswitht startswith(R%tdesctdscterrtlinestraw_linetline((s//usr/lib/python2.7/dist-packages/apt/package.pyt descriptionms4        cCs9y|jjp|jjSWntk r4|jjSXdS(s&Return the name of the source package.N(Rmt source_pkgR^t shortnamet IndexError(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt source_names cCs9y|jjp|jjSWntk r4|jjSXdS(s)Return the version of the source package.N(Rmt source_verR_RdR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytsource_versions cCs |jjS(s.Return the priority of the package, as string.(R_t priority_str(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytpriorityscCsQd}|jjjj}x2|jjD]$\}}t||j|}q%W|S(sReturn the internal policy priority as a number. See apt_preferences(5) for more information about what it means. i(R^RCt _depcachetpolicyR_Rotmaxt get_priority(R%RRRIt_unused((s//usr/lib/python2.7/dist-packages/apt/package.pytpolicy_prioritys cCst|jjS(sReturn 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 Rmtrecord(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRscGsg}|jj}xx|D]p}yVxO||D]C}g}x!|D]}|jt|q@W|jt|q-WWqtk rqXqW|S(s8Return a list of Dependency objects for the given types.(R_t depends_listtappendRRtKeyError(R%ttypesRtdependsttype_t dep_ver_listt base_depstdep_or((s//usr/lib/python2.7/dist-packages/apt/package.pytget_dependenciess    cCs!g|jjD]}|d^q S(s3 Return a list of names that this version provides.i(R_t provides_list(R%tp((s//usr/lib/python2.7/dist-packages/apt/package.pytprovidesscCs |jdS(s4Return the list of enhances for the package version.tEnhances(R(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytenhancesscCs|jddS(s/Return the dependencies of the package version.R4tDepends(R(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt dependenciesscCs |jdS(s-Return the recommends of the package version.t Recommends(R(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt recommendsscCs |jdS(s+Return the suggests of the package version.tSuggests(R(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytsuggestsscCs@g}x3|jjD]%\}}|jt|j|qW|S(s1Return a list of origins for the package version.(R_RoRR R^(R%toriginsRIR((s//usr/lib/python2.7/dist-packages/apt/package.pyRscCs |jjS(sZReturn the path to the file inside the archive. .. versionadded:: 0.7.10 (Rmtfilename(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRscCs |jjS(sKReturn the md5sum of the binary. .. versionadded:: 0.7.10 (Rmtmd5_hash(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRscCs |jjS(sLReturn the sha1sum of the binary. .. versionadded:: 0.7.10 (Rmt sha1_hash(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytsha1scCs |jjS(sNReturn the sha256sum of the binary. .. versionadded:: 0.7.10 (Rmt sha256_hash(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytsha256 scCst|jdjS(sGet the tasks of the package. A set of the names of the tasks this package belongs to. .. versionadded:: 0.8.0 tTask(tsetRR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyttaskssccsVxO|jjD]A\}}|jjjj|}|r |j|jjVq q WdS(sVReturn an iterator over all available urls. .. versionadded:: 0.7.10 N( R_RoR^RCRDREt archive_uriRmR(R%RIRRJ((s//usr/lib/python2.7/dist-packages/apt/package.pyt_urisscCst|jS(s^Return a list of all available uris for the binary. .. versionadded:: 0.7.10 (tlistR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyturis)scCs3ytt|jSWntk r.dSXdS(sNReturn a single URI for the binary. .. versionadded:: 0.7.10 N(RRTRt StopIterationR](R%((s//usr/lib/python2.7/dist-packages/apt/package.pyturi1s Rc Cstjj|jj}tjj||}t||j|jjrft d|tjj |St j |pt jjj}t j||j|jj|j|d|}|j|j|jkrtd|j|jfntjj |S(seFetch the binary version of the package. The parameter *destdir* specifies the directory where the package will be fetched to. The parameter *progress* may refer to an apt_pkg.AcquireProgress() object. If not specified or None, apt.progress.text.AcquireProgress() is used. .. versionadded:: 0.7.10 s"Ignoring already existing file: %stdestfiles$The item %r could not be fetched: %s(RRtbasenameRmRtjoinRRRtprinttabspathRtAcquiretapttprogressttexttAcquireProgresst AcquireFileRtruntstatust STAT_DONERRt error_text(R%tdestdirRtbaseRtacqtacqfile((s//usr/lib/python2.7/dist-packages/apt/package.pyt fetch_binary<s ! cCs<tj}tj|p'tjjj}d }|j}|j pN|j j }|j pc|j j} |j|} x(| r| |jkr|j|} qxW| std|nt} x|jD]\} } }}tjj|}tjj||}|dkr|}nt|| | r@td|qn| jtj||jj|| | |d|qW|jxB|jD]7}|j |j!krt"d|j#|j$fqqW|r(|j dtj%|j}tjj||}t&j'dd||gtjj(|Stjj(|Sd S( s[Get the source code of a package. The parameter *destdir* specifies the directory where the source will be fetched to. The parameter *progress* may refer to an apt_pkg.AcquireProgress() object. If not specified or None, apt.progress.text.AcquireProgress() is used. The parameter *unpack* describes whether the source should be unpacked (``True``) or not (``False``). By default, it is unpacked. If *unpack* is ``True``, the path to the extracted directory is returned. Otherwise, the path to the .dsc file is returned. sNo source for %rRs"Ignoring already existing file: %sRs$The item %r could not be fetched: %st-s dpkg-sources-xN()Rt SourceRecordsRRRRRR]RmRR^RRR_RdRnR1t ValueErrorRtfilesRRRRRRRRtindexRRtitemsRRRRRtupstream_versiont subprocesst check_callR(R%RRtunpacktsrcRRRRRt source_lookupRRRRRRRtitemtoutdir((s//usr/lib/python2.7/dist-packages/apt/package.pyt fetch_sourceXsB !     N(2RRRR*RfR"RiRjRkRlR'ROR6R7RmRsRtRuRRwRyR1R{R}R~RRRRRRRRRRRRRRRRRRRRRR]RR#R(((s//usr/lib/python2.7/dist-packages/apt/package.pyR sZ          /    cBseeZdZd dZdZdZdZdZdZ dZ dZ d d Z RS( sProvide 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) cCs5||_|jj|_|r1|j||_ndS(N(t_packaget_pkgt version_listt _versions(R%R^tslice_((s//usr/lib/python2.7/dist-packages/apt/package.pyR*s cCst|tr"|j|j|Syt|j|j|SWnDtk rx4|jD]%}|j|krWt|j|SqWWnXtd|dS(NsVersion: %r not found.( Rtslicet __class__RR RRgRdR(R%Rtver((s//usr/lib/python2.7/dist-packages/apt/package.pyRRs cCsd|jS(Ns(RU(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR6scsfdjDS(s*Return an iterator over all value objects.c3s!|]}tj|VqdS(N(R R(t.0R(R%(s//usr/lib/python2.7/dist-packages/apt/package.pys s(R(R%((R%s//usr/lib/python2.7/dist-packages/apt/package.pyRVscCsFt|tr|j}nx$|jD]}|j|kr%tSq%WtS(N(RR R1RRdR#R$(R%RR((s//usr/lib/python2.7/dist-packages/apt/package.pyRSs  cCst|t|kS(N(R(R%R&((s//usr/lib/python2.7/dist-packages/apt/package.pyR"scCs t|jS(N(R[R(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR\scCsg|jD]}|j^q S(s*Return a list of all versions, as strings.(RRd(R%R((s//usr/lib/python2.7/dist-packages/apt/package.pyRUscCs%y ||SWntk r |SXdS(sReturn the key or the default.N(t LookupError(R%RQRY((s//usr/lib/python2.7/dist-packages/apt/package.pyRXs  N( RRRR]R*RRR6RVRSR"R\RURX(((s//usr/lib/python2.7/dist-packages/apt/package.pyR s      cBseZdZdZdZdZdZdZeeeZedZ edZ edZ ed Z ed Z ed Zd Zed ZedZedZedZedZedZedZedZedZedZedZedZd$d$dZedZedZedZ edZ!dZ"e#e$dZ%e#e#e#d Z&e#d!Z'e#d"Z(d#Z)RS(%sRepresentation 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. cCs||_||_d|_dS(s Init the Package object RN(RRCt _changelog(R%tpcachetpkgiter((s//usr/lib/python2.7/dist-packages/apt/package.pyR*s  cCs#d|jj|jj|jjfS(Ns((RR,Rwtid(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR6scCs|j|jkS(N(R,(R%R&((s//usr/lib/python2.7/dist-packages/apt/package.pyRlscCs5|jjj|j}|dk r1t||SdS(sReturn 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(RCRtget_candidate_verRR]R (R%Rb((s//usr/lib/python2.7/dist-packages/apt/package.pyt candidates cCs:|jj|jjj|j|j|jjdS(s)Set the candidate version of the package.N(RCtcache_pre_changeRtset_candidate_verRR_tcache_post_change(R%R1((s//usr/lib/python2.7/dist-packages/apt/package.pyt__set_candidates cCs)|jjdk r%t||jjSdS(s`Return the currently installed version of the package. .. versionadded:: 0.7.9 N(Rt current_verR]R (R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt installedscCs|jjtS(s|Return the name of the package, possibly including architecture. If the package is not part of the system's preferred architecture, return the same as :attr:`fullname`, otherwise return the same as :attr:`shortname` .. versionchanged:: 0.7.100.3 As part of multi-arch, this field now may include architecture information. (Rt get_fullnameR#(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR, s cCs|jjtS(s\Return the name of the package, including architecture. .. versionadded:: 0.7.100.3(RRR$(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytfullnamescCs |jjS(sZReturn the name of the package, without architecture. .. versionadded:: 0.7.100.3(RR,(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR!scCs |jjS(snReturn a uniq ID for the package. This can be used eg. to store additional information about the pkg.(RR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR(scCs |jjS(s>Return True if the package is an essential part of the system.(Rt essential(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR/scCs |jjS(sReturn the Architecture of the package. .. versionchanged:: 0.7.100.3 This is now the package's architecture in the multi-arch sense, previously it was the architecture of the candidate version and deprecated. (RRw(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRw4scCs |jjS(s"Return the section of the package.(RR~(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR~>scCs|jjj|jS(s5Return ``True`` if the package is marked for install.(RCRtmarked_installR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyREscCs|jjj|jS(s5Return ``True`` if the package is marked for upgrade.(RCRtmarked_upgradeR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRJscCs|jjj|jS(s4Return ``True`` if the package is marked for delete.(RCRt marked_deleteR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyROscCs|jjj|jS(s2Return ``True`` if the package is marked for keep.(RCRt marked_keepR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRTscCs|jjj|jS(s! Package is marked for downgrade (RCRtmarked_downgradeR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyRYscCs|jjj|jS(s7Return ``True`` if the package is marked for reinstall.(RCRtmarked_reinstallR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR^scCs|jjdk S(s,Return ``True`` if the package is installed.N(RRR](R%((s//usr/lib/python2.7/dist-packages/apt/package.pyt is_installedcscCs|jo|jjj|jS(s-Return ``True`` if the package is upgradable.(R RCRt is_upgradableR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR hs cCs(|js|jo'|jjj|jS(sReturn ``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 RRCRt is_garbageR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pytis_auto_removablenscCs|jjj|jS(s@Return whether the package is marked as automatically installed.(RCRtis_auto_installedR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR yscCszxs|j|jfD]_}d|}y8t|d#}|jjdjdSWdQXWqtk rqqqXqWgS(sReturn a list of files installed by the package. Return a list of unicode names of the files which have been installed by this package s/var/lib/dpkg/info/%s.listtrbsutf-8u N(RRRtreadRRtEnvironmentError(R%R,RRo((s//usr/lib/python2.7/dist-packages/apt/package.pytinstalled_filess &  cCs~|jdkr|jS|dkr|js.n|jjdjdkrPd}q|jjdjdkrrd}qtd}t|tr|S|jdSn|jj }d }|jj }|jj }yt j }Wntk rnXx}|j|rn|jsqn|jj |jkr;|j}|j }Pnt j|j|dkr|j}|j }qqW|jd d } t| d kr| d}n~ |d} |jd rd |d } n|jdd } t| d krdj| d }n~ |i|d6| d6|d6|d6}tj} z*ytjd|re|jredSt|} d}dtj|}xtr|r|jrdS| j}|sPn|jd}tj||}|rt |j!dd}|r&d|kr&|jdd d }n|j"d }|r`d|kr`|jdd d }n|rt j||dkrPqn||7}qWt|dkrtd}t|ts|jd}qn||_Wnt#k r%td||f}t|tr|S|jdSt$t%fk rdtd}t|trW|S|jdSXWdtj| X|jS(s Download the changelog of the package and return it as unicode string. The parameter *uri* refers to the uri of the changelog file. It may contain multiple named variables which will be substitued. These variables are (src_section, prefix, src_pkg, src_ver). An example is the Ubuntu changelog:: "http://changelogs.ubuntu.com/changelogs/pool" \ "/%(src_section)s/%(prefix)s/%(src_pkg)s" \ "/%(src_pkg)s_%(src_ver)s/changelog" The parameter *cancel_lock* refers to an instance of threading.Lock, which if set, prevents the download. uitDebiansshttp://packages.debian.org/changelogs/pool/%(src_section)s/%(prefix)s/%(src_pkg)s/%(src_pkg)s_%(src_ver)s/changelogtUbuntusuhttp://changelogs.ubuntu.com/changelogs/pool/%(src_section)s/%(prefix)s/%(src_pkg)s/%(src_pkg)s_%(src_ver)s/changelogs$The list of changes is not availablesutf-8tmaint/itlibit:Rt src_sectiontprefixtsrc_pkgtsrc_veris^%s \((.*)\)(.*)$R1sThe 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.sOFailed to download the list of changes. Please check your Internet connection.N(&RR]RRR?RRRRRR~RRRt SystemErrorRnR1RcRR[RRtsockettgetdefaulttimeouttsetdefaulttimeouttisSetRtretescapeR#treadlinetmatchtgetattrRtgroupRtIOErrorR(R%Rt cancel_locktresRRR~Rt src_recordst section_splitRt src_ver_splitttimeouttchangelog_filet changelogtregexptline_rawRR$Rt changelog_ver((s//usr/lib/python2.7/dist-packages/apt/package.pyt get_changelogs     #                         %cCs t|S(scReturn a VersionList() object for all available versions. .. versionadded:: 0.7.9 (R (R%((s//usr/lib/python2.7/dist-packages/apt/package.pytversions/scCs|jjj|jS(s5Return True if the to-be-installed package is broken.(RCRtis_inst_brokenR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR57scCs|jjj|jS(s/Return True if the installed package is broken.(RCRt is_now_brokenR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR6<scCs|jjtjkS(s8Checks whether the package is is the config-files state.(Rt current_stateRtCURSTATE_CONFIG_FILES(R%((s//usr/lib/python2.7/dist-packages/apt/package.pythas_config_filesAscCs4|jj|jjj|j|jjdS(sMark a package for keep.N(RCRRt mark_keepRR(R%((s//usr/lib/python2.7/dist-packages/apt/package.pyR:Hs cCs|jj|jjj|j||r|jjjdkrtj|jj}|j|j|j |j|j |j|j |j n|jj dS(s+Mark a package for deletion. If *auto_fix* is ``True``, the resolver will be run, trying to fix broken packages. This is the default. If *purge* is ``True``, remove the configuration files of the package as well. The default is to keep the configuration. iN(RCRRt mark_deleteRt broken_countRtProblemResolvertcleartprotecttremovetinstall_protecttresolveR(R%tauto_fixtpurgetfix((s//usr/lib/python2.7/dist-packages/apt/package.pyR;Ns   cCs|jj|jjj|j|||r|jjjdkrtj|jj}|j|j|j |j|j t n|jj dS(s0Mark 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. iN( RCRRt mark_installRR<RR=R>R?RBR#R(R%RCt auto_instt from_usertfixer((s//usr/lib/python2.7/dist-packages/apt/package.pyRFcs cCsP|jr2|j}|jd||j|ntjjd|jjdS(sMark a package for upgrade.RHs1MarkUpgrade() called on a non-upgrable pkg: '%s' N( R R RFt mark_autotsyststderrtwriteRR,(R%RHtauto((s//usr/lib/python2.7/dist-packages/apt/package.pyt mark_upgrade{s    cCs|jjj|j|dS(sMark 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(RCRRJR(R%RN((s//usr/lib/python2.7/dist-packages/apt/package.pyRJscCs|jjj||dS(sCommit 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(RCRtcommit(R%t fprogresst iprogress((s//usr/lib/python2.7/dist-packages/apt/package.pyRPs N(*RRRR*R6RlRt_Package__set_candidateR7RR,RRRRRwR~RRRRRRR R R R RR]R3R4R5R6R9R:R#R$R;RFRORJRP(((s//usr/lib/python2.7/dist-packages/apt/package.pyR sJ         cCs}tdddl}tjtjjj}tj|}|d}td|j td|j td|j j td|j j td |j jtd |j jtd |j jtd |j jtd |j jtd|jtd|j jtd|j jtd|j jtd|j jtd|j jtd|j jtd|j jx4|j jD]&}tdjd|jDqWtd|j jtd|j jtd|j jt|djxt t!fD]}td|xB|D]:}|j"rC|j#dddkr}|j$|q}qCqCWtd|j%j&td |j%j'q)Wtxt t!fD]}td!|tj|}xf|j(D]X}|j#dddkry||j)|WqIt*k rEtd"|qIXqqWtd|j%j&td#|j%j+qWdS($s Self-test.sSelf-test for the Package moduliNs apt-utilss Name: %s sID: %s sPriority (Candidate): %s sPriority (Installed): %s sInstalled: %s sCandidate: %s sCandidateDownloadable: %ssCandidateOrigins: %ssSourcePkg: %s s Section: %s s Summary: %ssDescription (formatted) : %ssDescription (unformatted): %ssInstalledSize: %s sPackageSize: %s sDependencies: %ssRecommends: %st,css1|]'}d|j|j|j|jfVqdS(s%s (%s) (%s) (%s)N(R,R1R/R5(Rto((s//usr/lib/python2.7/dist-packages/apt/package.pys ssarch: %ss homepage: %ssrec: t2vcards8Running install on random upgradable pkgs with AutoFix: iis Broken: %s sInstCount: %s s.Randomly remove some packages with AutoFix: %ssError trying to remove: %s s DelCount: %s (,RtrandomRtinitRRRt OpProgresstCacheR,RRRRR1RyRRR~R{RR}RtRRRRR;RwRuRR3R#R$R trandintRFRR<t inst_countRUR;Rt del_count(RWRtcacheRHR)tiR,((s//usr/lib/python2.7/dist-packages/apt/package.pyt_testsd        t__main__(,Rt __future__RRRKR!RRt http.clientRt urllib.errorRturllib.requestRt ImportErrorthttplibturllib2t collectionsRRRtapt.progress.textRRRt__all__t version_infotmajorR!RRt ExceptionRtobjectRRRR R R R R R`R(((s//usr/lib/python2.7/dist-packages/apt/package.pytsF           H#:K 9