Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/apt/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/apt/cache.pyc


2)^c@ssddlZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZddlZde
fdYZde
fdYZd	efd
YZde
fdYZd
efdYZdefdYZdefdYZdefdYZdefdYZdZdZdZedkroendS(iN(tPackage(tgettext(tAttributeDeprecatedBytfunction_deprecated_bytdeprecated_argstFetchCancelledExceptioncBseZdZRS(sAException that is thrown when the user cancels a fetch operation.(t__name__t
__module__t__doc__(((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR"stFetchFailedExceptioncBseZdZRS(s-Exception that is thrown when fetching fails.(RRR(((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR	&stUntrustedExceptioncBseZdZRS(s>Exception that is thrown when fetching fails for trust reasons(RRR(((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR
*stLockFailedExceptioncBseZdZRS(s,Exception that is thrown when locking fails.(RRR(((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR.stCachecBsZeZdZd'd'edZdZdZdZd'dZ	dZ
dZdZd	Z
d
ZdZdZeed
ZedZedZedZdZd'dZd'd'd'dZdZeedZed'ded'dZedZed'd'd'dZdZ dZ!dZ"dZ#dZ$edZ%ed Z&ed!Z'ed"Z(ed#Z)e*j+rXe,eZ-e,eZ.e/d$Z0e/d%Z1e/d&Z2e,eZ3e,eZ4e,eZ5e,eZ6e,eZ7e,e!Z8e,e"Z9nRS((sDictionary-like package cache.

    The APT cache file contains a hash table mapping names of binary
    packages to their metadata. A Cache object is the in-core
    representation of the same. It provides access to APTs idea of the
    list of available packages.

    The cache can be used like a mapping from package names to Package
    objects (although only getting items is supported). 

    Keyword arguments:
    progress -- a OpProgress object
    rootdir -- a alternative root directory. if that is given
               the system sources.list and system lists/ files are
               not read, only files relative to the given rootdir
    memonly -- build the cache in memory only
    cCsd|_d|_d|_d|_i|_tj|_t	|_
t	|_d|_d|_
|jd|j|jd|j|rtjj	ddn|rztjj|drtjtj|dntjj|drtjtj|dntjj	d|tjj	d	|d
tjj	dtjj|dd
d|j|tjn|j|dS(Nitcache_post_opentcache_post_changesDir::Cache::pkgcachets/etc/apt/apt.confs/etc/apt/apt.conf.dtDirsDir::State::statuss/var/lib/dpkg/statussDir::bin::dpkgtusrtbintdpkg(tNonet_cachet	_depcachet_recordst_listt
_callbackstweakreftWeakValueDictionaryt_weakreftsett_sett_fullnamesett_changes_countt_sorted_settconnectt_inc_changes_counttapt_pkgtconfigtostpathtexiststread_config_filetisdirtread_config_dirtjoint_check_and_create_required_dirstinit_systemtopen(tselftprogresstrootdirtmemonly((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt__init__Es:							

cCs|jd7_dS(sIncrease the number of changesiN(R (R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR#mscCsddg}ddddg}x8|D]0}tjj||s%tj||q%q%Wx>|D]6}tjj||s`t||djq`q`WdS(	sf
        check if the required apt directories/files are there and if
        not create them
        s/var/lib/dpkg/statuss/etc/apt/sources.lists
/var/lib/dpkgs	/etc/apt/s/var/cache/apt/archives/partials/var/lib/apt/lists/partialtwN(R&R'R(tmakedirsR/tclose(R0R2tfilestdirstdtf((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR-qs		

cCs5||jkr1x|j|D]
}|qWndS(s# internal helper to run a callback N(R(R0tnametcallback((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt_run_callbacksscCs|dkr!tjjj}n||_|jdtj||_	tj
|j	|_tj|j	|_
tj|_|jj|jj|jjd|_|jjttjdk|_td|_d}}t|j	j}x|j	jD]}|dk	rX|d|krX|j|t|d|}n|jr|jj|j dt!|jr|jj|j dt"qn|d7}qW|j#|jddS(	sY Open the package cache, after that it can be used like
            a dictionary
        tcache_pre_openisBuilding data structuresiidtprettyR
N($RtaptR1tbaset
OpProgresstop_progressR>R$RRtDepCacheRtPackageRecordsRt
SourceListRtread_main_listRtclearRR!Rtlentget_architecturest_have_multi_archt_toptpackagestupdatetfloatthas_versionstaddtget_fullnametTruetFalsetdone(R0R1titlasttsizetpkg((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR/s8	



	

			"
cCsy|j|SWnptk
r||jks=||jkrnt|}t||j|}|j|<|Std|nXdS(s" look like a dictionary (get key) s!The cache has no package named %rN(RtKeyErrorRRtstrRR(R0tkeyR[((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt__getitem__s
!ccsK|jdkr$t|j|_nx|jD]}||Vq.WtdS(N(R!RtsortedRt
StopIteration(R0tpkgname((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt__iter__s

cCs||jkp||jkS(N(RR(R0R^((s-/usr/lib/python2.7/dist-packages/apt/cache.pythas_keyscCs||jkp||jkS(N(RR(R0R^((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt__contains__scCs
t|jS(N(RJR(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt__len__scCs
t|jS(N(tlistR(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pytkeysscCsg}|jj}x|jjD]z}||s|jdt}y|j|j|Wqtk
rt	||}|j|<|j|qXqqW|S(s Get the marked changes R@(
Rtmarked_keepRRORTRUtappendRR\R(R0tchangesRiR[R<tpackage((s-/usr/lib/python2.7/dist-packages/apt/cache.pytget_changess
cCs(|j|jj||jdS(sUpgrade all packages.

        If the parameter *dist_upgrade* is True, new dependencies will be
        installed as well (and conflicting packages may be removed). The
        default value is False.
        N(tcache_pre_changeRtupgradeR(R0tdist_upgrade((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRos
cCs>tj|j}tj}|j||j|j|jS(s;Get the size of the packages that are required to download.(R$tPackageManagerRtAcquiretget_archivesRRtfetch_needed(R0tpmtfetcher((s-/usr/lib/python2.7/dist-packages/apt/cache.pytrequired_downloadscCs
|jjS(s8Get the size of the additional required space on the fs.(Rtusr_size(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pytrequired_spacescCst}|jj}ttjtjf}x[|jjD]M}||}|r:|j	r:|j
|kr:|j|jdt
q:q:W|S(sAReturn the packages not downloadable packages in reqreinst state.R@(RRtget_candidate_vert	frozensetR$tINSTSTATE_REINSTREQtINSTSTATE_HOLD_REINSTREQRROtdownloadablet
inst_stateRSRTRU(R0t	reqreinstRztstatesR[tcand((s-/usr/lib/python2.7/dist-packages/apt/cache.pytreq_reinstall_pkgss		 c
Cs8d}|dkr*tjjdt}ng|jD]}|js4|^q4}|r|rtddjd|Dn|j	}t}t}d}	x^|jD]S}|j
|jkrqn|jrt
}qn|	d|j|jf7}	t
}qW||jkrt|	n|r4t|	n|S(NsAPT::Get::AllowUnauthenticatedsUntrusted packages:
%ss
css|]}|jVqdS(N(tdesc_uri(t.0RX((s-/usr/lib/python2.7/dist-packages/apt/cache.pys	<genexpr>sRsFailed to fetch %s %s
(RR$R%tfind_bRVtitemst
is_trustedR
R,truntstatust	STAT_DONEt	STAT_IDLERURt
error_texttRESULT_CANCELLEDRR	(
R0Rvtallow_unauthenticatedtold_allow_unauthenticatedtitemt	untrustedtrestfailedt	transientterr_msg((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt_run_fetchers4%
 	
cCstjjdd}tj|}|dkrDtd|nzd}|dk	rdtjkrtjjd}tjjdtt	|nz#|j
||j|jst
SWd|dk	r|tjd<nX|j||SWdtj|XdS(s fetch the needed archives sDir::Cache::ArchivestlockisFailed to lock %ssAPT::Get::AllowUnauthenticatedN(R$R%tfind_dirtget_lockRRtfindRR]tintRsRRRVRR&R7(R0RvRuRtlockfileRtold_a_u((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt_fetch_archives/s$cCs|dk	r'|dk	r'tdn|dkrHtjjj}n|dkrftj|}n|j|tj	|j
|S(sFetch the archives for all packages marked for install/upgrade.

        You can specify either an :class:`apt.progress.base.AcquireProgress()`
        object for the parameter *progress*, or specify an already
        existing :class:`apt_pkg.Acquire` object for the parameter *fetcher*.

        The return value of the function is undefined. If an error occured,
        an exception of type :class:`FetchFailedException` or
        :class:`FetchCancelledException` is raised.

        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.8.0
        s'Takes a progress or a an Acquire objectN(Rt
ValueErrorRAR1ttexttAcquireProgressR$RrRRqR(R0R1RvR((s-/usr/lib/python2.7/dist-packages/apt/cache.pytfetch_archivesOs	cCsAy|j|}Wntk
r%tSXt|jo9|jSdS(s0Return whether the package is a virtual package.N(RR\RVtboolthas_providesRR(R0RbR[((s-/usr/lib/python2.7/dist-packages/apt/cache.pytis_virtual_packagems

c
Cst}|jj}y+|j|}|jr?|r?t|SWntk
rZt|SXx|jD]\}}}	|	j}
|s|	||
kre|
j	dt
}y|j|j|Wqtk
rt
||
}|j|<|j|qXqeqeWt|S(s2Return a list of all packages providing a package.
        
        Return a list of packages which provide the virtual package of the
        specified name. 

        If 'candidate_only' is False, return all packages with at
        least one version providing the virtual package. Otherwise,
        return only those packages where the candidate version
        provides the virtual package.

        If 'include_nonvirtual' is True then it will search for all
        packages providing pkgname, even if pkgname is not itself
        a virtual pkg.
        R@(RRRzRRRRgR\t
provides_listt
parent_pkgRTRURSRR(
R0Rbtcandidate_onlytinclude_nonvirtualt	providersRztvptprovidestprovidesvertversionR[R<Rl((s-/usr/lib/python2.7/dist-packages/apt/cache.pytget_providing_packagesvs$	

	
ic
Cstjjdd}tj|}|dkrDtd|n|rtjjd}tjjd}tjjd}	tjjdtjj	|tjjddtjjdd	tj
}
|
jn	|j}
z|d
krtjjj}ny|jj||
|}Wntk
rH}t|nX|rb|rbtn|SWd
tj||rtjjd|tjjd|tjjd|	nXd
S(sRun the equivalent of apt-get update.

        You probably want to call open() afterwards, in order to utilise the
        new cache. Otherwise, the old cache will be used which can lead to
        strange bugs.

        The first parameter *fetch_progress* may be set to an instance of
        apt.progress.FetchProgress, the default is apt.progress.FetchProgress()
        .
        sources_list -- Update a alternative sources.list than the default.
         Note that the sources.list.d directory is ignored in this case
        sDir::State::ListsRisFailed to lock %ssDir::Etc::sourcelistsDir::Etc::sourcepartssAPT::List-Cleanuptxxxt0N(R$R%RRRRRR&R'tabspathRGRHRRRAR1RBRRRPtSystemErrorR	R7(
R0tfetch_progresstpulse_intervaltraise_on_errortsources_listRRtold_sources_listtold_sources_list_dtold_cleanuptslistRte((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRPs<
	


cCsky|jWntk
r+|jnX|j|}y|jWntk
rf|jnX|S(s
        The first parameter *pm* refers to an object returned by
        apt_pkg.PackageManager().

        The second parameter *install_progress* refers to an InstallProgress()
        object of the module apt.progress.
        (tstartUpdatetAttributeErrortstart_updateRtfinishUpdatet
finish_update(R0Rutinstall_progressR((s-/usr/lib/python2.7/dist-packages/apt/cache.pytinstall_archivess


cCs|dkr!tjjj}n|dkrBtjjj}ntj|j}tj	|}xt
r|j|||}|j||}||j
krPn@||jkrtdn"||jkrntd||jqfW||j
kS(s!Apply the marked changes to the cache.

        The first parameter, *fetch_progress*, refers to a FetchProgress()
        object as found in apt.progress, the default being
        apt.progress.FetchProgress().

        The second parameter, *install_progress*, is a
        apt.progress.InstallProgress() object.

        The keyword-only parameter *allow_unauthenticated* specifies whether
        to allow unauthenticated downloads. If not specified, it defaults to
        the configuration option `APT::Get::AllowUnauthenticated`.
        sinstallArchives() faileds<internal-error: unknown result code from InstallArchives: %sN(RRAR1RBRtInstallProgressR$RqRRrRURRtRESULT_COMPLETEDt
RESULT_FAILEDRtRESULT_INCOMPLETEtshutdown(R0RRRRuRvR((s-/usr/lib/python2.7/dist-packages/apt/cache.pytcommits&	
cCs|jjdS(s Unmark all changes N(Rtinit(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRIscCs|jddS(s@ called internally if the cache has changed, emit a signal then RN(R>(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRscCs|jddS(sS called internally if the cache is about to change, emit
            a signal then RnN(R>(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRnscCs7||jkrg|j|<n|j|j|dS(sZ connect to a signal, currently only used for
            cache_{post,pre}_{changed,open} N(RRj(R0R<R=((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR"$scCstj|jS(sReturn an `ActionGroup` object for the current cache.

        Action groups can be used to speedup actions. The action group is
        active as soon as it is created, and disabled when the object is
        deleted or when release() is called.

        You can use the action group as a context manager, this is the
        recommended way::

            with cache.actiongroup():
                for package in my_selected_packages:
                    package.mark_install()

        This way, the action group is automatically released as soon as the
        with statement block is left. It also has the benefit of making it
        clear which parts of the code run with a action group and which
        don't.
        (R$tActionGroupR(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pytactiongroup+scCsatjjtjjd}x<tjtjj|dD]}tj|dr=t	Sq=Wt
S(sReturn True if the dpkg was interrupted
        
        All dpkg operations will fail until this is fixed, the action to
        fix the system if dpkg got interrupted is to run 
        'dpkg --configure -a' as root.
        sDir::State::statustupdatess[0-9]*(R&R'tdirnameR$R%t	find_filetlistdirR,tfnmatchRURV(R0tdpkg_status_dirR;((s-/usr/lib/python2.7/dist-packages/apt/cache.pytdpkg_journal_dirty@s	%cCs
|jjS(s7Return the number of packages with broken dependencies.(Rtbroken_count(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyROscCs
|jjS(s2Return the number of packages marked for deletion.(Rt	del_count(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pytdelete_countTscCs
|jjS(s6Return the number of packages marked for installation.(Rt
inst_count(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt
install_countYscCs
|jjS(s-Return the number of packages marked as keep.(Rt
keep_count(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR^sRwRyRN(:RRRRRVR4R#R-R>R/R_RcRdReRfRhRmRRotpropertyRwRyRRRRRRURRPRRRIRRnR"RRRRRRR$t_COMPAT_0_7Rt
_runCallbackst
getChangesRtrequiredDownloadtadditionalRequiredSpacetreqReinstallPkgst_runFetchert_fetchArchivestisVirtualPackagetgetProvidingPackagestinstallArchivestcachePostChangetcachePreChange(((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR2sn(			'		
					
	# 		$2/						tProblemResolvercBsMeZdZdZdZdZdZdZdZdZ	RS(suResolve problems due to dependencies and conflicts.

    The first argument 'cache' is an instance of apt.Cache.
    cCs"tj|j|_||_dS(N(R$RRt	_resolverR(R0tcache((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR4xscCs|jj|jdS(s'Reset the package to the default state.N(RRIt_pkg(R0Rl((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRI|scCs|jjdS(s/mark protected packages for install or removal.N(Rtinstall_protect(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRscCs|jj|jdS(s)Protect a package so it won't be removed.N(RtprotectR(R0Rl((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRscCs|jj|jdS(sMark a package for removal.N(RtremoveR(R0Rl((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRscCs+|jj|jj|jjdS(s:Resolve dependencies, try to remove packages where needed.N(RRnRtresolveR(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRs

cCs+|jj|jj|jjdS(s4Resolve dependencies, do not try to remove packages.N(RRnRtresolve_by_keepR(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRs

(
RRRR4RIRRRRR(((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRrs						tFiltercBseZdZdZRS(s Filter base class cCstS(sn Filter function, return True if the package matchs a
            filter criteria and False otherwise
        (RU(R0R[((s-/usr/lib/python2.7/dist-packages/apt/cache.pytapplys(RRRR(((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRstMarkedChangesFiltercBseZdZdZRS(s( Filter that returns all marked changes cCs'|js|js|jrtStSdS(N(tmarked_installt
marked_deletetmarked_upgradeRURV(R0R[((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRs(RRRR(((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRst
FilteredCachecBseZdZdddZdZdZdZdZdZ	dZ
dZd	Zd
Z
dZejreeZeeZee
ZnRS(
sa A package cache that is filtered.

        Can work on a existing cache or create a new one
    cCsi|dkrt||_n	||_|jjd|j|jjd|ji|_g|_dS(NRR
(RRRR"tfilter_cache_post_changet	_filteredt_filters(R0RR1((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR4s		cCs
t|jS(N(RJR(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRfscCs|j|S(N(R(R0R^((s-/usr/lib/python2.7/dist-packages/apt/cache.pyR_sccs$x|jD]}|j|Vq
WdS(N(RR(R0Rb((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRcscCs
|jjS(N(RRh(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRhscCs
||jkS(N(R(R0R^((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRdscCs
||jkS(N(R(R0R^((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRescCsXi|_xH|jD]=}x4|jD])}|j|r#d|j|j<Pq#q#WqWdS(s internal helper to refilter iN(RRRRR<(R0R[R;((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt_reapply_filters	cCs*g|_|jj||jjdS(sSet the current active filter.N(RRjRR(R0tfilter((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt
set_filters	cCs|jdS(s;Called internally if the cache changes, emit a signal then.N(R(R0((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRscCst|j|S(s)we try to look exactly like a real cache.(tgetattrR(R0R^((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt__getattr__sN(RRRRR4RfR_RcRhRdReRRRRR$RRt_reapplyFiltert	setFiltertfilterCachePostChange(((s-/usr/lib/python2.7/dist-packages/apt/cache.pyRs"
													cCs	dGHdS(Nscache pre changed((((s-/usr/lib/python2.7/dist-packages/apt/cache.pytcache_pre_changedscCs	dGHdS(Nscache post changed((((s-/usr/lib/python2.7/dist-packages/apt/cache.pytcache_post_changedscCsdGHtjttjjj}|jdt|jdt	d|kGH|d}|j
GHt|GHx-|jD]}||j
|ks|t
q|W|j|j}t|GHx|D]}|j
st
qWx6ddgD](}tjj|stj|qqWtjjddtj|j}tjtjjj}|j||ddGHt|}|jjdt|jjdt	|jj|jtt|GHx-|jD]}|||j
kst
qWt|GHd	GHtd
tjj j}|jjdt|jjdt	|jj|jtt|GHx-|jD]}|||j
kst
qWt|GHdS(sInternal test code.sCache self testRnRtaptitudes/tmp/pytests/tmp/pytest/partialsDir::Cache::Archivess.Testing filtered cache (argument is old cache)s$Testing filtered cache (no argument)R1N(!R$RRRAR1RRCR"RRR<RJRhtAssertionErrorRoRmR&R'R(tmkdirR%RRqRRrRRRRRRRRB(RR[RbRkRRuRvtfiltered((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt_testsV





t__main__(RR&RR$RARRRMtapt.deprecationRRRtapt.progress.texttIOErrorRR	R
RtobjectRRRRRRRR
R(((s-/usr/lib/python2.7/dist-packages/apt/cache.pyt<module>s.B*

I			8