ó ‡ÎÊZc@`shddlmZddlmZddlmZddlmZddlZddlZddlZddlZddl Z ddl m Z ddl m Z dd l mZdd l mZdd lmZdd lmZdZdZdZdZdZd Zd!Zd"Zdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZ dS(#i(tabsolute_import(tdivision(tprint_function(tunicode_literalsN(tparsei(tast(tmessage(tutils(tTransformerException(tto_underscoresiiiiiitIntrospectionBinarycB`seZdd„ZRS(cC`s:||_|dkr-tjddƒ|_n ||_dS(Nuutmp-introspect(targstNonettempfiletmkdtempttmpdir(tselfR R((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyt__init__4s  N(t__name__t __module__R R(((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR 2st UnresolvedcB`seZd„ZRS(cC`s ||_dS(N(ttarget(RR((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR>s(RRR(((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR<stUnknownTypeErrorcB`seZRS((RR(((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRBst GDumpParsercB`sûeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cC`sO||_|j|_d|_g|_g|_i|_i|_i|_ dS(N( t _transformert namespacet _namespaceR t_binaryt_get_type_functionst_error_quark_functionst_error_domainst _boxed_typest_private_internal_types(Rt transformer((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRHs       cC`s£x9|jjƒD](}t|tjƒr|j|ƒqqW|jjdks`|jjdkrŸx<|jjƒD](}t|tjƒrp|j|ƒqpqpWndS(uŽDo parsing steps that don't involve the introspection binary This does enough work that get_type_functions() can be called. uGObjectuGLibN( Rtvaluest isinstanceRtFunctiont_initparse_functiontnametRecordt_initparse_gobject_record(Rtnode((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyt init_parseTs$cC`s|jS(N(R(R((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytget_get_type_functionsescC`s|jS(N(R(R((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytget_error_quark_functionshscC`s ||_dS(N(R(Rtbinary((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytset_introspection_binaryksc C`sˆ|jƒ}|jƒ}x:|D]2}|jdkrD|j|ƒq|j|ƒqWx*|jjƒD]\}}|j|ƒqeWxB|jj ƒD]1}t |t j t j fƒr’|j|ƒq’q’Wg}x“|jjƒD]‚\}}t |t jƒrÝ|jdk rÝ|j}|dkr%qÝn|jj|ƒ\} }|jj|ƒ} |j| ƒqÝqÝWx|D]}|jj|ƒqjWdS(u9Do remaining parsing steps requiring introspection binaryu error-quarkuinternN(t_execute_binary_get_treetgetrootttagt_introspect_error_quarkt_introspect_typeRtitemst_pair_boxed_typeRR"R#RtClasst Interfacet_find_class_recordt Registeredtget_typeR Rt split_csymboltgettappendtremove( RttreetroottchildR&tboxedR)t to_removet get_type_nametnst get_type_func((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRns,   !   cC`s¥tjj|jjdƒ}t|dƒ}}x8|jD]-}|jdƒ|j|ƒ|jdƒq7Wx8|jD]-}|jdƒ|j|ƒ|jdƒqrWWdQXtjj|jjdƒ}g}tj j dƒ}|rø|j |j ƒƒn|j |jj ƒ|jd ||fƒzVy#tj|d tjd tjƒWn"tjk rl}t|ƒ‚nXt|ƒSWdtjd ƒs tj|jjƒnXdS( uwLoad the library (or executable), returning an XML blob containing data gleaned from GObject's primitive introspection.u functions.txtuwu get-type:u u error-quark:Nudump.xmluGI_CROSS_LAUNCHERu--introspect-dump=%s,%ststdouttstderru save-temps(tostpathtjoinRRtopenRtwriteRtenvironR<textendtsplitR R=t subprocesst check_calltsysRGRHtCalledProcessErrort SystemExitRRthave_debug_flagtshutiltrmtree(Rtin_pathtftfunctout_pathR tlauncherte((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR/•s2    #cC`sm|j}|jdƒrdS|jdƒs:|jdƒrJ|j|ƒn|jdƒri|j|ƒndS(Nu_u _get_typeu _get_gtypeu _error_quark(tsymbolt startswithtendswitht_initparse_get_type_functiont_initparse_error_quark_function(RR[R_((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR%¼s cC`s:|jdkrtS|jƒr6|jj|jƒtStS(Nug_variant_get_gtype(R_tTruetis_type_meta_functionRR=tFalse(RR[((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRbÅs  cC`s0|jjjdkrtS|jj|jƒtS(NuGQuark(tretvalttypetctypeRfRR=R_Rd(RR[((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRcÐsc C`sZ|jjdƒré|jdkréd}|jdkrKtjddƒ}nt|jƒjƒ}tj|j|d|jd|jj d d ƒd d d |ƒ}t |_ |jdkrÃt |_ n|j |ƒ|jj|dt ƒnm|jdkr#tjdddd d d dƒ|jd|j|ƒno|jdkr]|j|ƒnP|jdkr||j|ƒn1|jdkr›|j|ƒntd|jƒ‚dS( Nuenumuflagsuclassu interfaceuboxedu fundamentalu"Unhandled introspection XML tag %s(uenumuflags(R1t_introspect_enumt_introspect_objectt_introspect_interfacet_introspect_boxedt_introspect_fundamentalt ValueError(Rtxmlnode((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR3ôsc C`s­|jd}|j|ƒ\}}y|jj|ƒ}Wn tk rZ}tj|ƒnXi}|jj|ƒ}t |t j t j fƒrµx$|j D]} | j|| jÄsu,(RR<tlisttmapRPt parent_chain(RRR)t parents_strt parent_types((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR”Ás   c C`sñ|jd}t|jjdtƒƒ}|j|ƒ\}}y|jj|ƒ}Wn!tk rv}tj |ƒdSXt j |dd|d|d|d|ƒ}|j ||ƒt|_|j||ƒ|j|ƒ|jj|dtƒdS(NunameuabstractRkR:RlRqRm(RR“R<RfR‚RRƒRRtwarnRR6R R”RdRpR—RrRR=( RRRŠRqR:Rltfundamental_nameR^R)((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR}Ês$     cC`sy|jj|jƒ}t|tjƒs+dS|j|_|j|_x/|jD]$}t|tjƒrMt |_ qMqMWdS(N( RR<R&R#RR'RiRttFieldRfR­(RR)Rvtfield((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRrás  cC`sƒ|jd}|jd}|jj|ƒ}|dkr<dStj|j|j|j|j |j |ƒ}|jj |dt ƒdS(NufunctionudomainRm( RRt get_by_symbolR RtErrorQuarkFunctionR&RgRÀtthrowsR_R=Rd(RRR_t error_domaintfunctionR)((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR2îs    cC`s¸y|jj|jƒ}Wn tk r;}tj|ƒnX|jj|ƒ}|sg|jj|ƒnMt |t j t j fƒr°|j |j|jƒ|j|_t|_ntSdS(N(RRƒRkRRR„RR<R=R#RR'tUniont add_gtypeR:RlRfRu(RRBR&R^t pair_node((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR5ús  cC`s³d}t|tjƒr4|jj|jdƒ}n4x1dD])}|jj|j|ƒ}|r;Pq;q;W|o}t|tjƒs„dS|jƒ|_ |j |ƒ|jƒ|_ dS(NuClassuIfaceu Interface(uIfaceu Interface( R R#RR6RR<R&R't create_typetglib_type_structtinherit_file_positionstis_gtype_struct_for(Rtclst pair_recordtsuffix((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR8 s  (RRRR*R+R,R.RR/R%RbRcR(R3RyR‚RzR{RžR|R—R•R–R”R}RrR2R5R8(((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRFs6     ' '    .   !       iiiiii i@i€(!t __future__RRRRRIRSR RWRQtxml.etree.cElementTreeRtRRRR!RR R¤R¥R¦R§tG_PARAM_LAX_VALIDATIONtG_PARAM_STATIC_NAMEtG_PARAM_STATIC_NICKtG_PARAM_STATIC_BLURBtobjectR Rt ExceptionRR(((so/home/vagrant/ruby-gnome2/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyts4