Tc@sddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z mZddlmZddlmZmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZm Z dd l!m"Z"ddl#m$Z$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4d Z5d!Z6d"Z7dS(#iN(tmessage(tGtkDocCommentBlockParser(tIncludet Namespace(tcompile_introspection_binary(t GDumpParsertIntrospectionBinary(tIntrospectablePass(t GIRParser(t GIRWriter(tMainTransformer(tresolve_shlibs(t SourceScannertALL_EXTS(t Transformeri(tutilscCst|j|j}xt|jdkr|jddkr|jjd}|dkr|jr|jddkr||jjd7}n|jtj|qWdS(Nis --cflags-ends-I( tgetattrtvaluestdesttlentrargstpoptappendRtcflag_real_include_path(toptiontopttvaluetparsertcflagstarg((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytprocess_cflags_begin/s +(cCsdS(N((RRRR((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytprocess_cflags_end9scCs2t|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_includes=scCstj|d}|jdddddddgd d d t|jdd dd d d d t|jd dddddgddd d d t|jdddd ddddg|jdddd ddddg|jddddd|S(NsPreprocessor optionsts--cflags-beginthelps!Start preprocessor/compiler flagsRRtdefaulttactiontcallbacks --cflags-endsEnd preprocessor/compiler flagss-IsPre-processor include fileR#ttypetstrings-DsPre-processor defineRt cpp_definess-UsPre-processor undefinet cpp_undefiness-ptIgnored(toptparset OptionGroupt add_optionRRR$(Rtgroup((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytget_preprocessor_option_groupBs&      c Cs;tj|d}|jdddddddd g|S( NsMachine Dependent Optionss-mR&ssome machine dependent optionR(RRtm_optionR'(R/R0R1(RR2((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytget_windows_option_groupXs  c CsKtjd}|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.|jd/d0dddd1dgd d2|jdd3dddd4dgd d5|jd6d7dd dd8d d9|jdd:dd dd;d d<|jdd=dd dd>d d?|jdd@ddddAdgd dB|jddCdd ddDddd dE|jddFddddGdgd dH|jddIddddJdtd dK|jddLddddMdgd dN|jdOdPdd ddQddRd dS|jddTddddUdgd dV|jddWddddXdgd dY|jddZdddd[dtd d\|jdd]dddd^d d_|jd`daddddbd dc|jdddddddedgd df|jddgdd ddhdgd dit|}|j|tjj dj}|r|j dkrt |}|j|n|jddldd ddmddd tj |jddndd ddoddd tj |jddpddddqdtd tj |jddrddddsd tj |jddtddddudgd dv|jddwddddxdgd dy|jddzdddd{dgd d||jdd}dddd~dgd d|jdddddddgd d|S(Ns%prog [options] sourcesR%s--quietR(t store_trueRtquietR'R&s3If passed, do not print details of normal operations--formattstoretformattgirsformat to use, one of gidl, girs-is --includeRtincludess$Add specified gir file as dependencys--include-uninstalledtincludes_uninstalledsA file path to a dependency; only use this " "when building multiple .gir files inside a " "single module.s--add-include-patht include_pathss!include paths for other GIR filess --programtprogramsprogram to executes --program-argt program_argssextra arguments to programs --libtoolt libtool_pathsfull path to libtools --no-libtoolt nolibtoolsdo not use libtools--external-librarytexternal_librarys.If true, the library is located on the system,snot in the current directorys-ls --libraryt librariesslibraries of this units-Ls--library-patht library_pathss#directories to search for librariess --header-onlyt header_onlys<If specified, just generate a GIR for the given header filess-ns --namespacetnamespace_names]name of namespace for this unit, also used to compute --identifier-prefix and --symbol-prefixs --nsversiontnamespace_versions"version of namespace for this units--strip-prefixt strip_prefixsXOption --strip-prefix is deprecated, please see --identifier-prefix and --symbol-prefix.s--identifier-prefixtidentifier_prefixessRemove 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.s--identifier-filter-cmdtidentifier_filter_cmdsFilter 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.s--symbol-prefixtsymbol_prefixess2Remove this prefix from C symbols (function names)s--accept-unprefixedtaccept_unprefixedsTIf specified, accept symbols and identifiers that do not match the namespace prefix.s--add-init-sectiont init_sectionss:add extra initialization code in the introspection programs-os--outputtoutputt-s3output filename to write to, defaults to - (stdout)s--pkgtpackagess&pkg-config packages to get cflags froms --pkg-exporttpackages_exports/Associated pkg-config packages for this librarys --warn-alltwarn_alls.If true, enable all warnings for introspections --warn-errort warn_fatalsTurn warnings into fatal errorss-vs --verbosetverboses be verboses --c-includet c_includess.headers which should be included in C programss --filelisttfilelists1file containing headers and sources to be scannedtMSYSTEMtMINGWs--generate-typelib-testst test_codegens--passthrough-girtpassthrough_girs--reparse-validatetreparse_validate_girs --typelib-xmlt typelib_xmls--function-decorationtfunction_decorations-Macro to decorate functions in generated codes--include-first-in-headertinclude_first_headers+Header to include first in generated headers--include-last-in-headertinclude_last_headers=Header to include after the other headers in generated headers--include-first-in-srctinclude_first_srcs,Header to include first in generated sourcess--include-last-in-srctinclude_last_srcs>Header to include after the other headers in generated sources( R/t OptionParserR1tFalsetNoneR3tadd_option_groupR tenvirontgett startswithR5t SUPPRESS_HELP(RR2t msystemenv((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyt_get_option_parseras               cCstd|fdS(Ns ERROR: %s(t SystemExit(tmsg((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyt_errorscCs?t}|j|t|j}|j|jdS(N(RtparseR t get_namespacetwritetget_xml(R!tfRtwriter((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyRZs  c Cst|jd\}}}|dkr_ddlm} | |||||||} | jntd|fdS(Nt,t Everythingi(tEverythingCodeGeneratorsInvaild namespace %ri(tsplitt testcodegenRwRqRn( t optstringR]R^R_R`Rat namespacetout_h_filenametout_c_filenameRwtgen((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyRYs   ccsGx@|jD]2}x)|D]!}|j|s5qn|VPqWq WdS(N(RxRh(RNt allowed_flagsRtflag((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytprocess_optionss  c Csddg}|j|tj|dtjjd}|dkrKdSdddd d g}tt||}t}|j |\}}|j jg|j D]} t j j | ^q|jj|j|jj|jdS( Ns pkg-configs--cflagststdoutiis-Is-Ds-Us-ls-L(textendt subprocesstPopentPIPEt communicateRdtlistRRkt parse_argsR#R R!R"R,R-( toptionsRPtargsRNtoptions_whitelisttfiltered_outputRt pkg_optionstunusedRs((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytprocess_packagess     2cCsmg}x`|D]X}tjj|dtkr tjj|sUtd|fn|j|q q W|S(Nis%s: no such a file or directory(R R!tsplitextR texistsRnR(Rt filenamesR((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytextract_filenames.s cCsg}tjj|js2td|jfnt|jd}|j}x|D]}|j}|jds|jds|jds|jds|jds|jds|jd rWtjj|std |fn|j |qWqWW|S( Ns%s: no such filelist filetrs.cs.cpps.ccs.cxxs.hs.hpps.hxxs4%s: Invalid filelist entry-no such file or directory( R R!RRVRntopent readlineststriptendswithR(RRt filelist_filetlinestlinetfilename((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytextract_filelist<s   cCs|jr$dGH|jj|jn|jr9|j}nd}|jrx0|jD]%}|j|krRtdqRqRW|j}nd}t|j|j d|d|S(Nsng-ir-scanner: warning: Option --strip-prefix has been deprecated; see --identifier-prefix and --symbol-prefix.s5Values for --symbol-prefix must be entirely lowercaseRIRK( RHRIRRdRKtlowerRnRRFRG(RRItprefixRK((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytcreate_namespaceRs        cCst|d|jd|j}|j|j|jrN|j|jnxo|jD]d}t j |krt d|fnyt j |}Wnt d|fnX|j|qXWx|jD]}|j|qW|S(NRLRJsInvalid include path %rsMalformed include %r (RRLRJtset_include_pathsR=RZt disable_cachetset_passthrough_modeR;R tsepRnRt from_stringtregister_includeR<tregister_include_uninstalled(R{Rt transformertincludet include_objt include_path((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytcreate_transformeros$      cCst|}|j|jrJ|jg}|j|jt|}nt||j|j}t |||j }|j ||j |S(N( Rt init_parseR>RR?RRtget_get_type_functionstget_error_quark_functionsR RCtset_introspection_binaryRo(RRRt gdump_parsertbinarytshlibs((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyt create_binarys       cCst|dr'|jr't|}n t|}tjdkrX|jjdnt}|j |j |j |jd|j |j ||j||S(NRVtDarwint __BLOCKS__R(thasattrRVRRtplatformtsystemR-RR tset_cpp_optionsR#R,Rt parse_filest parse_macros(RRRtss((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytcreate_source_scanners       cCs|jdkrtj}nX|jr3tjdd\}}tj|d}|j||j tjdd\}}tj|d}t |||j t j ||st d||fntj|ytj||jWn9tk r.}|jtjkr(tj|dSnXdSyt|jd}Wn'tk rr}t d|jfnXy|j|Wn'tk r}t d|jfnXdS( NROtsuffixs.girtws6Failed to re-parse gir file; scanned=%r passthrough=%risopening output for writing: %sswhile writing output: %s(RNtsysRR[ttempfiletmkstempR tfdopenRqtcloseRZRtfiles_are_identicalRntunlinktshutiltmovetOSErrorterrnotEPERMRtIOErrortstrerror(tdataRRNtmain_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_outputs>        cCs8t}|j|\}}|jr=t|jtjn|jrqt|j|j|j|j|j |j St |dr|j rt |dkrtdqn|jstdn|jdkrddlm}ntd|jf|jp|jp|js td nt|}tjjd |}|jrl|jtjtjtjfnt||}t |j!}|j"|j#|rt$||}|r|Snt%||} t&} | j'| j(} |j)| j*|jst+|||} ng} | |j,_-t.|| } | j/t0j1d t2|| }|j3|j4}|j5r|d krtj6d dS|d kr|jt7krd|j,j8|fGHn|j9r|j9}n |j!}|j:|j,_:||j,_;||j,}|j<}t=||d S(NRVisNeed at least one filenamesNamespace name missingR:i(R sUnknown format: %ss#Must specify --program or --libraryR{ttreeiswarnings configured as fatalsNg-ir-scanner: %s: warning: %d warnings suppressed (use --warn-all to see them)(>RkRRZRRRYR]R^R_R`RaRRVRRnRFR9tgiscanner.girwriterR RCR>RERRt MessageLoggerRgRRtenable_warningstWARNINGtERRORtFATALRtsetRPtupdatetget_pkgconfig_packagesRRRtparse_comment_blockst get_commentsRot get_symbolsRR{tshared_librariesR t transformRtbreak_on_debug_flagRtvalidatetget_warning_countRStfatalRctnameRQRUtexported_packagesRrR(RRRtWriterR{tloggerRRPt exit_codeRtcbptblocksRtmaintfinalt warning_countRRtR((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyt scanner_mains~             "              (8RR/R RRRRRt giscannerRtgiscanner.annotationparserRt giscanner.astRRtgiscanner.dumperRtgiscanner.gdumpparserRRtgiscanner.introspectablepassRtgiscanner.girparserRRR tgiscanner.maintransformerR tgiscanner.shlibsR tgiscanner.sourcescannerR R tgiscanner.transformerRR%RRRR$R3R5RkRnRZRYRRRRRRRRRR(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/scannermain.pytsN                      %