Viewing File: /usr/share/yum-cli/shell.pyc

ó
šv_c@s˜dZddlZddlZddlZddlZddlmZddlTddlj	Z	ddl
mZddlZdej
fd„ƒYZdS(s<
A shell implementation for the yum command line interface.
i’’’’N(tErrors(t*(tto_utf8tYumShellcBs¹eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
d„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(s.A class to implement an interactive yum shell.cCsåtjj|ƒ||_d|_d|_|jd7_t|_dg|_	t
|jƒdkrw|jd|_nddddd	d
ddg|_
|j
|jjjƒ|_tjd
ƒ|_tjdƒ|_g|_dS(Ns> it-s
Leaving Shelltrepot
repositorytexittquittrunttsttransactiontconfigsyum.clisyum.verbose.cli(tcmdtCmdt__init__tbasetprompttresultt
identcharstFalset	from_filet
resultmsgstlentextcmdstfiletshell_specific_commandstyum_cli_commandstkeystcommandlisttloggingt	getLoggertloggertverbose_loggert_shell_history_cmds(tselfR((s/usr/share/yum-cli/shell.pyR#s				cCs'|jjjsdS|jj|ƒdS(N(Rtconfthistory_recordR"tappend(R#tcmds((s/usr/share/yum-cli/shell.pyt_shell_history_add_cmds7scCsng}|dkr|Sytj|ƒ}Wn>tk
ri}|jjd|ƒ|jrjtjd‚qjnX|S(s@split the input using shlex rules, and error or exit accordinglysScript Error: %ssFatal error in script, exitingN(	tNonetshlextsplitt
ValueErrorR tcriticalRRtYumBaseError(R#tinput_stringtinputste((s/usr/share/yum-cli/shell.pyt_shlex_split=s	csut‰tj‰ˆj‰‡‡‡fd†}|t_ytjj|||Ž}Wnˆt_‚nXˆt_|S(s Sick hack for readline. cs(ˆt_ˆt|ƒƒ}ˆt_|S(N(tsyststdoutR(Rtrret(t_ostdoutt
oraw_inputtowriter(s/usr/share/yum-cli/shell.pyt_sick_hack_raw_inputTs		(t	raw_inputR3R4tstreamt__builtin__R
Rtcmdloop(R#targstkwargsR9tcret((R6R7R8s/usr/share/yum-cli/shell.pyR=Ms					cCsŒyt|jdƒ}Wn%tk
r=tjd|jƒnX|jƒ}|jƒt|_x|D]}|j	|ƒqdW|j	dƒtS(sķExecute a script file in the yum shell.  The location of
        the script file is supplied by the :class:`cli.YumBaseCli`
        object that is passed as a parameter to the :class:`YumShell`
        object when it is created.
        trs!Error: Cannot open %s for readingtEOF(
topenRtIOErrorR3Rt	readlinestclosetTrueRtonecmd(R#tfdtlinestline((s/usr/share/yum-cli/shell.pytscriptgs

	

cCsrd|_t|ƒdkr4|jƒddkr4n:|j|ƒ\}}}||jkr”|g}|jjjdd|ƒ|d|kr”|jdƒt	Sn|dkr±dS||j_
|jj
jddƒ|j_
|j|jj
ƒ|j_
|jjjdd|jj
ƒ|j|jj
ƒy|jjƒWntjk
rOnX|jjƒ\}}||_dS(sHandle the next line of input if there is not a dedicated
        method of :class:`YumShell` to handle it.  This method will
        handle yum commands that are not unique to the shell, such as
        install, erase, etc.

        :param line: the next line of input
        it#R>ttshellNs
(RRtstript	parselineRRtpluginsR	tdo_helpRt	cmdstringtreplaceR2R'R(t
parseCommandsRR.t
doCommands(R#RKR
R>txargsRt_((s/usr/share/yum-cli/shell.pytdefaultys.	(	
cCsdS(s%Do nothing on an empty line of input.N((R#((s/usr/share/yum-cli/shell.pyt	emptylinescCsdtjj|||||ƒ}x?|jjD]1}|j|ƒr+|dkr+|j|ƒq+q+W|S(s­Return a list of possible completions of a command.

        :param text: the command to be completed
        :return: a list of possible completions of the command
        RO(R
Rt
completenamesRRt
startswithR&(R#ttextRKtbegidxtendidxtrettcommand((s/usr/share/yum-cli/shell.pyR\”s
cCs{d}|dkrd|}n?|d
kr8d|}n&|dkrQd	|}n
|jjƒ|jj|ƒd
|_dS(s©Output help information.

        :param arg: the command to output help information about. If
           *arg* is an empty string, general help will be output.
        s
    Shell specific arguments:
      config - set config options
      repository (or repo) - enable/disable/list repositories
      transaction (or ts) - list, reset or run the transaction set
      run - run the transaction set
      exit or quit - exit the shell
    RR
s×
    %s arg
      list: lists the contents of the transaction
      reset: reset (zero-out) the transaction
      solve: run the dependency solver on the transaction
      run: run the transaction
                  RRsÜ
    %s arg [option]
      list: lists repositories and their status. option = [all] name/id glob
      enable: enable repositories. option = repository id
      disable: disable repositories. option = repository id
    RsŠ
    %s arg [value]
      args: debuglevel, errorlevel, obsoletes, gpgcheck, assumeyes, exclude
        If no value is given it prints the current value.
        If value is given it sets that value.
        iN(stransactionsts(srepos
repository(Rt
shellUsageR!tinfoR(R#targtmsg((s/usr/share/yum-cli/shell.pyRS­s




cCs|j|ƒtS(sIExit the shell when EOF is reached.

        :param line: unused
        (tdo_exitRG(R#RK((s/usr/share/yum-cli/shell.pytdo_EOFŚs
cCs|j|ƒtS(s5Exit the shell.

        :param line: unused
        (RgRG(R#RK((s/usr/share/yum-cli/shell.pytdo_quitās
cCs@|jjjdks$|jdkr0d|_ndg|_tS(s5Exit the shell.

        :param line: unused
        t0iis
Leaving Shell(RR$tshell_exit_statusRRRG(R#RK((s/usr/share/yum-cli/shell.pyRgźs$cCs|j|ƒdS(sŲHandle the ts alias of the :func:`do_transaction` method.

        :param line: the remainder of the line, containing the name of
           a subcommand.  If no subcommand is given, run the list subcommand.
        N(tdo_transaction(R#RK((s/usr/share/yum-cli/shell.pytdo_tsõscCsEd|_|j|ƒ\}}}|d
krO|jjtj|jjƒƒnņ|dkrk|jj	ƒnÖ|dkry|jj
ƒ\}}Wn3tjk
rÅ}|j
jd|ƒd|_tSX|dkrx!|D]}|j
jd|ƒqŁWd|_qA|jjtjdƒn&|d	kr4|jd
ƒS|jdƒdS(sĀExecute the given transaction subcommand.  The list
        subcommand outputs the contents of the transaction, the reset
        subcommand clears the transaction, the solve subcommand solves
        dependencies for the transaction, and the run subcommand
        executes the transaction.

        :param line: the remainder of the line, containing the name of
           a subcommand.  If no subcommand is given, run the list subcommand.
        itlisttresettsolvesError building transaction: %sis	Error: %ssSuccess resolving dependenciesR	RNRN(slistN(RRQR)R!tlogt
logginglevelstINFO_2RtlistTransactiont
closeRpmDBtbuildTransactionRR.R R-Rtdo_runRS(R#RKR
R>tcodetmsgsR1Rf((s/usr/share/yum-cli/shell.pyRlżs.
		


cCsød|_|j|ƒ\}}}|dkr|j|ƒ}|sp|jjtjd|t|jj	|ƒƒq“|d}yt
|ƒ}Wn1tk
r½|jj
d||ƒd|_dSXt|jj	||ƒ|dkrštj|ƒq“|dkr“tj|ƒq“n„|dkrį|j|ƒ}|s^|jjtjd|t|jj	|ƒƒq“|d}|jƒtkr|jj
d||ƒd|_tSt|jƒ}t|jj	||ƒ|d
kr“d|j_q“nÓ|dkr§|jddƒ}|j|ƒ}|sZd|}|djt|jj	|ƒƒ}|jjtj|ƒtSt|jj	||ƒ|jjr‹d|j_nd|j_|jjƒn
|jdƒdS(sŗConfigure yum shell options.
        
        :param line: the remainder of the line, containing an option,
           and then optionally a value in the form [option] [value].
           Valid options are one of the following: debuglevel,
           errorlevel, obsoletes, gpgcheck, assumeyes, exclude.  If no
           value is given, print the current value.  If a value is
           supplied, set the option to the given value.
        it
debuglevelt
errorlevels%s: %ss(Value %s for %s cannot be made to an intiNtgpgcheckt
repo_gpgcheckt	obsoletest	assumeyess Value %s for %s is not a Booleantexcludet,t s%s: R(RzR{(R|R}R~R(R€(RRQR2R!RqRrRstgetattrRR$tintR,R R-tsetattrt
setDebugLevelt
setErrorLeveltlowertBOOLEAN_STATESRR)tupRUtjointpkgSackRuRS(R#RKR
R>toptstvaltvalueRf((s/usr/share/yum-cli/shell.pyt	do_config&s^
	

	
	
"cCs|j|ƒdS(s¤Handle the repository alias of the :func:`do_repo` method.

        :param line: the remainder of the line, containing the name of
           a subcommand.
        N(tdo_repo(R#RK((s/usr/share/yum-cli/shell.pyt
do_repositoryhscCséd|_|j|ƒ\}}}|dkrĘ|j|ƒ}|sNdg}n|jddƒ||j_|j|jjƒy|jjƒWnt	j
k
r¤qåX|jjƒ\}}||_n|dkrņ|j|ƒ}x|D]}y#|jj|jj
j|ƒ}	Wn]t	jk
rB}
|jj|
ƒd|_qčt	jk
rp}
|jj|
ƒd|_qčXxk|	D]c}y|jjd|ƒWqxt	jk
rŚ}
|jjdƒ|jj
j|ƒd|_tSXqxWd|j_qčWnó|d	krŲ|j|ƒ}xµ|D]­}y|jj
j|ƒ}Wn]t	jk
rd}
|jj|
ƒd|_qt	jk
r’}
|jj|
ƒd|_qXx+|D]#}|jj
j
|}
|
jƒqšWqW|jjjƒn
|jd
ƒdS(
sÆExecute the given repo subcommand.  The list subcommand
        lists repositories and their statuses, the enable subcommand
        enables the given repository, and the disable subcommand
        disables the given repository.

        :param line: the remainder of the line, containing the name of
           a subcommand and other parameters if required.  If no
           subcommand is given, run the list subcommand.
        iRntenabledtrepolisttenableitthisreposDisabling RepositorytdisableRN(slistN(RRQR)R2tinsertRR'R(RVRR.RWRŒtrepost
enableRepotConfigErrorR R-t	RepoErrortdoRepoSetuptdisableRepoRRŠRFtbuildIndexesRS(R#RKR
R>R'RRYR™RtchangedR1toffrepostrepoidR–((s/usr/share/yum-cli/shell.pyR‘psh
	



		


cCs4|j|ƒ\}}}|GH|GH|GHd|_dS(Ni(RQR(R#RKR
R>((s/usr/share/yum-cli/shell.pytdo_testĮs
cCsÅd|_t|jjƒdkrĮye|jjƒ\}}|dkrvx!|D]}|jjd|ƒqLWd|_tS|jjƒ}Wnšt	j
k
rŗ}|jjd|ƒd|_qĮtk
rå}|jjdƒd|_qĮtk
r"}|j
dkr|jjdƒnd|_qĮX|d
krK|jjdƒd|_nf|dkrs|jjd	ƒd|_n(|dkr›|jjd
ƒd|_n|jjtjdƒ|jjƒndS(s:Run the transaction.

        :param line: unused
        iis	Error: %ss

Exiting on user canceli s

Exiting on Broken Pipei’’’’s(Transaction encountered a serious error.s.There were non-fatal errors in the transactionsTransaction didn't startsFinished TransactionN(iii’’’’(RRRttsInfoRvR R-Rt
doTransactionRR.tKeyboardInterruptRDterrnoR!RdRqRrRsRu(R#RKRxRyRft	returnvalR1((s/usr/share/yum-cli/shell.pyRwČs@	
	
(t__name__t
__module__t__doc__RR(R2R=RLRZR[R\RSRhRiRgRmRlRR’R‘R£Rw(((s/usr/share/yum-cli/shell.pyR s(						$			-					)	B		Q	(R«R3R
R*RtyumRt
yum.constantstyum.logginglevelsRrtyum.i18nRR<RR(((s/usr/share/yum-cli/shell.pyt<module>s

Back to Directory File Manager