ó 7Õm`c@s¼ddlmZddlmZddlmZddlZddlZddl Zddl Zddl Z ddl Z ddlZddlZe jdƒZdejfd„ƒYZdS(iÿÿÿÿ(tunicode_literals(t_(t _parse_specsNudnft OptionParsercBsHeZdZd„Zd„Zdejfd„ƒYZdejfd„ƒYZdej fd„ƒYZ d ejfd „ƒYZ d ejfd „ƒYZ d ejfd„ƒYZ dejfd„ƒYZdejfd„ƒYZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„Zdd„ZRS(u5ArgumentParser like class to do things the "yum way".cCsDtt|ƒjƒi|_tƒ|_|jƒ|_d|_ dS(N( tsuperRt__init__t _cmd_usagetsett _cmd_groupst _main_parsert main_parsertNonetcommand_arg_parser(tself((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR's   cCs1|jƒtjtdƒ|ƒtjdƒdS(uØOutput an error message, and exit the program. This method overrides standard argparser's error so that error output goes to the logger. :param msg: the error message to output uCommand line error: %siN(t print_usagetloggertcriticalRtsystexit(R tmsg((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyterror.s t _RepoCallbackcBseZd„ZRS(csW|dkrdnd‰t||jƒ}|j‡fd†tjd|ƒDƒƒdS(Nu --disablerepoudisableuenablec3s|]}|ˆfVqdS(N((t.0tx(t operation(s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pys =su \s*[,\s]\s*(tgetattrtdesttextendtretsplit(R tparsert namespacetvaluestopt_strtl((Rs9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyt__call__:s(t__name__t __module__R#(((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR9st_RepoCallbackEnablecBseZd„ZRS(cCs.|jj|ddfƒt|d|ƒdS(Niuenableureponame(trepos_edtappendtsetattr(R RRR R!((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR#@s(R$R%R#(((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR&?st_SplitCallbackcBseZdZd„ZRS(uN Split all strings in seq, at "," and whitespace. Returns a new list. cCsCx<tjd|ƒD](}ttj|ƒj||||ƒqWdS(Nu \s*[,\s]\s*(RRRRR*R#(R RRR R!tval((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR#Gs (R$R%t__doc__R#(((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR*Dst_SplitExtendDictCallbackcBseZdZd„ZRS(u[ Split string at "," or whitespace to (key, value). Extends dict with {key: value}.c Cs†y0|jdƒ\}}| s&| r/t‚nWn3tk retdƒ|}tj||ƒ‚nXt||jƒ}||| and repo_.c Cs[|jdƒ}t|ƒdkr;tjtdƒ|ƒdSt|ƒdkrgtjtdƒ|ƒdS|\}}|jdƒ}|dkr|| } ||d}t|dƒrÁ|j} ni} | j| iƒj|gƒj |ƒt |d |j | ƒnQt|d ƒr!|j } ni} | j|gƒj |ƒt |d |j | ƒdS( Nu=iu'Setopt argument has multiple values: %su Setopt argument has no value: %su.iÿÿÿÿiu repo_setoptsurepo_u main_setoptsumain_( RtlenRtwarningRtfindthasattrt repo_setoptst setdefaultR(R)Rt main_setopts( R RRR R!tvalstktvtperiodtrepotrepooptstmainopts((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR#]s,    % (R$R%R,R#(((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR3ZstParseSpecGroupFileCallbackcBseZd„ZRS(cCst||ƒdS(N(R(R RRR R!((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR#ys(R$R%R#(((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyRBxstPkgNarrowCallbackcBseZd„Zd„ZRS(cOs˜i|_y3x,ddgD]}|||j|<||=qWWn/tk rm}td|jj|fƒ‚nXg|ddd?dddd·d td@ƒƒ|j dAdBddCdDt dd·ddEd tdFƒƒ|j dGdHddIddJdd·d tdKƒdDt ƒ|j dLdddd·d tdMƒƒ|j dNddOdddd·d tdPƒƒ|j dQdRdd·dDt d tdSƒƒ|j dTdd·ddUddd tdVƒƒ|j dWdd·d tdXƒddYƒ|j dZd[dddd·d td\ƒƒ|j d]dddd·d td^ƒƒ|j d_d|jdd`dgddaƒ|jƒ}|j dbd|jdd`dgddaƒ|j dcddddadded|j dgd tdfƒƒ|jƒ}|j dgdhdtddiddd tdjƒƒ|j dkdldtddmddd tdnƒƒ|j dodpdqdgddrd|j d tdsƒddtƒ|j dudvdgddwd|j d tdxƒddaƒ|j dydid|jddzd td{ƒƒ|j d|dd!dd·dd}d td~ƒƒ|j ddd!dd·dd€d tdƒƒ|j d‚ddƒdd·d td„ƒƒ|j d…dd†ddd td‡ƒƒ|j dˆdd‰dd·d tdŠƒdddd‹ƒ|j dŒdd‰dd·d tdƒddddŽƒ|j dddd‘dd·d td’ƒƒ|j d“dd”dddtd td•ƒƒ|j d–dd—dd·d td˜ƒƒ|j d™ddd tdšƒƒ|j d›ddd tdœƒƒ|j dddd tdžƒƒ|j dŸddd td ƒƒ|j d¡d¢dd£dgdd¤d td¥ƒƒ|j d¦dgdd§dd¤d td¨ƒƒ|j d©dgdd¤d tdªƒƒ|j d«d¬d­d®d¯d°d±gdgdd²dd¤d td³ƒƒ|j d´ddµdtjd|jd­ttjjjƒƒd td¶ƒƒ|S(¸u0 Standard options known to all dnf subcommands. tadd_helpuOptional argumentsu-cu--configRuconfig_file_pathtdefaulttmetavaru [config file]thelpuconfig file locationu-qu--quietuquiettactionu store_trueuquiet operationu-vu --verboseuverbose operationu --versionushow DNF version and exitu --installrootuset install rootu[path]u--nodocsu store_consttconstunodocsutsflagsudo not install documentationsu --nopluginsu store_falseupluginsudisable all pluginsu--enablepluginu enablepluginuenable plugins by nameu[plugin]u--disablepluginu disablepluginudisable plugins by nameu --releaseveru:override the value of $releasever in config and repo filesu--setoptusetoptsu%set arbitrary config and repo optionsu --skip-brokenu skip_brokenu.resolve depsolve problems by skipping packagesu-hu--helpu --help-cmduhelpushow command helpu--allowerasingu;allow erasing of installed packages to resolve dependenciesu-bu--bestu8try the best available package versions in transactions.u-Cu --cacheonlyu cacheonlyu2run entirely from system cache, don't update cacheu-Ru --randomwaitu sleeptimettypeu [minutes]umaximum command wait timeu-du --debuglevelu debuglevelu [debug level]udebugging output levelu --debugsolveru)dumps detailed solving results into filesu--showduplicatesushowdupesfromreposu2show duplicates, in repos, in list/search commandsu-eu --errorleveluerror output levelu --obsoletesu obsoletesu„enables dnf's obsoletes processing logic for upgrade or display capabilities that the package obsoletes for info, list and repoqueryu--rpmverbosityudebugging output level for rpmu[debug level name]u-yu --assumeyesu*automatically answer yes for all questionsu --assumenou)automatically answer no for all questionsu --enablerepourepos_edu[repo]u --disablerepou--repou--repoidurepouUenable just specific repositories by an id or a glob, can be specified multiple timesu--enableu --set-enabledu set_enabledu>enable repos with config-manager command (automatically saves)u --disableu--set-disabledu set_disabledu?disable repos with config-manager command (automatically saves)u-xu --excludeu --excludepkgsu excludepkgsu exclude packages by name or globu [package]u--disableexcludesu--disableexcludepkgsudisable_excludesudisable excludepkgsu--repofrompathu [repo,path]uIlabel and path to additional repository, can be specified multiple times.u--noautoremoveuclean_requirements_on_removeu7disable removal of dependencies that are no longer usedu --nogpgcheckugpgchecku5disable gpg signature checking (if RPM policy allows)u--colorucolorucontrol whether color is usedu --refreshufreshest_metadatau2set metadata as expired before running the commandu-4u ip_resolveuresolve to IPv4 addresses onlyuipv4u-6uresolve to IPv6 addresses onlyuipv6u --destdiru --downloaddirudestdiru!set directory to copy packages tou--downloadonlyu downloadonlyuonly download packagesu --commentucommentuadd a comment to transactionu--bugfixu,Include bugfix relevant packages, in updatesu --enhancementu1Include enhancement relevant packages, in updatesu --newpackageu0Include newpackage relevant packages, in updatesu --securityu.Include security relevant packages, in updatesu --advisoryu --advisoriesuadvisoryuappendu=Include packages needed to fix the given advisory, in updatesu--bzsubugzillau7Include packages needed to fix the given BZ, in updatesu--cvesu8Include packages needed to fix the given CVE, in updatesu--sec-severityu --secseveritytchoicesuCriticalu ImportantuModerateuLowuseverityuDInclude security relevant packages matching the severity, in updatesu --forcearchuARCHu Force the use of an architectureN(R/tArgumentParsertdnfRWt PROGRAM_NAMEtFalseRt _optionalsttitlet add_argumentR R*R3tintRtadd_mutually_exclusive_groupR-tSUPPRESSRNtsortedtrpmt _BASEARCH_MAPtkeys(R R t repo_groupt enable_group((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR —s2      !                                                                     cCs§dtjj|jf}tt|ƒj|dtd|jgd|j ƒtt|ƒj ddddt j ƒt j |dtƒ|_|j|j_|j|ƒ|S( Nu%s %sRRtparentst descriptionucommandtnargsiRU(R[RWR\t_basecmdRRRR]R tsummaryR`R/RcRZR Rt set_argparser(R tcommandtprog((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyt_command_parserLs    cCsgtjj|jƒ}tjj|jdƒ}||jkrc||f|j|<|jj|ƒndS(u- store usage info about a single dnf command.iN(R[ti18ntucdRntaliasesRRtadd(R tcmdtgroupRntname((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyt_add_cmd_usageXs cCs1x*t|jƒƒD]}|j||ƒqWdS(už store name & summary for dnf commands The stored information is used build usage information grouped by build-in & plugin commands. N(RR Rz(R tcli_cmdsRxRw((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyt add_commands`scCsÎitdƒd6tdƒd6}tjj}d|}x‘ddgD]ƒ}||jkr^qCn|d||7}xSt|jjƒƒD]<}|j|\}}||kr†|d||f7}q†q†WqCW|S(u- get the usage information to show the user. uList of Main Commands:umainuList of Plugin Commands:upluginu%s [options] COMMAND u %s u %-25s %s (RR[RWR\RRdRRg(R tdescRytusagetgrpRxRn((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyt get_usageis   cOs\tg|D]}|d|jk^q ƒrEtt|ƒj||ŽS|jj||ŽSdS(Ni(tallt prefix_charsRRR`R (R RHRItarg((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR`zs,cCs\tjtjjdtd|jgƒ}|jddddtjƒ|j |ƒ\}}|S(NRRRjucommandRlu?RU( R/RZR[RWR\R]R R`Rctparse_known_args(R RHRRt _unused_args((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pytparse_main_argss cCsJ|j|ƒtt|ƒj|ƒ\}}|jj||ƒ|_|jS(N(RrRRR„R t parse_argstopts(R RpRHRtextras((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pytparse_command_argsˆs  cCs/|j|jj7_tt|ƒj|ƒdS(N(t_actionsR RRR(R tfile_((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyRscCsc|r@|j|ƒ}|j|jj7_tt|ƒjƒn|jƒ|j_|jjƒdS(N( RrR‹R RRt print_helpR€R R~(R Rptcp((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR”s N(R$R%R,RRR/tActionRR&t _AppendActionR*R-R3RBRCRNR RrRzR|R€R`R†RŠR RR(((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyR$s*   µ      (t __future__Rtdnf.i18nRtdnf.utilRR/tdnf.exceptionsR[tdnf.rpmt dnf.yum.misctloggingtos.pathtosRRt getLoggerRRZR(((s9/usr/lib/python2.7/site-packages/dnf/cli/option_parser.pyts