v_c@s9ddlZddlZddlTddlmZddlZddlZddlmZddl m Z ddl m Z dZ dZd Zd efd YZd efd YZdefdYZdefdYZdefdYZdefdYZdZedkr5endS(iN(t*(tCompsException(t to_unicode(tget_my_lang_code(tcElementTree_iterparses*{http://www.w3.org/XML/1998/namespace}langcCstj|jtS(N(tBOOLEAN_STATEStgettlowertFalse(tstrng((s-/usr/lib/python2.7/site-packages/yum/comps.pyt parse_booleanscCs t|S(N(tint(R ((s-/usr/lib/python2.7/site-packages/yum/comps.pyt parse_number"stCompsObjcBsheZdZdZedZedZedZdZdZ dZ dZ RS( s Group/Category helper object. cCs|jS(s3 Return the "name" of the object for the C locale. (tname(tself((s-/usr/lib/python2.7/site-packages/yum/comps.pyt__str__)scCs1x*dD]"}t||rt||SqWdS(s6 Return the "id": categoryid, groupid, environmentid. t categoryidtgroupidt environmentid(s categoryidsgroupids environmentidN(thasattrtgetattrtNone(RtidT((s-/usr/lib/python2.7/site-packages/yum/comps.pytcompsid-s cCs|jtS(s9 Return the "name" of the object for the current locale. (t nameByLangR(R((s-/usr/lib/python2.7/site-packages/yum/comps.pytui_name7scCs|jtS(s@ Return the "description" of the object for the current locale. (tdescriptionByLangR(R((s-/usr/lib/python2.7/site-packages/yum/comps.pytui_description<scCsO|dkrdS|j|jkr&dS|j|jkr<dSt|j|jS(Nii(Rt display_ordertcmpR(Rtother((s-/usr/lib/python2.7/site-packages/yum/comps.pyt__cmp__As cCsddl}|g}d|kr1|jdng}xD|D]<}x3|j|D]"}||krT|j|qTqTWq>W|S(NitC(tgettexttappendt _expand_lang(RtlangR"t languagestnelangstnelang((s-/usr/lib/python2.7/site-packages/yum/comps.pyt_expand_languagesLs     cCsGx7|j|D]&}||jkrt|j|SqWt|jS(N(R)ttranslated_nameRR(RR%tlangcode((s-/usr/lib/python2.7/site-packages/yum/comps.pyR[scCsGx7|j|D]&}||jkrt|j|SqWt|jS(N(R)ttranslated_descriptionRt description(RR%R+((s-/usr/lib/python2.7/site-packages/yum/comps.pyRcs( t__name__t __module__t__doc__RtpropertyRRRR R)RR(((s-/usr/lib/python2.7/site-packages/yum/comps.pyR %s    tGroupcBsSeZdZddZdZeeZdZdZ dZ dZ RS(s? Group object parsed from group data in each repo. and merged. cCst|_t|_t|_d|_d|_i|_i|_i|_ i|_ i|_ i|_ d|_d|_d|_t|_t|_t|_|r|j|ndS(Nti(tTruet user_visibleRtdefaulttselectedRR-R*R,tmandatory_packagestoptional_packagestdefault_packagestconditional_packagesRtlangonlyRRt installedttoremovet_weaktparse(Rtelem((s-/usr/lib/python2.7/site-packages/yum/comps.pyt__init__ms&                 cCs:|jj|jj|jj|jj}|S(N(R8tkeysR9R:R;(Rtlst((s-/usr/lib/python2.7/site-packages/yum/comps.pyt _packageiters&cCsx|D]}|jdkrI|j}|jdk r=tn||_q|jdkr|j}|ry|jd}n|jjt}|r||j |t |j|_q|jdkrbt|j|_q|jdkrt |j|_q|jd kr|j}|jdk rtn||_q|jd kr|j|qqWdS( NtidRtutf8R-t uservisibleRR6R<t lang_onlyt packagelist(slangonlyRI(ttagttextRRRtencodetattribRt lang_attrR*RR,R-R R5R RR6R<tparse_package_list(RRAtchildtmyidRLR%((s-/usr/lib/python2.7/site-packages/yum/comps.pyR@sH          cCsx|D]}|jdkr|jjd}|s=d}n|d krOqn|j}|sdqn|dkrd|j| %s %s %s %s s %ss %s s! %s s! %s s/ %s s s3 %s s1 %s s2 %s sC %s s s (RtstrR6RR5RR<RtsortedR*titemsR-R,R8R:R9R;(RtmsgR%tvalR]treq((s-/usr/lib/python2.7/site-packages/yum/comps.pytxmls, "" "  N( R.R/R0RRBRER1tpackagesR@RPR^Re(((s-/usr/lib/python2.7/site-packages/yum/comps.pyR2js   3  "t EnvironmentcBseZdZd dZdZeeZdZeeZ dZ ee Z dZ ee Z dZdZdZd Zd ZRS( sD Environment object parsed from group data in each repo, and merged cCsd|_d|_d|_i|_i|_d|_d|_t|_ i|_ i|_ i|_ t|_ |r|j|ndS(NR3i(RRRR-R*R,RR<RR=t_groupst_optionst_defaultoptionsR?R@(RRA((s-/usr/lib/python2.7/site-packages/yum/comps.pyRB%s            cCs |jj|jj}|S(N(RhRCRi(RRD((s-/usr/lib/python2.7/site-packages/yum/comps.pyt _allgroupiter7s cCs |jjS(N(RhRC(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyt _groupiter>scCs |jjS(N(RiRC(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyt _optioniterCscCs |jjS(N(RjRC(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyt_defaultoptioniterHscCs{xt|D]l}|jdkrI|j}|jdk r=tn||_q|jdkr|j}|ry|jd}n|jjt}|r||j | %s %s s %s s! %s s! %s s0 %s s s %s s s s* %s s s ( RRRR*RaR-R,RwRyRx(RRbR%RcRz((s-/usr/lib/python2.7/site-packages/yum/comps.pyRes&     N(R.R/R0RRBRkR1t allgroupsRlRwRmRyRnRxR@RqRrR^Re(((s-/usr/lib/python2.7/site-packages/yum/comps.pyRg"s          '  tCategorycBsSeZdZddZdZeeZdZdZ dZ dZ RS(sB Category object parsed from group data in each repo. and merged. cCsYd|_d|_d|_i|_i|_d|_i|_|rU|j|ndS(NR3i( RRRR-R*R,RRhR@(RRA((s-/usr/lib/python2.7/site-packages/yum/comps.pyRBs       cCs |jjS(N(RhRC(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyRlscCs\xU|D]M}|jdkrI|j}|jdk r=tn||_q|jdkr|j}|ry|jd}n|jjt}|r||j | %s %s s %s s! %s s! %s s0 %s s s %s s s (RRRR*RaR-R,Rw(RRbR%RcRz((s-/usr/lib/python2.7/site-packages/yum/comps.pyRes   N( R.R/R0RRBRlR1RwR@RqR^Re(((s-/usr/lib/python2.7/site-packages/yum/comps.pyR|s   $  t LangpackscBsJeZddZdZdZdZdZdZdZ RS(cCs2g|_d|_|dk r.|j|ndS(NR3(t langpacksRRR@(RRA((s-/usr/lib/python2.7/site-packages/yum/comps.pyRBs   cCs |j|S(N(R~(Rtindx((s-/usr/lib/python2.7/site-packages/yum/comps.pyt __getitem__%sccsx|jD] }|Vq WdS(N(R~(Rti((s-/usr/lib/python2.7/site-packages/yum/comps.pyt__iter__(scCs t|jS(N(tlenR~(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyt__len__,scCs(i|d6|d6}|jj|dS(NRtinstall(R~R#(RRRtlangpack((s-/usr/lib/python2.7/site-packages/yum/comps.pyR^/s cCsxo|D]g}|jdkr[i|jjdd6|jjdd6}|jj|qtd|jqW|jjd|_|jjd|_dS(NtmatchRRs%Unexpected element in : %s(RKRNRR~R#RRR(RRARQR((s-/usr/lib/python2.7/site-packages/yum/comps.pyR@6s cCsN|js dSd}x*|D]"}|d|d|df7}qW|d7}|S(s0write out an xml stanza for the Langpacks objectR3s s$ RRs (R~(RRbR((s-/usr/lib/python2.7/site-packages/yum/comps.pyReDs    N( R.R/RRBRRRR^R@Re(((s-/usr/lib/python2.7/site-packages/yum/comps.pyR}s      tCompscBseZedZdZdZdZdZeeZ eeZ eeZ eeZ dZ dZedZdZd Zed Zed Zd Zd ZdZdZddZdZdZRS(cCsFi|_i|_i|_t|_d|_||_t|_dS(Ni( Rht _environmentst _categoriesR}t _langpackst compscounttoverwrite_groupsRtcompiled(RR((s-/usr/lib/python2.7/site-packages/yum/comps.pyRBOs      cCs&|jj}|jdd|S(NtkeycSs|j|jfS(N(RR(tx((s-/usr/lib/python2.7/site-packages/yum/comps.pyt\s(Rhtvaluestsort(Rtgrps((s-/usr/lib/python2.7/site-packages/yum/comps.pyt get_groupsZscCs&|jj}|jdd|S(NRcSs|j|jfS(N(RR(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyRas(RRR(Rt environments((s-/usr/lib/python2.7/site-packages/yum/comps.pytget_environments_scCs&|jj}|jdd|S(NRcSs|j|jfS(N(RR(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyRfs(RRR(Rtcats((s-/usr/lib/python2.7/site-packages/yum/comps.pytget_categoriesdscCs|jS(N(R(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyt get_langpacksiscCs|j|}|rtStS(N(t return_groupsR4R(Rtgrpidtexists((s-/usr/lib/python2.7/site-packages/yum/comps.pyt has_groupqscCs!|j|}|r|dSdS(s$Return the first group which matchesiN(RR(RRR((s-/usr/lib/python2.7/site-packages/yum/comps.pyt return_groupysc Csni}|sgSxQ|jdD]@}|j}||jkra|j|}|||j s ( RhRRRRRReRRR(RRbtgtcR((s-/usr/lib/python2.7/site-packages/yum/comps.pyReys N(R.R/RRBRRRRR1RwRRR~RRRRRRR4RRRRRRR^RRe(((s-/usr/lib/python2.7/site-packages/yum/comps.pyRNs.           &   ( "   $ 2cCsymtjdGHt}x"tjdD]}|j|q&WHdGHx@|jD]5}d||jfGHx|jD]}d|GHqoWqMWHdGHx`|jD]U}d|j|j fGHx|jD]}d|GHqWx|j D]}d|GHqWqWHdGHxC|j D]8}d|j|j fGHx|jD]}d|GHq$WqWHdGHx(|j D]}d |d |d fGHqKWWn6tk rtjd tjdIJtjdnXdS( Nis===== GROUPS =====s %s (id: %s)s s===== ENVIRONMENTS =====s *s===== CATEGORIES =====s===== LANGPACKS =====s %s (%s)RRsnewcomps.py: No such file:'%s'(tsystargvRR^RwRRfRRRRyRRR~Rtstderrtexit(tpRRR]RRR((s-/usr/lib/python2.7/site-packages/yum/comps.pytmains@    t__main__(RRt yum.constantst yum.ErrorsRRRtyum.i18nRtyum.miscRRRROR R tobjectR R2RgR|R}RRR.(((s-/usr/lib/python2.7/site-packages/yum/comps.pyts*       Ed0E (