ó =ã¾Rc@s(ddlZddlZddlZddlZddlZddlmZddlmZddlm Z ddlm Z ddl m Z ddl m Z dZdZdZdZdZdZdZdZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdS( iÿÿÿÿN(tparsei(tast(tmessage(tutils(tTransformerException(tto_underscoresiiiiiiitIntrospectionBinarycBseZdd„ZRS(cCs:||_|dkr-tjddƒ|_n ||_dS(Ntstmp-introspect(targstNonettempfiletmkdtempttmpdir(tselfRR ((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyt__init__/s  N(t__name__t __module__R R(((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR-st UnresolvedcBseZd„ZRS(cCs ||_dS(N(ttarget(R R((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR9s(RRR(((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR7stUnknownTypeErrorcBseZRS((RR(((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR=st GDumpParsercBseZd„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„Zd„ZRS(cCsO||_|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(R t transformer((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRCs       cCs£x9|jjƒD](}t|tjƒr|j|ƒqqW|jjdks`|jjdkrŸx<|jjƒD](}t|tjƒrp|j|ƒqpqpWndS(sŽDo parsing steps that don't involve the introspection binary This does enough work that get_type_functions() can be called. tGObjecttGLibN( Rt itervaluest isinstanceRtFunctiont_initparse_functiontnametRecordt_initparse_gobject_record(R tnode((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyt init_parseOs$cCs|jS(N(R(R ((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytget_get_type_functions`scCs|jS(N(R(R ((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytget_error_quark_functionscscCs ||_dS(N(R(R tbinary((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytset_introspection_binaryfsc Csˆ|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(s9Do remaining parsing steps requiring introspection binarys error-quarktinternN(t_execute_binary_get_treetgetrootttagt_introspect_error_quarkt_introspect_typeRt iteritemst_pair_boxed_typeRR!R"RtClasst Interfacet_find_class_recordt Registeredtget_typeR Rt split_csymboltgettappendtremove( R ttreetroottchildR%tboxedR(t to_removet get_type_nametnst get_type_func((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRis,   !   cCsxtjj|jjdƒ}t|dƒ}x8|jD]-}|jdƒ|j|ƒ|jdƒq4Wx8|jD]-}|jdƒ|j|ƒ|jdƒqoW|j ƒtjj|jjdƒ}g}|j |jj ƒ|j d||fƒzVy#t j|dtjd tjƒWn"t jk r?}t|ƒ‚nXt|ƒSWd tjd ƒsstj|jjƒnXd S( swLoad the library (or executable), returning an XML blob containing data gleaned from GObject's primitive introspection.s functions.txttws get-type:s s error-quark:sdump.xmls--introspect-dump=%s,%ststdouttstderrNs save-temps(tostpathtjoinRR topenRtwriteRtclosetextendRR=t subprocesst check_calltsysRHRItCalledProcessErrort SystemExitRRthave_debug_flagtshutiltrmtree(R tin_pathtftfunctout_pathRte((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR/s.     #cCsm|j}|jdƒrdS|jdƒs:|jdƒrJ|j|ƒn|jdƒri|j|ƒndS(Nt_t _get_typet _get_gtypet _error_quark(tsymbolt startswithtendswitht_initparse_get_type_functiont_initparse_error_quark_function(R R[Rb((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR$²s cCs:|jdkrtS|jƒr6|jj|jƒtStS(Ntg_variant_get_gtype(RbtTruetis_type_meta_functionRR=tFalse(R R[((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRe»s  cCs0|jjjdkrtS|jj|jƒtS(NtGQuark(tretvalttypetctypeRjRR=RbRh(R R[((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRfÆsc CsZ|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( Ntenumtflagstclasst interfaceRBRs"Unhandled introspection XML tag %s(Rˆsflags(R1t_introspect_enumt_introspect_objectt_introspect_interfacet_introspect_boxedt_introspect_fundamentalt ValueError(R txmlnode((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR3êsc Cs­|jd}|j|ƒ\}}y|jj|ƒ}Wn tk rZ}tj|ƒnXi}|jj|ƒ}t |t j t j fƒrµx$|j D]} | j|| jÅst,(R˜R<tmaptsplitt parent_chain(R R’R(t parents_strt parent_types((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR¬Âs   c Csñ|jd}t|jjdtƒƒ}|j|ƒ\}}y|jj|ƒ}Wn!tk rv}tj |ƒdSXt j |dd|d|d|d|ƒ}|j ||ƒt|_|j||ƒ|j|ƒ|jj|dtƒdS(NR%R¨RtR:RvR€Rw(R˜R«R<RjR™RRšRRtwarnRR6R R¬RhRR¯RRR=( R R’R R€R:Rvtfundamental_nameR]R(((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRËs$     cCsy|jj|jƒ}t|tjƒs+dS|j|_|j|_x/|jD]$}t|tjƒrMt |_ qMqMWdS(N( RR<R%R"RR&RnRƒtFieldRjRÊ(R R(R…tfield((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRâs  cCsƒ|jd}|jd}|jj|ƒ}|dkr<dStj|j|j|j|j |j |ƒ}|jj |dt ƒdS(NtfunctiontdomainRw( R˜Rt get_by_symbolR RtErrorQuarkFunctionR%RlRãtthrowsRbR=Rh(R R’Rbt error_domainRöR(((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR2ïs    cCs¸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šRtRRR›RR<R=R"RR&tUniont add_gtypeR:RvRjR„(R RBR%R]t pair_node((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR5ûs  cCsE|jdƒs|jdƒr&|d S|jdƒr=|d SdSdS(NR6tIfaceiûÿÿÿR7i÷ÿÿÿ(RdR (R R%((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyt_strip_class_suffixs cCs³d}t|tjƒr4|jj|jdƒ}n4x1dD])}|jj|j|ƒ}|r;Pq;q;W|o}t|tjƒs„dS|jƒ|_ |j |ƒ|jƒ|_ dS(NR6RÿR7(sIfaces Interface( R R"RR6RR<R%R&t create_typetglib_type_structtinherit_file_positionstis_gtype_struct_for(R tclst pair_recordtsuffix((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR8s  (RRRR)R*R+R-RR/R$ReRfR'R3RŒR™RRŽR»RR¯R­R®R¬RRR2R5RR8(((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRAs8     ' "    .   !        iiiiii i@i€(RJRSR RWRQtxml.etree.cElementTreeRRRRRRRRRÂRÃRÄRÅtG_PARAM_LAX_VALIDATIONtG_PARAM_STATIC_NAMEtG_PARAM_STATIC_NICKtG_PARAM_STATIC_BLURBRÕRRt ExceptionRR(((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyts,