ó æ+ðUc@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 ((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyt__init__/s  N(t__name__t __module__R R(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR-st UnresolvedcBseZd„ZRS(cCs ||_dS(N(ttarget(R R((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR9s(RRR(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR7stUnknownTypeErrorcBseZRS((RR(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR=st GDumpParsercBsû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(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((su/home/vagrant/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((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyt init_parseOs$cCs|jS(N(R(R ((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytget_get_type_functions`scCs|jS(N(R(R ((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytget_error_quark_functionscscCs ||_dS(N(R(R tbinary((su/home/vagrant/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((su/home/vagrant/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((su/home/vagrant/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((su/home/vagrant/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[((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRe»s  cCs0|jjjdkrtS|jj|jƒtS(NtGQuark(tretvalttypetctypeRjRR=RbRh(R R[((su/home/vagrant/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((su/home/vagrant/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((su/home/vagrant/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(((su/home/vagrant/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((su/home/vagrant/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(((su/home/vagrant/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((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR5ðs  cCs³d}t|tjƒr4|jj|jdƒ}n4x1dD])}|jj|j|ƒ}|r;Pq;q;W|o}t|tjƒs„dS|jƒ|_ |j |ƒ|jƒ|_ dS(NR6tIfaceR7(Rýs Interface( R R"RR6RR<R%R&t create_typetglib_type_structtinherit_file_positionstis_gtype_struct_for(R tclst pair_recordtsuffix((su/home/vagrant/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ªRRR2R5R8(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRAs6     ' "    .   !       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(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyts,