ó kŒZc@`s=ddlmZddlmZddlmZddlmZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZddlmZmZdd lmZdd lmZmZdd lmZdd lmZdd lmZddl m!Z!ddl"m#Z#ddl$m%Z%m&Z&ddl'm(Z(ddl)m*Z*d„Z+d„Z,d„Z-d„Z.d„Z/d„Z0d„Z1d„Z2d„Z3d„Z4d„Z5d„Z6d „Z7d!„Z8d"„Z9d#„Z:d$„Z;d%„Z<d&„Z=dS('i(tabsolute_import(tdivision(tprint_function(tunicode_literalsN(tmessage(tGtkDocCommentBlockParser(tIncludet Namespace(tcompile_introspection_binary(t GDumpParsertIntrospectionBinary(tIntrospectablePass(t GIRParser(t GIRWriter(tMainTransformer(tresolve_shlibs(t SourceScannertALL_EXTS(t Transformeri(tutilscC`s±t|j|jƒ}x•t|jƒdkr¬|jddkr¬|jjdƒ}|dkr“|jr“|jddkr“||jjdƒ7}n|jtj|ƒƒqWdS(Niu --cflags-endu-I( tgetattrtvaluestdesttlentrargstpoptappendRtcflag_real_include_path(toptiontopttvaluetparsertcflagstarg((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytprocess_cflags_begin5s +(cC`sdS(N((RRRR((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytprocess_cflags_end?scC`s2t|j|jƒ}|jtjj|ƒƒdS(N(RRRRtostpathtrealpath(RRRRt cpp_includes((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytprocess_cpp_includesCscC`sútj|dƒ}|jdddddddgd d d tƒ|jdd dd d d d tƒ|jddddddgddd d d tƒ|jdddd ddddgƒ|jdddd ddddgƒ|jdddddƒ|S(NuPreprocessor optionsuu--cflags-beginthelpu!Start preprocessor/compiler flagsRucflagstdefaulttactionucallbacktcallbacku --cflags-enduEnd preprocessor/compiler flagsu-IuPre-processor include fileu cpp_includesttypeustringu-DuPre-processor defineuappendu cpp_definesu-UuPre-processor undefineu cpp_undefinesu-puIgnored(toptparset OptionGroupt add_optionR"R#R((Rtgroup((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytget_preprocessor_option_groupHs&      c C`s;tj|dƒ}|jdddddddd gƒ|S( NuMachine Dependent Optionsu-mR)usome machine dependent optionR+uappendRum_optionR*(R.R/R0(RR1((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytget_windows_option_group^s  c C`s›tjdƒ}|jdddddddtd d ƒ|jdd dd dd ddd dƒ|jdddddddgd dƒ|jdddddddgd dƒ|jdddddddgd dƒ|jdddd ddddd dƒ|jdddddddgd d ƒ|jdd!dd dd"ddd d#ƒ|jdd$dddd%dtd d&ƒ|jdd'dddd(dtd d)d*ƒ|jd+d,dddd-dgd d.ƒ|jdd/dddd0dgd d1ƒ|jd2d3dddd4dgd d5ƒ|jdd6dddd7dgd d8ƒ|jd9d:dd dd;d d<ƒ|jdd=dd dd>d d?ƒ|jdd@dd ddAd dBƒ|jddCddddDdgd dEƒ|jddFdd ddGddd dHƒ|jddIddddJdgd dKƒ|jddLdd ddMddd dNƒ|jddOddddPdtd dQƒ|jddRddddSdgd dTƒ|jdUdVdd ddWddXd dYƒ|jddZdddd[dgd d\ƒ|jdd]dddd^dgd d_ƒ|jdd`ddddadtd dbƒ|jddcdddddd deƒ|jdfdgddddhd diƒ|jddjddddkdgd dlƒ|jddmdd ddndgd doƒt|ƒ}|j|ƒtjj dpƒ}|r)|j dqƒr)t |ƒ}|j|ƒn|jddrdd ddsddd tj ƒ|jddtdd dduddd tj ƒ|jddvddddwdtd tj ƒ|jddxddddyd tj ƒ|jddzdddd{dgd d|ƒ|jdd}dddd~dgd dƒ|jdd€dddddgd d‚ƒ|jddƒdddd„dgd d…ƒ|jdd†dddd‡dgd dˆƒ|S(‰Nu%prog [options] sourcesuu--quietR+u store_trueRuquietR*R)u3If passed, do not print details of normal operationu--formatustoreuformatugiruformat to use, one of gidl, giru-iu --includeuappenduincludesu$Add specified gir file as dependencyu--include-uninstalleduincludes_uninstalledu¢A file path to a dependency; only use this " "when building multiple .gir files inside a " "single module.u--add-include-pathu include_pathsu!include paths for other GIR filesu --programuprogramuprogram to executeu --program-argu program_argsuextra arguments to programu --libtoolu libtool_pathufull path to libtoolu --no-libtoolu nolibtooludo not use libtoolu--external-libraryuexternal_libraryu.If true, the library is located on the system,unot in the current directoryu-lu --libraryu librariesulibraries of this unitu--extra-libraryuextra_librariesu*Extra libraries to link the binary againstu-Lu--library-pathu library_pathsu#directories to search for librariesu --header-onlyu header_onlyu<If specified, just generate a GIR for the given header filesu-nu --namespaceunamespace_nameu]name of namespace for this unit, also used to compute --identifier-prefix and --symbol-prefixu --nsversionunamespace_versionu"version of namespace for this unitu--strip-prefixu strip_prefixuXOption --strip-prefix is deprecated, please see --identifier-prefix and --symbol-prefix.u--identifier-prefixuidentifier_prefixesu¸Remove this prefix from C identifiers (structure typedefs, etc.). May be specified multiple times. This is also used as the default for --symbol-prefix if the latter is not specified.u--identifier-filter-cmduidentifier_filter_cmduÁFilter identifiers (struct and union typedefs) through the given shell command which will receive the identifier name as input to stdin and is expected to output the filtered results to stdout.u--symbol-prefixusymbol_prefixesu2Remove this prefix from C symbols (function names)u--symbol-filter-cmdusymbol_filter_cmdu®Filter symbols (function names) through the given shell command which will receive the symbol name as input to stdin and is expected to output the filtered results to stdout.u--accept-unprefixeduaccept_unprefixeduTIf specified, accept symbols and identifiers that do not match the namespace prefix.u--add-init-sectionu init_sectionsu:add extra initialization code in the introspection programu-ou--outputuoutputu-u3output filename to write to, defaults to - (stdout)u--pkgupackagesu&pkg-config packages to get cflags fromu --pkg-exportupackages_exportu/Associated pkg-config packages for this libraryu --warn-alluwarn_allu.If true, enable all warnings for introspectionu --warn-erroru warn_fataluTurn warnings into fatal errorsu-vu --verboseuverboseu be verboseu --c-includeu c_includesu.headers which should be included in C programsu --filelistufilelistu1file containing headers and sources to be scanneduMSYSTEMuMINGWu--generate-typelib-testsu test_codegenu--passthrough-girupassthrough_giru--reparse-validateureparse_validate_giru --typelib-xmlu typelib_xmlu--function-decorationufunction_decorationu-Macro to decorate functions in generated codeu--include-first-in-headeruinclude_first_headeru+Header to include first in generated headeru--include-last-in-headeruinclude_last_headeru=Header to include after the other headers in generated headeru--include-first-in-srcuinclude_first_srcu,Header to include first in generated sourcesu--include-last-in-srcuinclude_last_srcu>Header to include after the other headers in generated sources( R.t OptionParserR0tFalsetNoneR2tadd_option_groupR$tenvirontgett startswithR3t SUPPRESS_HELP(RR1t msystemenv((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyt_get_option_parsergs               cC`std|fƒ‚dS(Nu ERROR: %s(t SystemExit(tmsg((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyt_errorýscC`s?tƒ}|j|ƒt|jƒƒ}|j|jƒƒdS(N(R tparseR t get_namespacetwritetget_encoded_xml(R%tfRtwriter((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytpassthrough_girs  c C`st|jdƒ\}}}|dkr_ddlm} | |||||||ƒ} | jƒntd|fƒdS(Nu,u Everythingi(tEverythingCodeGeneratoruInvaild namespace '%s'i(tsplitt testcodegenRHRCR@( t optstringtfunction_decorationtinclude_first_headertinclude_last_headertinclude_first_srctinclude_last_srct namespacetout_h_filenametout_c_filenameRHtgen((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyt test_codegen s   cc`sGx@|jƒD]2}x)|D]!}|j|ƒs5qn|VPqWq WdS(N(RIR:(toutputt allowed_flagsRtflag((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytprocess_optionss  c C`s tjjddƒdg}|j|ƒtj|dtjƒjƒd}|dkrZdS|j dƒ}dd d d d g}t t ||ƒƒ}t ƒ}|j |ƒ\}}|jjg|jD]} tjj| ƒ^qă|jj|jƒ|jj|jƒdS( Nu PKG_CONFIGu pkg-configu--cflagststdoutiiuasciiu-Iu-Du-Uu-lu-L(R$R8R9textendt subprocesstPopentPIPEt communicateR6tdecodetlistRYR=t parse_argsR'R%R&t cpp_definest cpp_undefines( toptionstpackagestargsRVtoptions_whitelisttfiltered_outputRt pkg_optionstunusedRE((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytprocess_packages(s    2cC`smg}x`|D]X}tjj|ƒdtkr tjj|ƒsUtd|fƒn|j|ƒq q W|S(Niu%s: no such a file or directory(R$R%tsplitextRtexistsR@R(Rgt filenamesR!((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytextract_filenames=s cC`sg}tjj|jƒs2td|jfƒnt|jdƒ}|jƒ}WdQXx¹|D]±}|jƒ}|jdƒsÛ|jdƒsÛ|jdƒsÛ|jdƒsÛ|jdƒsÛ|jdƒsÛ|jd ƒr`tjj|ƒstd |fƒn|j |ƒq`q`W|S( Nu%s: no such filelist fileuru.cu.cppu.ccu.cxxu.hu.hppu.hxxu4%s: Invalid filelist entry-no such file or directory( R$R%RntfilelistR@topent readlineststriptendswithR(ReRot filelist_filetlinestlinetfilename((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytextract_filelistKs  cC`s±|jr)tdƒ|jj|jƒn|jr>|j}nd}|jrŒx0|jD]%}|jƒ|krWtdƒqWqWW|j}nd}t|j |j d|d|ƒS(Nung-ir-scanner: warning: Option --strip-prefix has been deprecated; see --identifier-prefix and --symbol-prefix.u5Values for --symbol-prefix must be entirely lowercasetidentifier_prefixestsymbol_prefixes( t strip_prefixtprintR{RR6R|tlowerR@Rtnamespace_nametnamespace_version(ReR{tprefixR|((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytcreate_namespaceas"       cC`s÷t|d|jd|jd|jƒ}|j|jƒ|jsI|jr`|jƒ|j ƒnxo|j D]d}t j |kr“t d|fƒnytj|ƒ}Wnt d|fƒnX|j|ƒqjWx|jD]}|j|ƒqÜW|S(Ntaccept_unprefixedtidentifier_filter_cmdtsymbol_filter_cmduInvalid include path '%s'uMalformed include '%s' (RR„R…R†tset_include_pathst include_pathsRGtreparse_validate_girt disable_cachetset_passthrough_modetincludesR$tsepR@Rt from_stringtregister_includetincludes_uninstalledtregister_include_uninstalled(RQRet transformertincludet include_objt include_path((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytcreate_transformer~s&      cC`s˜t|ƒ}|jƒ|jrJ|jg}|j|jƒt|ƒ}nt||jƒ|jƒƒ}t |||j ƒ}|j |ƒ|j ƒ|S(N( R t init_parsetprogramR[t program_argsR Rtget_get_type_functionstget_error_quark_functionsRt librariestset_introspection_binaryRA(R’ReRgt gdump_parsertbinarytshlibs((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyt create_binary–s       cC`s¤t|dƒr'|jr't|ƒ}n t|ƒ}tjƒdkrX|jjdƒntƒ}|j |j |j |jd|j ƒ|j |ƒ|j|ƒ|S(NufilelistuDarwinu __BLOCKS__R (thasattrRqRzRptplatformtsystemRdRRtset_cpp_optionsR'RcR t parse_filest parse_macros(ReRgRotss((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytcreate_source_scanner®s       cC`s|jdkrtj}n¨|jrƒtjddƒ\}}tjj|jƒrgt j |j|ƒn(tj |t j t jBt jBt jBƒtj|dƒ}|j|ƒWdQXtjddƒ\}}tj|dƒ}t||ƒWdQXtj||ƒs td||fƒntj|ƒyt j||jƒWn8tk r~}|jtjkrxtj|ƒn‚nXdSyt|jdƒ}Wn'tk rÂ}td|jfƒnXy|j|ƒWn'tk rý}td |jfƒnXdS( u@Write encoded XML 'data' to the filename specified in 'options'.u-tsuffixu.giruwbNu:Failed to re-parse gir file; scanned='%s' passthrough='%s'iuopening output for writing: %suwhile writing output: %s(RVtsysRZR‰ttempfiletmkstempR$R%tisfiletshutiltcopystattchmodtstattS_IWUSRtS_IRUSRtS_IRGRPtS_IROTHtfdopenRCRGRtfiles_are_identicalR@tunlinktmovetOSErrorterrnotEPERMRrtIOErrortstrerror(tdataReRVtmain_ft main_f_namettemp_ft temp_f_namete((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyt write_outputÃs@    cC`s=tƒ}|j|ƒ\}}|jr=t|jtjƒn|jrqt|j|j|j|j|j |j ƒSt |dƒr¬|j r¬t |ƒdkr¬tdƒq¬n|jsÂtdƒn|jdkräddlm}ntd|jfƒ|jp|jp|js td ƒnt|ƒ}tjjd |ƒ}|jrl|jtjtjtjfƒnt||ƒ}t |j!ƒ}|j"|j#ƒƒ|r¿t$||ƒ}|r¿|Snt%||ƒ} t&ƒ} | j'| j(ƒƒ} |j)| j*ƒƒ|jst+|||ƒ} ng} | |j,_-t.|| ƒ} | j/ƒt0j1d ƒt2|| ƒ}|j3ƒ|j4ƒ}|j5r |dkr tj6d ƒdS|dkrØ|jt7krØt8d |j,j9|fƒn|j:rí|j:}n |j!}|j;|j,_;||j,_<||j,ƒ}|j=ƒ}t>||ƒdS(NufilelistiuNeed at least one filenameuNamespace name missingugiri(R uUnknown format: %su#Must specify --program or --libraryRQutreeuwarnings configured as fataluNg-ir-scanner: %s: warning: %d warnings suppressed (use --warn-all to see them)(?R=RbRGR«RZRURLRMRNRORPR¢RqRR@R€tformattgiscanner.girwriterR RœR˜t header_onlyRƒRt MessageLoggerR9twarn_alltenable_warningstWARNINGtERRORtFATALR–tsetRftupdatetget_pkgconfig_packagesRlR©Rtparse_comment_blockst get_commentsRAt get_symbolsR¡RQtshared_librariesRt transformRtbreak_on_debug_flagR tvalidatetget_warning_countt warn_fataltfatalR5R~tnametpackages_exportt c_includestexported_packagesRDRÆ(RgRRetWriterRQtloggerR’Rft exit_codeR¨tcbptblocksR tmaintfinalt warning_countRàRFRÀ((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyt scanner_mainís~             "              (>t __future__RRRRR¼R.R$R¯R²R\R«R¬R£t giscannerRtgiscanner.annotationparserRt giscanner.astRRtgiscanner.dumperRtgiscanner.gdumpparserR R tgiscanner.introspectablepassR tgiscanner.girparserR RÈR tgiscanner.maintransformerRtgiscanner.shlibsRtgiscanner.sourcescannerRRtgiscanner.transformerRtRR"R#R(R2R3R=R@RGRURYRlRpRzRƒR–R¡R©RÆRé(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytsX             –           *