Ñò #ßøTc @sÝddkZddkZddkZddklZddklZddklZde fd„ƒYZ ei ede ƒe _ de fd„ƒYZd e fd „ƒYZed d d gƒZdefd„ƒYZdS(iÿÿÿÿN(t namedtuple(t_allow_variant(tEmptyIt _VariantscBsbeZed„Zd„Zd„Zd d„Zd„Zd d„Z d„Z d„Z d„Z RS( cCs<ti|ƒtƒ|_x|D]}||||scCs#||jo|||, ) where key is the explicitly set variant name that matched the caller specific variant name.svariant.skey must start w/ variant.svariant.debug.tfalsesunknown variant %sN(Nsfalse(t startswithtKeyErrorRt __getitem__R(RR ((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyt__getitem_internal[s   cCs|i|ƒdS(Ni(t_Variants__getitem_internal(RR ((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyR#qs(RRt__doc__R%R#(((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyRVs tVariantCombinationTemplatecBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( sQClass for holding a template of variant types and their potential values.cCs t|ƒS(N(R'(R((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyt__copy__scCsZt|tƒot|ƒ}n$t|tƒpt|gƒ}nti|||ƒdS(sSOverrides _Variants.__setitem__ to ensure that all values are sets.N(t isinstancetlistRRR (RR R((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyR s cCs"|i|ƒ}|i o|i S(s0Returns whether self is a subset of variant var.(t differencet type_diffst value_diffs(Rtvartres((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pytissubsetšscCsxtggƒ}xb|D]Z}||jo|ii|ƒqx0||||D]}|ii||fƒqPWqW|S(N(t VCTDifferenceR,tappendR-(RR.R/tktv((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyR+Ÿs cCs4x-|D]%}||jo||||(tsortedtjoin(RtsR3t_[1]R4tt((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyt__str__·s 8( RRR&R(R R0R+R6R7R8R@(((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyR'‰s     R1R,R-tVariantCombinationscBsãeZdZd„Zed„ƒZed„ƒZed„ƒZd„Zd„Z d„Z d„Z d „Z e d „Zd „Zd „Zd „Zd„Zd„Zd„Zed„Zd„Zd„Zd„Zd„ZRS(sClass for keeping track of which combinations of variant values have and have not been satisfied for a particular action.c CsCt|tƒpt‚tƒ|_tƒ|_g}x–t|ƒD]ˆ}|p5g}||D]}|||fgq^~}qBng}||D](}|D]}||||fgqq“~} | }qBWg} |D]} | t| ƒqÙ~ |_t|iƒ} |o | |_n | |_t i |ƒ|_ d|_ dS(sCreate an instance of VariantCombinations based on the template provided. The 'vct' parameter is the template from which to build the combinations. The 'satisfied' parameter is a boolean which determines whether the combinations created from the template will be considered satisfied or unsatisfied.N( R)R'tAssertionErrorRt_VariantCombinations__sat_sett!_VariantCombinations__not_sat_setR;t frozensett"_VariantCombinations__combinationsRt_VariantCombinations__templateRt$_VariantCombinations__simpl_template( Rtvctt satisfiedttmpR3R>R4t_[2]texisttnew_tmpt_[3]tlR/((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyRÎs&    .+ *  cCs|iS(N(RG(R((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyttemplatescCs#|ip|iS|itƒSdS(N(RHRCt!_VariantCombinations__calc_simpletTrue(R((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pytsat_set s cCs#|ip|iS|itƒSdS(N(RHRDRRtFalse(R((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyt not_sat_sets cCsXt|itƒ}ti|iƒ|_ti|iƒ|_|i|_|i|_|S(N(RARGRSRRCRDRHRF(Rtvc((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyR(s   cCs\|i|ijoI|i|ijo6|i|ijo#|i|ijo|i|ijS(N(RGRCRDRHRF(Rtother((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyt__eq__ s cCs|i|ƒ S(N(RY(RRX((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyt__ne__'scCs|i o|i S(sSReturns whether self was created with any potential variant values.(RCRD(R((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pytis_empty*scCs2|o|ii|iƒS|ii|iƒSdS(sReturns whether the instances in self are a subset of the instances in vc. 'satisfied' determines whether the instances compared are drawn from the set of satisfied instances or the set of unsatisfied instances.N(RCR0RD(RRWRJ((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyR00scCsN|iƒp |iƒotS|i|ƒ}|ot|iƒS|iƒ S(sŸReturns whether an action whose variants are vc could satisfy dependencies whose variants are self. 'only_not_sat' determines whether only the unsatisfied set of variants for self is used for comparision. When only_not_sat is True, then intersects returns wether vc would satisfy at least one instance which is currently unsatisfied.(R[RSt intersectiontboolRD(RRWt only_not_satRK((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyt intersects;s cCsTt|iƒdjpt‚ti|ƒ}|i|iM_|i|iM_|S(sXFind those variant values in self that are also in var, and return them.i(tlenRVRBRRCRD(RRWR/((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyR\Ks cCsŸd}d}d}|iƒo|iƒod|dfS|ii|iƒo|}|}n4|ii|iƒo|}|}n|d|fS|i|i@o;t|itƒ}|i|i@|_|i|i8_n|i|io;t|itƒ}|i|i|_|i|i8_n|i|io;t|itƒ}|i|i|_|i|i8_n||jo|||fS|||fS(syFind those combinations of variants that are satisfied only in self, in both self and vc, and only in vc.N(RR[RGR0RCRARURD(RRWt intersecttonly_bigt only_smalltbigtsmall((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pytseparate_satisfiedTs6    cCs>|i|i@}|ptS|i|8_|i|O_tS(s£For all instances in vc, mark those instances as being satisfied. Returns a boolean indicating whether any changes have been made.(RCRDRURS(RRWR ((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pytmark_as_satisfied~s cCs>|i|i@}|ptS|i|8_|i|O_tS(s]For all satisfied instances in vc, mark those instances as being unsatisfied.(RCRURDRS(RRWR ((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pytmark_as_unsatisfiedŠs cCs"|i|iO_tƒ|_dS(s&Mark all instances as being satisfied.N(RCRDR(R((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pytmark_all_as_satisfied•scCs|i S(s^Returns whether all variant combinations for this package have been satisfied.(RD(R((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyt is_satisfied›scCsb|ii|ƒpBh|_|o.|ii|ƒptd|i|f‚qUn||_dS(swStore the provided VariantCombinationTemplate as the template to use when simplifying the combinations.stemplate:%s vct:%sN(RGR0RHRB(RRItassert_on_different_domains((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pytsimplify¡s cCszg}xL|iD]A}t|itƒ}|ii|ƒtƒ|_|i|ƒqW|p|it i |ƒƒn|S(sÄCreate one VariantCombination object for each possible combination of variants. This is useful when each combination needs to be associated with other information.( RFRARGRURCR RRDR2R(RRKtcRW((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pytsplit_combinations­s  cCst|itƒS(s€Create a copy of this variant combination, but make sure all the variant combinations are marked as unsatisifed.(RARGRU(R((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pytunsatisfied_copy¾sc sÇ|ip d}n2d}x(|iD]}|t|i|ƒ9}q$W|o |i}n |i}|t|ƒjotƒSt}x=|o5t}x(|iD]‰‡fd†}tƒ}xötit |d|ƒ|ƒD]Ö\}}t|ƒ}t|ƒt|iˆƒjo||O}qÚnt|iˆƒ} xF|D]>} x5| D]-\} } | ˆjoqJn| i | ƒqJWq=W| o||O}qÚnt}|i t |ƒƒqÚW|}qWq†W|S(s–Given VariantCombinationTemplate to be simplified against, reduce the instances to the empty set if the instances cover all possible combinations of the template provided. A general approach to simplification is currently deemed to difficult in the face of arbitrary numbers of variant types and arbitrary numbers of variant.iics<g}|D]*\}}|ˆjo|||fq q ~S(N((R R>R3R4(t variant_name(s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyt exclude_nameæstkey( RHR`RCRDRRSRUt itertoolstgroupbyR;RR RE( Rtsatt possibilitiesR3trel_sett keep_goingRqt new_rel_settgtexpectedttuptv_nametv_value((Rps1/usr/lib/python2.6/vendor-packages/pkg/variant.pyt __calc_simpleÄsZ                cCs dt|iƒt|iƒfS(NsVC Sat:%s Unsat:%s(R;RCRD(R((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyR8,s(RRR&RtpropertyRQRTRVR(RYRZR[R0RUR_R\RfRgRhRiRjRSRlRnRoRRR8(((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyRAÊs, 8      *     h(RRsttypest collectionsRt pkg._varcetRtpkg.miscRRRt MethodTypeRt allow_actionRR'R1tobjectRA(((s1/usr/lib/python2.6/vendor-packages/pkg/variant.pyts   .39