ó ¾[/\c@s°ddlmZddlmZddlZddlZddlZddlZddlZddl Z ej dƒZ de fd„ƒYZ dejejfd„ƒYZdS( iÿÿÿÿ(tcommands(t_NtdnftShellDemandSheetcBs eZeZeZeZeZRS((t__name__t __module__tTruetavailable_repost resolvingt root_usertsack_activation(((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyR%st ShellCommandcBsÿeZdZedƒZi dd6dd6dd6dd6dd6dd 6dd6d d 6d d 6d d 6Zd„Zed„ƒZd„Z d„Z d„Z d„Z dd„Zdd„Zdd„Zdd„Zd„Zdd„Zdd„Zdd„ZRS(tshellsrun an interactive DNF shelltrepot repositorytquittexittts_runtrunt transactionttstconfigtresolvet resolvedepthelpcCs0tjj||ƒtjj|ƒd|_dS(Ns> (RtCommandt__init__tcmdtCmdtprompt(tselftcli((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyR=sc Cs/|jddddtdƒdtdƒƒdS(Ntscripttnargst?tmetavartSCRIPTRsScript to run in DNF shell(t add_argumentR(tparser((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyt set_argparserBscCs•|jj}tƒ|j_xst|ƒD]e}|jdƒrCq(nyt|jj|ƒWq(tk rŒt|jj|t||ƒƒq(Xq(WdS(Nt__(RtdemandsRtdirt startswithtgetattrtAttributeErrortsetattr(Rtdefault_demandstattr((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyt configureGs  cCs0|jjr"|j|jjƒn |jƒdS(N(toptsR t _run_scripttcmdloop(R((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyRTs cCs*|jjƒd|j_|jjƒdS(N(tbaset_finalize_basetNonet _transactiont fill_sack(R((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyt_cleanZs  cCs| s|dkrdS|dkr,d}nytj|ƒ}Wn|jƒdSX|jjj|ƒ}|jdkr|dS|j|jkr¿t|d|j|jƒ|ddd…ƒnÌ|jj j |jƒ}|dk r||jƒ}yK|jjj ||ƒ}t j|jjƒ|j_|jƒ|jƒWq‹tjjk rv}tjtdƒd|jƒq‹dSXn |jƒdS( Ns tEOFRR RisError:t (tshlextsplitt_helpRt optparsertparse_main_argstcommandtMAPPINGR,R7t cli_commandstgettparse_command_argstcopytdeepcopyR)R1RRt exceptionstErrortloggerterrorRtvalue(Rtlinets_lineR2tcmd_clsRte((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pytonecmd_s6   1  !c Csd„}| s"t|ƒdkr3|jdƒdS|d}t|ƒdkrY|dnd}|jdƒ}|dkrê|| }||d}|jjj|ƒ}x|D]}||||ƒq®W|stjt dƒ|ƒqn||||jj ƒdS( NcSs^|rt|||ƒnAy$dj|t|t|ƒƒƒGHWntjtdƒƒnXdS(Ns{}: {}sUnsupported key value.(R.tformatR,tstrRKtwarningR(tkeytvaltconf((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyt print_or_set€s $iRiit.iÿÿÿÿsCould not find repository: %s( tlenR?R7tfindR5trepost get_matchingRKRURRX( RtargsRYRVRWtperiodt repo_nameR]R ((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyt_configs"   "    cCsnt|tƒr+t|ƒdkr+|dn|}d}|r<|dkratdƒj|ƒ}q<|dkr…tdƒj|ƒ}q<|dkr©tdƒj|ƒ}q<|d krÍtd ƒj|ƒ}q<|dkrñtd ƒj|ƒ}q<|dkrtdƒj|ƒ}q<|dkr<tdƒj|ƒ}q<n|sa|jjjƒtdƒ}nd|GHdS(s¤Output help information. :param args: the command to output help information about. If *args* is an empty, general help will be output. iRsà{} arg [value] arg: debuglevel, errorlevel, obsoletes, gpgcheck, assumeyes, exclude, repo_id.gpgcheck, repo_id.exclude If no value is given it prints the current value. If value is given it sets that value.Rs{} [command] print helpR RsÅ{} arg [option] list: lists repositories and their status. option = [all | id | glob] enable: enable repositories. option = repository id disable: disable repositories. option = repository idRs"{} resolve the transaction setRRsy{} arg list: lists the contents of the transaction reset: reset (zero-out) the transaction run: run the transactionRs{} run the transactionRRs{} exit the shells‚Shell specific arguments: config set config options help print help repository (or repo) enable, disable or list repositories resolvedep resolve the transaction set transaction (or ts) list, reset or run the transaction set run resolve and run the transaction set exit (or quit) exit the shells N(srepoR(s transactionR(sexitsquit( t isinstancetlistR[R7RRSRR@t print_help(RR_targtmsg((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyR?œs:1        cCs|r|dnd}|d krC|jddj|dƒƒnÉ|d krÿ|jjj}t}x|ddd…D]j}|j|ƒ}|r¬t||ƒƒt }qxt j t dƒdt d ƒ|jj jj|ƒƒqxW|r |jjƒq n |jd ƒdS( NiRds repolist R<itenabletdisablesError:sUnknown repo: '%s'R (slistN(RhRi(R7RRtjoinRR5R]tFalseR^R,RRKtcriticalRtoutputttermtboldR9R?(RR_RR]R9R tr((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyt_repo×s  !  cCs]|jjjdkrYy |jjj|jjjƒWqYtjj k rU}|GHqYXndS(N( RR5RR7RR)t allow_erasingRRIt DepsolveError(RR_RQ((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyt_resolveîs  cCs¥yXt|dƒC}|jƒ}x-|D]%}|jdƒs(|j|ƒq(q(WWdQXWnFtk r tjtdƒ|jj j j |ƒƒt j dƒnXdS(NRpt#s!Error: Cannot open %s for readingi(topent readlinesR+RRtIOErrorRKtinfoRR5RmRnRotsysR(RtfiletfdtlinesRN((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyR3õs   (cCsÅ|r|dnd}|dkr0|jƒdS|jƒ|dkr€|jjrÁ|jjj|jjƒ}tj|ƒqÁnA|dkr´y|jj ƒWnnX|jƒn |j dƒdS(NitresetRdRR(slistN( R7R:RtR5R8Rmtlist_transactionRKRytdo_transactionR?(RR_Rtout((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyR8s        cCs|jdgƒdS(NR(R8(RR_((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyt_ts_runscCs$tjtdƒƒtjdƒdS(Ns Leaving Shelli(RKRyRRzR(RR_((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyt_quits(sshellN(RRtaliasesRtsummaryRCRt staticmethodR'R1RR:RRR7RbR?RqRtR3R8R‚Rƒ(((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyR ,s4        ;    (tdnf.cliRtdnf.i18nRRRGRtloggingR=Rzt getLoggerRKtobjectRRRR (((s:/usr/lib/python2.7/site-packages/dnf/cli/commands/shell.pyts