Current File : //proc/3/task/3/cwd/proc/3/root/usr/lib/python2.7/site-packages/yum/plugins.pyc
�
�v_c@sSddlZddlZddlZddlZddlZddlZddlZddlZddlTddl Z ddl m
Z
mZddlZddl
mZddlmZddlZddlmZddlmZddlmZd Zd
efd��YZdZd
Zed
�ZeefZidd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d!d#6d!d$6d!d%6d!d&6d'd(6d'd)6d*d+6d*d,6d-d.6d/d06Ze ej!��Z"d1e#fd2��YZ$d3dFd4��YZ%d5dGd6��YZ&ddHd7��YZ'de'fd8��YZ(de(fd9��YZ)de'fd:��YZ*de*fd;��YZ+de*fd<��YZ,de,fd=��YZ-de-fd>��YZ.d!e-fd?��YZ/d'e/fd@��YZ0d-e/fdA��YZ1d*e/fdB��YZ2d/e/fdC��YZ3dD�Z4dE�Z5dS(Ii����N(t*(tParsingErrortConfigParser(tConfigPreProcessor(tfill(tproxy(t_(t
utf8_widths2.7t
DeprecatedIntcBseZdZRS(sXA simple int subclass that is used to check when a deprecated
constant is used.
(t__name__t
__module__t__doc__(((s//usr/lib/python2.7/site-packages/yum/plugins.pyRDsiitConfigPluginConduittconfigtPostConfigPluginConduitt
postconfigtInitPluginConduittinittArgsPluginConduittargstDownloadPluginConduittpredownloadtpostdownloadtPreRepoSetupPluginConduittprelistenabledrepostprereposetuptPostRepoSetupPluginConduitt
postreposetupt
PluginConduittclosetcleantMainPluginConduittpretranst posttranstpreverifytranstpostverifytranstexcludetDepsolvePluginConduitt
preresolvetpostresolvetHistoryPluginConduitthistorybegint
historyendtCompareProvidersPluginConduittcompare_providerstVerifyPluginConduittverify_packaget
PluginYumExitcBs&eZdZddd�Zd�ZRS(sGException that can be raised by plugins to signal that yum should stop.tcCs||_||_dS(N(tvaluettranslation_domain(tselfR1R2((s//usr/lib/python2.7/site-packages/yum/plugins.pyt__init__os cCs*|jrtj|j|j�S|jSdS(N(R2tgettexttdgettextR1(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pyt__str__rs (R R
RR4R7(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR/lst
YumPluginscBsbeZdZdddddd�Zd�Zd�Zed��Zd�Z d�Z
d�ZRS( sManager class for Yum plugins.c Cs|sdg}n||_||_t|�|_||_d|_tjd�|_ ||_
||_|dkr~t}nt
|ttf�s�|f}ntt�g|D]}t|�^q�kr�|j jtjd�n|j|�i|_tj|jd�|jd�dS(svInitialise the instance.
@param base: The
@param searchpath: A list of paths to look for plugin modules.
@param optparser: The OptionParser instance for this run (optional).
Use to allow plugins to extend command line options.
@param types: A sequence specifying the types of plugins to load.
This should be sequnce containing one or more of the TYPE_...
constants. If None (the default), all plugins will be loaded.
@param pluginconfpath: A list of paths to look for plugin configuration
files. Defaults to "/etc/yum/pluginconf.d".
s/etc/yum/pluginconf.dsyum.verbose.YumPluginsseDeprecated constant TYPE_INTERFACE during plugin initialization.
Please use TYPE_INTERACTIVE instead.RR
N(NN(t
searchpathtpluginconfpathtweakreftbaset optparsertNonetcmdlinetloggingt getLoggertverbose_loggertdisabledPluginstenabledPluginst ALL_TYPESt
isinstancetlistttupletidtTYPE_INTERFACEtlogt
logginglevelstINFO_2t_importpluginstcmdlinestatexittregistertrun( R3R<R9R=ttypesR:tdisabledtenabledtt((s//usr/lib/python2.7/site-packages/yum/plugins.pyR4{s* +
cKs�tj|d�}|dkr1td|��nt|�}xf|j|D]W\}}|jjtj d||�|j
|\}}||||j||��qKWdS(s�Run all plugin functions for the given slot.
:param slotname: a string representing the name of the slot to
run the plugins for
:param kwargs: keyword arguments that will be simply passed on
to the plugins
sunknown slot name "%s"s$Running "%s" handler for "%s" pluginN(tSLOT_TO_CONDUITtgetR>t
ValueErrortevalt_pluginfuncsRBRKRLtDEBUG_4t_pluginsR<(R3tslotnametkwargst
conduitclstmodnametfuncRtconf((s//usr/lib/python2.7/site-packages/yum/plugins.pyRR�s
c
Csi|_i|_xtD]}g|j|<qWt�|_t�|_x]|jD]R}tjj |�spqRnx1t
tjd|��D]}|j||�q�WqRW|jr^|j
jtj�r^td�}djt
|j��}dt|�dd}d}t|jd�r-|jjj}n|j
jtjt|d |d
|d|��n|jr�xF|jD]8} | |jkrq|j
jtjtd�| �qqqqWn|`|jrxF|jD]8} | |jkr�|j
jtjtd�| �q�q�Wn|`d
S(s/Load plugins matching the given types.
s%s/*.pysLoaded plugins: s, t is: iPttermtwidthtinitial_indenttsubsequent_indentsNo plugin match for: %sN(R]R[tSLOTStsett_used_disable_plugint_used_enable_pluginR9tostpathtisdirtsortedtglobt_loadpluginRBtisEnabledForRLtDEBUG_3RtjoinRthasattrR<RetcolumnsRKRMRRCRD(
R3RStslottdirt
modulefiletkeytvaltnxtRftwc((s//usr/lib/python2.7/site-packages/yum/plugins.pyRN�sD
cCsH|dkrtSx1|D])}tj||�r|j|�tSqWtS(s; Check if this plugin has been temporary enabled/disabled. N(R>tFalsetfnmatchtaddtTrue(RatpluginstusedR~((s//usr/lib/python2.7/site-packages/yum/plugins.pyt_plugin_cmdline_match�s
c Cstjj|�\}}|jd�d}|j||j|j�rf|j||j|j�rfdS|j|�}|s�t j
|ddt jt��r�|j||j|j�r�|j
jtd�|�dSyLtj||g�\}}}ztj||||�} Wd|j�XWn=|j
jtj�rD�n|j
jtd�|�dSXt| d�s�|j
jtd �|�dStt| j�s�|j
jtd
�|| jtf�dSt| dt�}
t|
tt f�s�|
f}
nt!|
�dkrdSxR|
D]J}t"|�t"t#�krV|j
j$tj%d
|�n||krdSqW|j
j$tj&td�|�||j'kr�| |f|j'|<nt(j)td�|��xMt*D]E}|d}
t| |
�r�|j+|j,|t| |
�f�q�q�WdS(sYAttempt to import a plugin module and register the hook methods it
uses.
s.pyiNtmainRUs*Not loading "%s" plugin, as it is disabledsPlugin "%s" can't be importedtrequires_api_versions0Plugin "%s" doesn't specify required API versions1Plugin "%s" requires API %s. Supported API is %s.tplugin_typeisYPlugin "%s" uses deprecated constant TYPE_INTERFACE.
Please use TYPE_INTERACTIVE instead.sLoading "%s" pluginsFTwo or more plugins with the name "%s" exist in the plugin search patht_hook(-RmRntsplitR�RCRkRDRlt_getpluginconfR
t getOptiont
BoolOptionRRBtdebugRtimptfind_moduletload_moduleRRsRLR\terrorRvtapiveroktAPI_VERSIONR�tgetattrRERFRGRHtlenRIRJRKRMRtR]tErrorstConfigErrorRiR[tappend(R3RzRSRyRaRctfptpathnametdescriptiontmoduletplugintypest
plugintypeRxtfuncname((s//usr/lib/python2.7/site-packages/yum/plugins.pyRr�sz
cCs�x�|jD]X}tjj||d�}tj|tj�rBPn|jjtj t
d�|�q
W|jjtj t
d�|�dSt�}t
|�}y|j|�Wn2tk
r�}tjd|t|�f��nX|S(s�Parse the plugin specific configuration file and return a
IncludingConfigParser instance representing it. Returns None if there
was an error reading or parsing the configuration file.
s.confsConfiguration file %s not founds/Unable to find configuration file for plugin %ssCouldn't parse %s: %sN(R:RmRnRutaccesstR_OKRBRKRLRMRR>RRtreadfpRR�R�tstr(R3RaRytconffilenametparsert
confpp_objte((s//usr/lib/python2.7/site-packages/yum/plugins.pyR�Rs $ cCs||f|_dS(s�Set the parsed command line options so that plugins can
access them.
:param opts: a dictionary containing the values of the command
line options
:param commands: a list of command line arguments passed to yum
N(R?(R3toptstcommands((s//usr/lib/python2.7/site-packages/yum/plugins.pyt
setCmdLineksN(R R
RR>R4RRRNtstaticmethodR�RrR�R�(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR8xs, . X tDummyYumPluginscBs eZdZd�Zd�ZRS(s�This class provides basic emulation of the :class:`YumPlugins`
class. It exists so that calls to plugins.run() don't fail if
plugins aren't in use.
cOsdS(s&Do nothing. All arguments are unused.N((R3RR_((s//usr/lib/python2.7/site-packages/yum/plugins.pyRR{scOsdS(s&Do nothing. All arguments are unused.N((R3RR_((s//usr/lib/python2.7/site-packages/yum/plugins.pyR��s(R R
RRRR�(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR�vs cBs�eZdZd�Zd�Zd�Zd
d�Zd�Zd�Z d
d�Z
d
d�Zd
d �Zd
d
�Z
d
d�Zd�ZRS(sLA conduit class to transfer information between yum and the
plugin.
cCsC||_||_||_tjd�|_tjd�|_dS(Ns
yum.pluginsyum.verbose.plugin(t_parentt_baset_confR@RAtloggerRB(R3tparentR<Rc((s//usr/lib/python2.7/site-packages/yum/plugins.pyR4�s
cCs&tj|�}|jj||�dS(s�Send an info message to the logger.
:param level: the level of the message to send
:param msg: the message to send
N(RLtlogLevelFromDebugLevelRBRK(R3tleveltmsgtconverted_level((s//usr/lib/python2.7/site-packages/yum/plugins.pytinfo�scCs&tj|�}|jj||�dS(s�Send an error message to the logger.
:param level: the level of the message to send
:param msg: the message to send
N(RLtlogLevelFromErrorLevelR�RK(R3R�R�R�((s//usr/lib/python2.7/site-packages/yum/plugins.pyR��scCsi|jd|�|jjjr#tS|jjjr6tS|rIi|d6ni}t|jj|��SdS(sOReturn a yes or no response, either from assumeyes already
being set, or from prompting the user.
:param msg: the message to show to the user
:param prompt: the question to ask the user (optional); defaults to 'Is this ok [y/N]: '
:return: 1 if the response is yes, and 0 if the response is no
itpromptN( R�R�RctassumenoRt assumeyesR�tbooltuserconfirm(R3R�R�R_((s//usr/lib/python2.7/site-packages/yum/plugins.pytpromptYN�scCsddl}|jS(s8Return a string representing the current version of yum.i����N(tyumt__version__(R3R�((s//usr/lib/python2.7/site-packages/yum/plugins.pyt
getYumVersion�scCs
|jjS(s�Return the :class:`optparse.OptionParser` instance for this
execution of Yum. In the "config" and "init" slots a plugin
may add extra options to this instance to extend the command
line options that Yum exposes. In all other slots a plugin
may only read the :class:`OptionParser` instance. Any
modification of the instance at this point will have no
effect. See the
:func:`PreRepoSetupPluginConduit.getCmdLine` method for
details on how to retrieve the parsed values of command line
options.
:return: the global :class:`optparse.OptionParser` instance used by
Yum. May be None if an OptionParser isn't in use
(R�R=(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pytgetOptParser�scCs"tj|j||tj|��S(s5Read a string value from the plugin's own configuration file.
:param section: configuration file section to read
:param opt: option name to read
:param default: value to read if the option is missing
:return: string option value read, or default if option was missing
(R
R�R�tOption(R3tsectiontopttdefault((s//usr/lib/python2.7/site-packages/yum/plugins.pyt
confString�s cCs"tj|j||tj|��S(sfRead an integer value from the plugin's own configuration file.
:param section: configuration file section to read
:param opt: option name to read
:param default: value to read if the option is missing
:return: the integer option value read, or *default* if the
option was missing or could not be parsed
(R
R�R�t IntOption(R3R�R�R�((s//usr/lib/python2.7/site-packages/yum/plugins.pytconfInt�s
cCs"tj|j||tj|��S(s\Read a float value from the plugin's own configuration file.
:param section: configuration file section to read
:param opt: option name to read
:param default: value to read if the option is missing
:return: float option value read, or *default* if the option was
missing or could not be parsed
(R
R�R�tFloatOption(R3R�R�R�((s//usr/lib/python2.7/site-packages/yum/plugins.pyt confFloat�s cCs"tj|j||tj|��S(s_Read a boolean value from the plugin's own configuration file
:param section: configuration file section to read
:param opt: option name to read
:param default: value to read if the option is missing
:return: boolean option value read, or *default* if the option
was missing or could not be parsed
(R
R�R�R�(R3R�R�R�((s//usr/lib/python2.7/site-packages/yum/plugins.pytconfBool�s cCs"tj|j||tj|��S(s_Read a boolean value from the plugin's own configuration file
:param section: configuration file section to read
:param opt: option name to read
:param default: value to read if the option is missing
:return: boolean option value read, or *default* if the option
was missing or could not be parsed
(R
R�R�t
ListOption(R3R�R�R�((s//usr/lib/python2.7/site-packages/yum/plugins.pytconfList�s cCs|jjj|�dS(siRegister the name of a package to use.
:param name: the name of the package to register
N(R�trun_with_package_namesR�(R3tname((s//usr/lib/python2.7/site-packages/yum/plugins.pytregisterPackageNamesN(R R
RR4R�R�R>R�R�R�R�R�R�R�R�R�(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR�s cBs eZdZd�Zd�ZRS(s%A conduit for use in the config slot.cCs�tjdt�itjt6tjt6tjt 6tj
t6}|tkrjt
tj||||��nz|tkr�t
tj||||��nN|tkr�|||�}t
tj||�t
tj|tj|��ndS(s�Deprecated. Register a yum configuration file option.
:param name: name of the new option
:param valuetype: option type (PLUG_OPT_BOOL, PLUG_OPT_STRING, etc.)
:param where: where the option should be available in the config file
(PLUG_OPT_WHERE_MAIN, PLUG_OPT_WHERE_REPO, etc)
:param default: default value for the option if it is not set by the user
suregisterOpt() will go away in a future version of Yum.
Please manipulate config.YumConf and config.RepoConf directly.N(twarningstwarntDeprecationWarningR
R�tPLUG_OPT_STRINGR�tPLUG_OPT_INTR�t
PLUG_OPT_BOOLR�tPLUG_OPT_FLOATtPLUG_OPT_WHERE_MAINtsetattrtYumConftPLUG_OPT_WHERE_REPOtRepoConftPLUG_OPT_WHERE_ALLtInherit(R3R�t valuetypetwhereR�ttype2opttoption((s//usr/lib/python2.7/site-packages/yum/plugins.pytregisterOpts
cCs>t|jd�r%|jj|�ntjtd���dS(s�Register a new command.
:param command: the command to register
:raises: :class:`yum.Errors.ConfigError` if the registration
of commands is not supported
tregisterCommands®istration of commands not supportedN(RvR�R�R�R�R(R3tcommand((s//usr/lib/python2.7/site-packages/yum/plugins.pyR�0s(R R
RR�R�(((s//usr/lib/python2.7/site-packages/yum/plugins.pyRs cBseZdZd�ZRS(s'Conduit for use in the postconfig slot.cCs
|jjS(s�Return a dictionary containing the values of the
configuration options.
:return: a dictionary containing the values of the
configuration options
(R�Rc(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pytgetConf?s(R R
RR�(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR<scBs eZdZd�Zd�ZRS(s!Conduit for use in the init slot.cCs
|jjS(s�Return a dictionary containing the values of the
configuration options.
:return: a dictionary containing the values of the
configuration options
(R�Rc(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pyR�KscCs
|jjS(s�Return Yum's container object for all configured repositories.
:return: Yum's :class:`yum.repos.RepoStorage` instance
(R�trepos(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pytgetReposTs(R R
RR�R�(((s//usr/lib/python2.7/site-packages/yum/plugins.pyRHs cBs eZdZd�Zd�ZRS(s0Conduit for dealing with command line arguments.cCs#tj||||�||_dS(N(RR4t_args(R3R�R<RcR((s//usr/lib/python2.7/site-packages/yum/plugins.pyR4^scCs|jS(s�Return a list of the command line arguments passed to yum.
:return: a list of the command line arguments passed to yum
(R�(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pytgetArgsbs(R R
RR4R�(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR[s cBs eZdZd�Zd�ZRS(s)Conduit for use in the prererosetup slot.cCs
|jjS(s�Return parsed command line options.
:return: (options, commands) as returned by :class:`OptionParser.parse_args()`
(R�R?(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pyt
getCmdLinemscCs
|jjS(s�Return a representation of the local RPM database. This
allows querying of installed packages.
:return: a :class:`yum.rpmUtils.RpmDBHolder` instance
(R�trpmdb(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pytgetRpmDBts(R R
RR�R�(((s//usr/lib/python2.7/site-packages/yum/plugins.pyRis cBseZdZd�ZRS(s*Conduit for use in the postreposetup slot.cCs
|jjS(sVReturn group information.
:return: :class:`yum.comps.Comps` instance
(R�tcomps(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pyt getGroupss(R R
RR�(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR|scBs,eZdZdd�Zd�Zd�ZRS(s&Conduit for use in the download slots.cCs,tj||||�||_||_dS(N(RR4t_pkglistt_errors(R3R�R<Rctpkglistterrors((s//usr/lib/python2.7/site-packages/yum/plugins.pyR4�s cCs|jS(s�Return a list of package objects representing packages to be
downloaded.
:return: a list of package object representing packages to be
downloaded
(R�(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pytgetDownloadPackages�scCs|js
iS|jS(s�Return a dictionary of download errors.
:return: a dictionary of download errors. This dictionary is
indexed by package object. Each element is a list of
strings describing the error
(R�(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pyt getErrors�s N(R R
RR>R4R�R�(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR�s cBs5eZdZdd�Zd�Zd�Zd�ZRS(sbMain conduit class for plugins. Many other conduit classes
will inherit from this class.
cCs+|r|j}nd}|jjj|�S(s�Return a list of packages.
:param repo: the repo to return a packages from
:return: a list of package objects
N(RIR>R�tpkgSacktreturnPackages(R3trepotarg((s//usr/lib/python2.7/site-packages/yum/plugins.pytgetPackages�scCs|jj|�S(s Retrieve a package object from the packages loaded by Yum using
nevra information.
:param nevra: a tuple holding (name, epoch, version, release, arch)
for a package
:return: a :class:`yum.packages.PackageObject` instance (or subclass)
(R�tgetPackageObject(R3tnevra((s//usr/lib/python2.7/site-packages/yum/plugins.pytgetPackageByNevra�scCs|jjj|�dS(siDelete the given package from the package sack.
:param po: the package object to delete
N(R�tsackt
delPackage(R3tpo((s//usr/lib/python2.7/site-packages/yum/plugins.pyR�scCs
|jjS(sFReturn transaction set.
:return: the transaction set
(R�ttsInfo(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pyt getTsInfo�sN(R R
RR>R�R�RR(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR�s
cBs5eZdZdgd�Zed��Zd�ZRS(s(Conduit for use in solving dependencies.cCs,tj||||�||_||_dS(N(RR4t
resultcodetresultstring(R3R�R<Rctrescodetrestring((s//usr/lib/python2.7/site-packages/yum/plugins.pyR4�s cCs
|jjS(sDBoolean indicating if depsolving failed due to missing dependencies.(R�t_missing_requires(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pytmissing_requires�scCs&djd�|jj|j�D��S(Ns
css|]\}}||VqdS(N((t.0tprefixR�((s//usr/lib/python2.7/site-packages/yum/plugins.pys <genexpr>�s(RuR�tpretty_output_restringR(R3((s//usr/lib/python2.7/site-packages/yum/plugins.pyR�sN(R R
RR>R4tpropertyR R(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR%�scBseZdZidd�ZRS(s3Conduit to compare different providers of packages.cCs,tj||||�||_||_dS(N(RR4tpackagestreqpo(R3R�R<Rctproviders_dictR((s//usr/lib/python2.7/site-packages/yum/plugins.pyR4�s N(R R
RR>R4(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR+�scBseZdZdgd�ZRS(s4Conduit to access information about the yum history.cCs)tj||||�|jj|_dS(N(RR4R�thistory(R3R�R<RcRR((s//usr/lib/python2.7/site-packages/yum/plugins.pyR4�sN(R R
RR>R4(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR(�scBseZdZd�ZRS(sConduit to verify packages.cCs#tj||||�||_dS(N(RR4R.(R3R�R<RcR.((s//usr/lib/python2.7/site-packages/yum/plugins.pyR4�s(R R
RR4(((s//usr/lib/python2.7/site-packages/yum/plugins.pyR-�scCs+|jd�\}}t|�t|�fS(s�Parse a string representing an api version.
:param apiver: a string representing an api version
:return: a tuple containing the major and minor version numbers
t.(R�tint(tapivertmajtmin((s//usr/lib/python2.7/site-packages/yum/plugins.pytparsever�scCsLt|�}t|�}|d|dkr0dS|d|dkrHdSdS(s�Return true if API version "a" supports API version "b"
:param a: a string representing an api version
:param b: a string representing an api version
:return: whether version *a* supports version *b*
ii(R(tatb((s//usr/lib/python2.7/site-packages/yum/plugins.pyR��s((((6RmRqR�R�RPR5R@RLt constantsR
RRR�R�RttextwrapRR�R;RR�Rtyum.i18nRR�RRt TYPE_COREtTYPE_INTERACTIVERJRERWRptkeysRit ExceptionR/R8R�RRRRRRRRRR%R+R(R-RR�(((s//usr/lib/python2.7/site-packages/yum/plugins.pyt<module>s�
��.
(