ó ™Tc@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|s7t|ƒ‚|jj|ƒ\} }| |jksdt‚|jj|ƒ} | sˆt|ƒ‚|j| ƒqÝqÝWx|D]}|jj|ƒq£WdS(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 tAssertionErrorRt 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.pyRis2   !   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_calltsysRIRJtCalledProcessErrort 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\Rc((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(RctTruetis_type_meta_functionRR>tFalse(R R\((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRf»s  cCs0|jjjdkrtS|jj|jƒtS(NtGQuark(tretvalttypetctypeRkRR>RcRi(R R\((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRgÆ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ƒ|jdtBoxedRR=tfieldsRkt disguised(R trecordtparenttprefixR(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR'Ìs0      cCs±|jdkr|j|ƒnŽ|jdkr>|j|ƒno|jdkr]|j|ƒnP|jdkr||j|ƒn1|jdkr›|j|ƒntd|jƒ‚dS( Ntenumtflagstclasst interfaceRCR€s"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|| jtMemberR1Ri(R R“t type_nameR:Rwt enum_nameR^tprevious_valuestpreviousR”R˜R%R—tklassR(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRøs<        cCs |jd}|jj|ƒ\}}||jks:t‚|dkrmtjd|jd|jjfƒn|jdƒr…d}nd}||t |ƒ fS(s6Infer the C symbol prefix from the _get_type function.sget-typeR:Ras²The GObject name %r isn't compatible with the configured identifier prefixes: %r The class would have no name. Most likely you want to specify a different --identifier-prefix.R%R`(sget_types _get_gtype( R™RR<RR;RRœtidentifier_prefixesRetlen(R R“R:RFR%t type_suffix((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 ru}tj |ƒnXt j |dd|d|d|d|ƒ}|j ||ƒ|j||ƒ|j||ƒ|j||ƒ|j|ƒ|jj|dtƒdS(NR%tabstractRuR:RwRRx(R™tboolR=RkRšRR›RRRœRR6R t_parse_parentst_introspect_propertiest_introspect_signalst"_introspect_implemented_interfacesR‚RR>Ri( R R“R¡RR:Rwt object_nameR^R(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRŽ7s$   c Csx|jd}|j|ƒ\}}y|jj|ƒ}Wn tk rZ}tj|ƒnXtj|dd|d|d|ƒ}|j ||ƒ|j ||ƒxF|j dƒD]5}|jd} tj j| ƒ} |jj| ƒq¯W|jj|jƒ} t| tjƒr| j|_ntj|d|jfƒ|jdjdƒr^||j|RR=R%R"R&Rot warn_nodeRdRRi( R R“R¡R:Rwtinterface_nameR^R(RBR%tprereqR†((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRKs.   cCs5tjdddddddƒ}||j|jt interfaces(R R(R“t gt_interfacesRŒtgitype((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR®‡s c CsÅx²|jdƒD]¡}|jd}t|jdƒ}|t@dk}|t@dk}|t@dk}|t@dk} |jjt j |jdt j j |ƒ|||| ƒƒqW|j|_dS(NtpropertyRnRŠiR%( RŸR™tinttG_PARAM_READABLEtG_PARAM_WRITABLEtG_PARAM_CONSTRUCTtG_PARAM_CONSTRUCT_ONLYt propertiesR>RtPropertyR~R±( R R(R“tpspecRoRŠtreadabletwritablet constructtconstruct_only((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR¬Žs  cCs¼x©|jdƒD]˜}|jd}tjj|ƒ}tj|ƒ}g}|jjdƒ}|jjddƒdk} |jjddƒdk} |jjddƒdk} |jjd dƒdk} x“t|jd ƒƒD]|\} }| d krÿd }nd | df}|jd}tjj|ƒ}tj||ƒ}tj |_ |j |ƒqÞWtj |jd||d|d| d| d| d| ƒ}|j j |ƒqW|j |_ dS(Ntsignaltreturntwhens no-recurset0t1tdetailedtactionsno-hookstparamitobjectsp%siRnR%t no_recursetno_hooks(RŸR™RR~R±tReturnR=t enumeratet ParametertPARAM_TRANSFER_NONEttransferR>tSignaltsignals(R R(R“t signal_infotrctypetrtypetreturn_t parametersRÎRÕRÑRÒRÖtit parametertargnametpctypetptypeRÓRÌ((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR­œs0 "    cCsR|jjddƒ}|dkr?td„|jdƒƒ}ng}||_dS(NtparentsRcSstjj|ƒS(N(RR~R±(ts((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytº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©RuR:RwRRx(R™RªR=RkRšRR›RRtwarnRR6R R«RiR€R®R‚RR>( R R“R¡RR:Rwtfundamental_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&RoR„tFieldRkRÉ(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(NtfunctiontdomainRx( R™Rt get_by_symbolR RtErrorQuarkFunctionR%RmRâtthrowsRcR>Ri(R R“Rct 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|ƒnbt |t j t j fƒrÅ|j |j|jƒ|jdk s­t‚|j|_t|_ntSdS(N(RR›RuRRRœRR=R>R"RR&tUniont add_gtypeR:RwR R;RkR…(R RCR%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$RfRgR'R3RRšRŽRRºRR®R¬R­R«R‘R‚R2R5R8(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRAs6     ' "    .   !       iiiiii i@i€(RKRTR RXRRtxml.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,