^9Uc@s(ddlZddlZddlZddlZddlZddlmZddlmZddlm Z ddlm Z ddl m Z ddl m Z dZdZdZdZdZdZdZdZdefdYZdefdYZdefdYZdefdYZdS( iN(tparsei(tast(tmessage(tutils(tTransformerException(tto_underscoresiiiiiiitIntrospectionBinarycBseZddZRS(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 UnresolvedcBseZdZRS(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 GDumpParsercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZRS(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       cCsx9|jjD](}t|tjr|j|qqW|jjdks`|jjdkrx<|jjD](}t|tjrp|j|qpqpWndS(sDo 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*|jjD]\}}|j|qeWxB|jj D]1}t |t j t j fr|j|qqWg}x|jjD]\}}t |t jr|jdk r|j}|dkr%qn|s7t||jj|\} }| |jksdt|jj|} | st||j| qqWx|D]}|jj|qWdS(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||jdq4Wx8|jD]-}|jd|j||jdqoW|j tjj|jjd}g}|j |jj |j d||fzVy#t j|dtjd tjWn"t jk r?}t|nXt|SWd tjd sstj|jjnXd 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}|jdrdS|jds:|jdrJ|j|n|jdri|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|jr6|jj|jtStS(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.pyRfs  cCs0|jjjdkrtS|jj|jtS(NtGQuark(tretvalttypetctypeRkRR>RcRi(R R\((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRgsc CsZ|jjdr|jdkrd}|jdkrKtjdd}nt|jj}tj|j|d|jd|jj d d d d d |}t |_ |jdkrt |_ 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|jdS( Ntenumtflagstclasst interfaceRCRs"Unhandled introspection XML tag %s(Rsflags(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.pyR3sc Cs|jd}|j|\}}y|jj|}Wn tk rZ}tj|nXi}|jj|}t |t j t j frx$|j D]} | j|| jtMemberR1Ri(R Rt type_nameR:Rwt enum_nameR^tprevious_valuestpreviousRRR%RtklassR(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRs<        cCs|jd}|jj|\}}||jks:t|dkrmtjd|jd|jjfn|jdrd}nd}||t | fS(s6Infer the C symbol prefix from the _get_type function.sget-typeR:RasThe 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( RRR<RR;RRtidentifier_prefixesRetlen(R RR: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|dtdS(NR%tabstractRuR:RwRRx(RtboolR=RkRRRRRRRR6R t_parse_parentst_introspect_propertiest_introspect_signalst"_introspect_implemented_interfacesRRR>Ri( R RRRR:Rwt object_nameR^R(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR7s$   c Csx|jd}|j|\}}y|jj|}Wn tk rZ}tj|nXtj|dd|d|d|}|j |||j ||xF|j dD]5}|jd} tj j| } |jj| qW|jj|j} t| tjr| j|_ntj|d|jf|jdjdr^||j|RR=R%R"R&Rot warn_nodeRdRRi( R RRR: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(Rt gt_interfacesRtgitype((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRs c Csx|jdD]}|jd}t|jd}|t@dk}|t@dk}|t@dk}|t@dk} |jjt j |jdt j j ||||| qW|j|_dS(NtpropertyRnRiR%( RRtinttG_PARAM_READABLEtG_PARAM_WRITABLEtG_PARAM_CONSTRUCTtG_PARAM_CONSTRUCT_ONLYt propertiesR>RtPropertyR~R( R R(RtpspecRoRtreadabletwritablet constructtconstruct_only((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRs  cCsx|jdD]}|jd}tjj|}tj|}g}|jjd}|jjdddk} |jjdddk} |jjdddk} |jjd ddk} xt|jd D]|\} }| d krd }nd | df}|jd}tjj|}tj||}tj |_ |j |qWtj |jd||d|d| d| d| d| }|j j |qW|j |_ dS(Ntsignaltreturntwhens no-recurset0t1tdetailedtactionsno-hookstparamitobjectsp%siRnR%t no_recursetno_hooks(RRRR~RtReturnR=t enumeratet ParametertPARAM_TRANSFER_NONEttransferR>tSignaltsignals(R R(Rt signal_infotrctypetrtypetreturn_t parametersRRRRRtit parametertargnametpctypetptypeRR((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRs0 "    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.pytst,(RR=tmaptsplitt parent_chain(R RR(t parents_strt parent_types((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRs   c Cs|jd}t|jjdt}|j|\}}y|jj|}Wn!tk rv}tj |dSXt j |dd|d|d|d|}|j ||t|_|j|||j||jj|dtdS(NR%RRuR:RwRRx(RRR=RkRRRRRtwarnRR6R RRiRRRRR>( R RRRR:Rwtfundamental_nameR^R(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRs$     cCsy|jj|j}t|tjs+dS|j|_|j|_x/|jD]$}t|tjrMt |_ qMqMWdS(N( RR=R%R"RR&RoRtFieldRkR(R R(Rtfield((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRs  cCs|jd}|jd}|jj|}|dkr<dStj|j|j|j|j |j |}|jj |dt dS(NtfunctiontdomainRx( RRt get_by_symbolR RtErrorQuarkFunctionR%RmRtthrowsRcR>Ri(R RRct error_domainRR(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyR2s    cCsy|jj|j}Wn tk r;}tj|nX|jj|}|sg|jj|nbt |t j t j fr|j |j|j|jdk st|j|_t|_ntSdS(N(RRRuRRRRR=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.pyR5s  cCsd}t|tjr4|jj|jd}n4x1dD])}|jj|j|}|r;Pq;q;W|o}t|tjsdS|j|_ |j ||j|_ dS(NR6tIfaceR7(Rs 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'R3RRRRRRRRRRRRR2R5R8(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyRAs6     ' "    .   !       iiiiii i@i(RKRTR RXRRtxml.etree.cElementTreeRRRRRRRRRRRRtG_PARAM_LAX_VALIDATIONtG_PARAM_STATIC_NAMEtG_PARAM_STATIC_NICKtG_PARAM_STATIC_BLURBRRRt ExceptionRR(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyts,