ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/yum/
Upload File :
Current File : //proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/yum/comps.pyc

�
8M�bc@s9ddlZddlZddlTddlmZddlZddlZddlmZddl	m
Z
ddl	mZdZ
d�Zd	�Zd
efd��YZdefd
��YZdefd��YZdefd��YZdefd��YZdefd��YZd�Zedkr5e�ndS(i����N(t*(tCompsException(t
to_unicode(tget_my_lang_code(tcElementTree_iterparses*{http://www.w3.org/XML/1998/namespace}langcCstj|j�t�S(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"stCompsObjcBsheZdZd�Zed��Zed��Zed��Zd�Zd�Z	d�Z
d�ZRS(	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|jt��S(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|jt��S(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|j�S(Nii����(Rt
display_ordertcmpR(Rtother((s-/usr/lib/python2.7/site-packages/yum/comps.pyt__cmp__AscCs�ddl}|g}d|kr1|jd�ng}xD|D]<}x3|j|�D]"}||krT|j|�qTqTWq>W|S(Ni����tC(tgettexttappendt_expand_lang(RtlangR"t	languagestnelangstnelang((s-/usr/lib/python2.7/site-packages/yum/comps.pyt_expand_languagesLs	
cCsGx7|j|�D]&}||jkrt|j|�SqWt|j�S(N(R)ttranslated_nameRR(RR%tlangcode((s-/usr/lib/python2.7/site-packages/yum/comps.pyR[scCsGx7|j|�D]&}||jkrt|j|�SqWt|j�S(N(R)ttranslated_descriptionRtdescription(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	
			tGroupcBsSeZdZdd�Zd�Zee�Zd�Zd�Z	d�Z
d�ZRS(s? Group object parsed from group data in each repo. and merged. cCs�t|_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_packageiter�s&cCs�x�|D]�}|jdkrI|j}|jdk	r=t�n||_q|jdkr�|j}|ry|jd�}n|jjt�}|r�||j	|<q�||_
q|jdkr|j}|r�|jd�}n|jjt�}|r||j|<q�|r�||_q�q|jdkr>t
|j�|_q|jdkrbt|j�|_q|jdkr�t
|j�|_q|jdkr�|j}|jdk	r�t�n||_q|jd
kr|j|�qqWdS(NtidRtutf8R-tuservisibleRR6R<t	lang_onlytpackagelist(slangonlyRI(ttagttextRRRtencodetattribRt	lang_attrR*RR,R-R
R5RRR6R<tparse_package_list(RRAtchildtmyidRLR%((s-/usr/lib/python2.7/site-packages/yum/comps.pyR@�sH
						cCs�x�|D]�}|jdkr|jjd�}|s=d}n|d
krOqn|j}|sdqn|dkr�d|j|<q�|dkr�d|j|<q�|dkr�d|j|<q�|dkr�|jjd	�|j|<q�qqWdS(Nt
packagereqttypeu	mandatoryt	mandatoryR6toptionaltconditionalitrequires(RUsdefaultRVRW(RKRNRRLR8R:R9R;(Rtpackagelist_elemRQtgenretpackage((s-/usr/lib/python2.7/site-packages/yum/comps.pyRP�s$
		cCs]x|jD]}d|j|<q
Wx|jD]}d|j|<q+Wx|jD]}d|j|<qLWx%|jD]}|j||j|<qmW|jdkr�|jdkr�|j|_n|jdkr�|jdkr�|j|_nx7|jD],}||jkr�|j||j|<q�q�Wx7|jD],}||jkr)|j||j|<q)q)WdS(s'Add another group object to this objectiR3N(R8R:R9R;RR-R*R,(RtobjtpkgR%((s-/usr/lib/python2.7/site-packages/yum/comps.pytadd�s$cCs�d|jt|j�j�t|j�j�|jf}|jrW|d|j7}n|d|j7}x7t|j	j
��D] \}}|d||f7}q~W|d|j7}x7t|jj
��D] \}}|d||f7}q�W|d7}x%t|j
�D]}|d|7}qWx%t|j�D]}|d	|7}q/Wx%t|j�D]}|d
|7}qWWx7t|jj
��D] \}}|d||f7}q�W|d7}|d
7}|S(s,write out an xml stanza for the group objects�        
  <group>
   <id>%s</id>
   <default>%s</default>
   <uservisible>%s</uservisible>
   <display_order>%s</display_order>
s   <langonly>%s</langonly>s   <name>%s</name>
s!   <name xml:lang="%s">%s</name>
s!   <description>%s</description>
s/   <description xml:lang="%s">%s</description>
s    <packagelist>
s3      <packagereq type="mandatory">%s</packagereq>
s1      <packagereq type="default">%s</packagereq>
s2      <packagereq type="optional">%s</packagereq>
sC      <packagereq type="conditional" requires="%s">%s</packagereq>
s    </packagelist>
s
  </group>(RtstrR6RR5RR<RtsortedR*titemsR-R,R8R:R9R;(RtmsgR%tvalR]treq((s-/usr/lib/python2.7/site-packages/yum/comps.pytxml�s,	""
"

N(R.R/R0RRBRER1tpackagesR@RPR^Re(((s-/usr/lib/python2.7/site-packages/yum/comps.pyR2js			3		"tEnvironmentcBs�eZdZdd�Zd�Zee�Zd�Zee�Z	d�Z
ee
�Zd�Zee�Z
d�Zd�Zd�Zd	�Zd
�ZRS(sD Environment object parsed from group data in each repo, and merged cCs�d|_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
|jj�S(N(RhRC(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyt
_groupiter>scCs
|jj�S(N(RiRC(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyt_optioniterCscCs
|jj�S(N(RjRC(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyt_defaultoptioniterHscCs{xt|D]l}|jdkrI|j}|jdk	r=t�n||_q|jdkr�|j}|ry|jd�}n|jjt�}|r�||j	|<qs||_
q|jdkr|j}|r�|jd�}n|jjt�}|r||j|<qs||_q|jdkr0|j
|�q|jdkrO|j|�q|jdkrt|j�|_qqWdS(NRFRRGR-t	grouplistt
optionlistR(RKRLRRRRMRNRROR*RR,R-tparse_group_listtparse_option_listRR(RRARQRRRLR%((s-/usr/lib/python2.7/site-packages/yum/comps.pyR@Ms8
				cCs=x6|D].}|jdkr|j}d|j|<qqWdS(NRi(RKRLRh(Rtgrouplist_elemRQR((s-/usr/lib/python2.7/site-packages/yum/comps.pyRqts
	cCs�xy|D]q}|jdkr|j}d|j|<|jjd�}|rYt|�}nt}|rxd|j|<qxqqWdS(NRiR6(RKRLRiRNRR
RRj(Rtoptionlist_elemRQtoptionidtdefoptR6((s-/usr/lib/python2.7/site-packages/yum/comps.pyRrzs
	
cCs�x|jD]}d|j|<q
Wx|jD]}d|j|<q+Wx|jD]}d|j|<qLWx7|jD],}||jkrm|j||j|<qmqmWx7|jD],}||jkr�|j||j|<q�q�WdS(s-Add another environment object to this objectiN(tgroupsRhtdefaultoptionsRjtoptionsRiR*R,(RR\tgrpR%((s-/usr/lib/python2.7/site-packages/yum/comps.pyR^�scCs:d|j|jf}|d|j7}x1|jj�D] \}}|d||f7}q7W|d|j7}x1|jj�D] \}}|d||f7}q|W|d7}x|jD]}|d|7}q�W|d7}|d	7}x?|jD]4}||j	kr|d
|7}q�|d|7}q�W|d7}|d7}|S(
s2write out an xml stanza for the environment objectsE
  <environment>
   <id>%s</id>
   <display_order>%s</display_order>
s   <name>%s</name>
s!   <name xml:lang="%s">%s</name>
s!   <description>%s</description>
s0    <description xml:lang="%s">%s</description>
s    <grouplist>
s     <groupid>%s</groupid>
s    </grouplist>
s    <optionlist>
s*     <groupid default="true">%s</groupid>
s    </optionlist>
s  </environment>
(
RRRR*RaR-R,RwRyRx(RRbR%RcRz((s-/usr/lib/python2.7/site-packages/yum/comps.pyRe�s&




N(R.R/R0RRBRkR1t	allgroupsRlRwRmRyRnRxR@RqRrR^Re(((s-/usr/lib/python2.7/site-packages/yum/comps.pyRg"s					'		
	tCategorycBsSeZdZdd�Zd�Zee�Zd�Zd�Z	d�Z
d�ZRS(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.pyRB�s							cCs
|jj�S(N(RhRC(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyRl�scCs\xU|D]M}|jdkrI|j}|jdk	r=t�n||_q|jdkr�|j}|ry|jd�}n|jjt�}|r�||j	|<qT||_
q|jdkr|j}|r�|jd�}n|jjt�}|r||j|<qT||_q|jdkr0|j
|�q|jdkrt|j�|_qqWdS(NRFRRGR-RoR(RKRLRRRRMRNRROR*RR,R-RqRR(RRARQRRRLR%((s-/usr/lib/python2.7/site-packages/yum/comps.pyR@�s4
				cCs=x6|D].}|jdkr|j}d|j|<qqWdS(NRi(RKRLRh(RRsRQR((s-/usr/lib/python2.7/site-packages/yum/comps.pyRq�s
	cCs�x|jD]}d|j|<q
Wx7|jD],}||jkr+|j||j|<q+q+Wx7|jD],}||jkre|j||j|<qeqeWdS(s*Add another category object to this objectiN(RwRhR*R,(RR\RzR%((s-/usr/lib/python2.7/site-packages/yum/comps.pyR^�scCs�d|j|jf}|d|j7}x1|jj�D] \}}|d||f7}q7W|d|j7}x1|jj�D] \}}|d||f7}q|W|d7}x|jD]}|d|7}q�W|d7}|d	7}|S(
s/write out an xml stanza for the category objectsJ        
  <category>
   <id>%s</id>
   <display_order>%s</display_order>
s   <name>%s</name>
s!   <name xml:lang="%s">%s</name>
s!   <description>%s</description>
s0    <description xml:lang="%s">%s</description>
s    <grouplist>
s     <groupid>%s</groupid>
s    </grouplist>
s  </category>
(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	LangpackscBsJeZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	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|j�S(N(tlenR~(R((s-/usr/lib/python2.7/site-packages/yum/comps.pyt__len__,scCs(i|d6|d6}|jj|�dS(NRtinstall(R~R#(RRR�tlangpack((s-/usr/lib/python2.7/site-packages/yum/comps.pyR^/s
cCs�xo|D]g}|jdkr[i|jjd�d6|jjd�d6}|jj|�qtd|j��qW|jjd�|_|jjd�|_dS(NtmatchRR�s%Unexpected element in <langpacks>: %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  <langpacks>
s$    <match name="%s" install="%s"/>
RR�s  </langpacks>
(R~(RRbR�((s-/usr/lib/python2.7/site-packages/yum/comps.pyReDs	
 
N(
R.R/RRBR�R�R�R^R@Re(((s-/usr/lib/python2.7/site-packages/yum/comps.pyR}s					tCompscBs�eZed�Zd�Zd�Zd�Zd�Zee�Z	ee�Z
ee�Zee�Zd�Z
d�Zed�Zd�Zd	�Zed
�Zed�Zd�Zd
�Zd�Zd�Zdd�Zd�Zd�ZRS(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<lambda>\s(Rhtvaluestsort(Rtgrps((s-/usr/lib/python2.7/site-packages/yum/comps.pyt
get_groupsZscCs&|jj�}|jdd��|S(NR�cSs|j|jfS(N(RR(R�((s-/usr/lib/python2.7/site-packages/yum/comps.pyR�as(R�R�R�(Rtenvironments((s-/usr/lib/python2.7/site-packages/yum/comps.pytget_environments_scCs&|jj�}|jdd��|S(NR�cSs|j|jfS(N(RR(R�((s-/usr/lib/python2.7/site-packages/yum/comps.pyR�fs(R�R�R�(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(R�R(RR�R�((s-/usr/lib/python2.7/site-packages/yum/comps.pytreturn_groupysc
Csni}|sgSxQ|jd�D]@}|j�}||jkra|j|}|||j<q n|r�tjtj|��j}n$tjtj|�dtj	�j}t
}xW|jD]L}xC|j|j|j
fD])}	||	�r�t}|||j<Pq�q�Wq�W|rq nxH|jD]=}x4|jj�D]#}	||	�r5|||j<Pq5q5WqWq W|j�S(s;return all groups which match either by glob or exact matcht,tflags(tsplittstripRhRtretcompiletfnmatcht	translateR�tIRRwRRR4R*R�(
Rt
group_patterntcase_sensitivetreturnstitemt	thisgroupR�tdonetgroupR((s-/usr/lib/python2.7/site-packages/yum/comps.pyR��s6

$

cCs|j|�}|rtStS(N(treturn_environmentsR4R(RRR�((s-/usr/lib/python2.7/site-packages/yum/comps.pythas_environment�scCs!|j|�}|r|dSdS(s$Return the first group which matchesiN(R�R(RRR�((s-/usr/lib/python2.7/site-packages/yum/comps.pytreturn_environment�sc	Csni}|sgSxQ|jd�D]@}|j�}||jkra|j|}|||j<q n|r�tjtj|��j}n$tjtj|�dtj	�j}t
}xW|jD]L}xC|j|j|j
fD])}||�r�t}|||j<Pq�q�Wq�W|rq nxH|jD]=}x4|jj�D]#}||�r5|||j<Pq5q5WqWq W|j�S(sAreturn all environments which match either by glob or exact matchR�R�(R�R�R�RR�R�R�R�R�R�RR�RRR4R*R�(	Rtenv_patternR�R�R�tenvR�R�R((s-/usr/lib/python2.7/site-packages/yum/comps.pyR��s6

$

c	Csdi}xQ|jd�D]@}|j�}||jkrW|j|}|||j<qn|s{tjtj|��j}n$tjtj|�dtj	�j}t
}xW|jD]L}xC|j|j|j
fD])}||�r�t}|||j<Pq�q�Wq�W|rqnxH|jD]=}x4|jj�D]#}||�r+|||j<Pq+q+WqWqW|j�S(s?return all categories which match either by glob or exact matchR�R�(R�R�R�RR�R�R�R�R�R�Rt
categoriesRRR4R*R�(	Rtpatterntignore_caseR�R�tcatR�R�R((s-/usr/lib/python2.7/site-packages/yum/comps.pytreturn_categories�s2

$

cCsr|j|jkr^|j|j}|jrN|}|}|}|j|j<n|j|�n||j|j<dS(N(RRhR?R^(RR�t	thatgroupttmp((s-/usr/lib/python2.7/site-packages/yum/comps.pyt	add_groups	cCsr|j|jkr^|j|j}|jrN|}|}|}|j|j<n|j|�n||j|j<dS(N(RR�R?R^(RtenvironmentR�R�((s-/usr/lib/python2.7/site-packages/yum/comps.pytadd_environment
s	cCsF|j|jkr2|j|j}|j|�n||j|j<dS(N(RR�R^(Rtcategorytthatcat((s-/usr/lib/python2.7/site-packages/yum/comps.pytadd_categoryscCs|jj||�dS(N(R�R^(RRR�((s-/usr/lib/python2.7/site-packages/yum/comps.pytadd_langpack sc
Csz|st�nt|�tjkrlyt|d�}Wqrtk
rh}td||j|jf�qrXn|}|jd7_t	|_
t|�}y�x�|D]�\}}|jdkr�t
|�}|j|�n|jdkrt|�}|j|�n|jdkr-t|�}	|j|	�n|jdkr�|jj|�q�q�WWntk
rr}td�nX~dS(	Ntrtsopen(%s): #%u %siR�R�R�R~scomps file is empty/damaged(RRTttypestStringTypestopentIOErrorterrnotstrerrorR�RR�t	iterparseRKR2R�RgR�R|R�R�R@tSyntaxError(
RtsrcfiletinfiletetparserteventRAR�R�R�((s-/usr/lib/python2.7/site-packages/yum/comps.pyR^#s6	#	
cCs�i}x'|D]\}}}}}d||<q
Wx�|jD]�}t|j�dkr�t|_x�|jD]}	|	|krht|_PqhqhWq:|jj�|jj�|j	j�}
t|_x'|
D]}	|	|kr�t|_Pq�q�Wq:Wi}x!|jD]}|j||j
<q�Wx�|jD]�}|jrmt|_xf|jD]"}
|j|
�sDt|_PqDqDWq"t|_x*|j
D]}
|
|kr�t|_Pq�q�Wq"Wt|_dS(s4 compile the groups into installed/available groups iiN(RwR�R8R4R=RR9RCR:R;RR�RRyR�(Rt
pkgtuplisttinst_pkg_namestntaR�tvtrR�tpkgnamet
check_pkgstinst_grp_namestevgrouptgrpname((s-/usr/lib/python2.7/site-packages/yum/comps.pyR�Gs@		)	
						cCs�|jr2|jr2|jr2t|j�r2dSd}x$|j�D]}||j�7}qEWx$|j�D]}||j�7}qlWx$|j�D]}||j�7}q�W||j	�j�7}|d7}|S(s8returns the xml of the comps files in this class, mergedR3sz<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
<comps>
s

</comps>
(
RhR�R�R�R�R�ReR�R�R�(RRbtgtcR�((s-/usr/lib/python2.7/site-packages/yum/comps.pyReys
N(R.R/RRBR�R�R�R�R1RwR�R�R~R�R�R�R�R�R�R4R�R�R�R�R�RR^R�Re(((s-/usr/lib/python2.7/site-packages/yum/comps.pyR�Ns.						&		("				$	2cCs�ymtjdGHt�}x"tjdD]}|j|�q&WHdGHx@|jD]5}d||jfGHx|jD]}d|GHqoWqMWHdGHx`|jD]U}d|j|j	fGHx|jD]}d|GHq�Wx|j
D]}d|GHq�Wq�WHdGHxC|jD]8}d|j|jfGHx|jD]}d|GHq$Wq�WHdGHx(|j
D]}d	|d
|dfGHqKWWn6tk
r�tjdtjdIJtjd�nXdS(
Nis===== GROUPS =====s%s (id: %s)s  s===== ENVIRONMENTS =====s  *s===== CATEGORIES =====s===== LANGPACKS =====s	  %s (%s)RR�snewcomps.py: No such file:'%s'(tsystargvR�R^RwRRfR�RRRyR�RR~R�tstderrtexit(tpR�R�R]R�R�R�((s-/usr/lib/python2.7/site-packages/yum/comps.pytmain�s@	

t__main__(R�R�t
yum.constantst
yum.ErrorsRR�R�tyum.i18nRtyum.miscRRR�ROR
RtobjectR
R2RgR|R}R�R�R.(((s-/usr/lib/python2.7/site-packages/yum/comps.pyt<module>s*
		E��d0�E	(

Zerion Mini Shell 1.0