ó ¸&,Yc@`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((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyt__init__4s  N(t__name__t __module__R R(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR 2st UnresolvedcB`seZd„ZRS(cC`s ||_dS(N(ttarget(RR((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR>s(RRR(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR<stUnknownTypeErrorcB`seZRS((RR(((su/home/vagrant/ruby-gnome2.win32/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((su/home/vagrant/ruby-gnome2.win32/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((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyt init_parseTs$cC`s|jS(N(R(R((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytget_get_type_functionsescC`s|jS(N(R(R((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytget_error_quark_functionshscC`s ||_dS(N(R(Rtbinary((su/home/vagrant/ruby-gnome2.win32/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|s7t|ƒ‚|jj|ƒ\} }| |jksdt‚|jj|ƒ} | sˆt|ƒ‚|j| ƒqÝqÝWx|D]}|jj|ƒq£WdS(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 tAssertionErrorRt split_csymboltgettappendtremove( RttreetroottchildR&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.pyRns2   !   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_calltsysRHRItCalledProcessErrort SystemExitRRthave_debug_flagtshutiltrmtree(Rtin_pathtftfunctout_pathR tlauncherte((su/home/vagrant/ruby-gnome2.win32/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`((su/home/vagrant/ruby-gnome2.win32/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\((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRcÅs  cC`s0|jjjdkrtS|jj|jƒtS(NuGQuark(tretvalttypetctypeRgRR>R`Re(RR\((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRdÐ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ƒ|jdtBoxedRR=tfieldsRgt disguised(RtrecordtparenttprefixR)((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR(Ös0      cC`s±|jdkr|j|ƒnŽ|jdkr>|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((su/home/vagrant/ruby-gnome2.win32/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|| jtMemberR1Re(RR€t type_nameR:Rmt enum_nameR_tprevious_valuestprevioustmemberRR&RˆtklassR)((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRzs<        cC`s |jd}|jj|ƒ\}}||jks:t‚|dkrmtjd|jd|jjfƒn|jdƒr…d}nd}||t |ƒ fS(u6Infer the C symbol prefix from the _get_type function.uget-typeuget_typeu _get_gtypeu´The GObject name '%s' 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.unameu _get_type(uget_typeu _get_gtype( R‚RR<RR;RR…tidentifier_prefixesRbtlen(RR€R:RFR&t type_suffix((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRƒ0s  ! c C`s|jd}t|jjdtƒƒ}|j|ƒ\}}y|jj|ƒ}Wn tk ru}tj |ƒnXt j |dd|d|d|d|ƒ}|j ||ƒ|j||ƒ|j||ƒ|j||ƒ|j|ƒ|jj|dtƒdS(NunameuabstractRlR:RmRrRn(R‚tboolR=RgRƒRR„RRR…RR6R t_parse_parentst_introspect_propertiest_introspect_signalst"_introspect_implemented_interfacesRsRR>Re( RR€R‹RrR:Rmt object_nameR_R)((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR{As$   c C`sx|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'Rjt warn_nodeRaR Re( RR€R‹R:Rmtinterface_nameR_R)RBR&tprereqRw((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR|Us.   cC`s5tjdddddddƒ}||j|jt interfaces(RR)R€t gt_interfacest interfacetgitype((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR˜‘s c C`sÅx²|jdƒD]¡}|jd}t|jdƒ}|t@dk}|t@dk}|t@dk}|t@dk} |jjt j |jdt j j |ƒ|||| ƒƒqW|j|_dS(Nupropertyutypeuflagsiuname( R‰R‚tinttG_PARAM_READABLEtG_PARAM_WRITABLEtG_PARAM_CONSTRUCTtG_PARAM_CONSTRUCT_ONLYt propertiesR>RtPropertyRoRš( RR)R€tpspecRjtflagstreadabletwritablet constructtconstruct_only((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR–˜s  cC`s¼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(Nusignalureturnuwhenu no-recurseu0u1udetaileduactionuno-hooksuparamiuobjectup%siutypeunametwhent no_recursetdetailedtactiontno_hooks(R‰R‚RRoRštReturnR=t enumeratet ParametertPARAM_TRANSFER_NONEttransferR>tSignaltsignals(RR)R€t signal_infotrctypetrtypetreturn_t parametersR±R²R³R´Rµtit parametertargnametpctypetptypetparamtsignal((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR—¦s0 "    cC`sX|jjddƒ}|dkrEttd„|jdƒƒƒ}ng}||_dS(NuparentsucS`stjj|ƒS(N(RRoRš(ts((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pytÄsu,(R‚R=tlisttmapRQt parent_chain(RR€R)t parents_strt parent_types((su/home/vagrant/ruby-gnome2.win32/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(NunameuabstractRlR:RmRrRn(R‚R”R=RgRƒRR„RRtwarnRR6R R•ReRqR˜RsRR>( RR€R‹RrR:Rmtfundamental_nameR_R)((su/home/vagrant/ruby-gnome2.win32/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'RjRutFieldRgR®(RR)Rwtfield((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRsás  cC`sƒ|jd}|jd}|jj|ƒ}|dkr<dStj|j|j|j|j |j |ƒ}|jj |dt ƒdS(NufunctionudomainRn( R‚Rt get_by_symbolR RtErrorQuarkFunctionR&RhRÁtthrowsR`R>Re(RR€R`t error_domaintfunctionR)((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR2îs    cC`sÍ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„RlRRR…RR=R>R#RR'tUniont add_gtypeR:RmR R;RgRv(RRCR&R_t pair_node((su/home/vagrant/ruby-gnome2.win32/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((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR8 s  (RRRR*R+R,R.RR/R%RcRdR(R3RzRƒR{R|RŸR}R˜R–R—R•R~RsR2R5R8(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRFs6     ' '    .   !       iiiiii i@i€(!t __future__RRRRRJRTR RXRRtxml.etree.cElementTreeRtRRRR!RR R¥R¦R§R¨tG_PARAM_LAX_VALIDATIONtG_PARAM_STATIC_NAMEtG_PARAM_STATIC_NICKtG_PARAM_STATIC_BLURBtobjectR Rt ExceptionRR(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyts4