ó ÀYYc@`saddlmZddlmZddlmZddlmZddlZddlZddlZddlZddl Z da d„Z d„Z ejdƒZejd ƒZejd ƒZd „Zd „Zejd ƒZd„ZejdƒZd„Zd„Zd„Zd„Zd„Zd„Zd„Zded„Zdd„Z d„Z!dS(i(tabsolute_import(tdivision(tprint_function(tunicode_literalsNcC`sStdkrItjjddƒjdƒadtkrItjdƒqIn|tkS(u(Check for whether a specific debugging feature is enabled. Well-known flags: * start: Drop into debugger just after processing arguments * exception: Drop into debugger on fatalexception * warning: Drop into debugger on warning * posttrans: Drop into debugger just before introspectable pass uGI_SCANNER_DEBUGuu,N(t _debugflagstNonetostenvirontgettsplittremove(tflag((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pythave_debug_flag#s  cC`s)t|ƒr%ddl}|jƒndS(Ni(R tpdbt set_trace(R R ((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytbreak_on_debug_flag3s  u([^A-Z])([A-Z])u([A-Z][A-Z])([A-Z][0-9a-z])u^([A-Z])([A-Z])cC`s@tjd|ƒ}tjd|ƒ}tjd|ddƒ}|S(uJConverts a typename to the equivalent underscores name. This is used to form the type conversion macros and enum/flag name variables. In particular, and differently from to_underscores_noprefix(), this function treats the first character differently if it is uppercase and followed by another uppercase letter.u\1_\2tcounti(t_upperstr_pat1tsubt_upperstr_pat2t_upperstr_pat3(tname((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytto_underscores>scC`s(tjd|ƒ}tjd|ƒ}|S(usLike to_underscores, but designed for "unprefixed" names. to_underscores("DBusFoo") => dbus_foo, not d_bus_foo.u\1_\2(RRR(R((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytto_underscores_noprefixKsudlname='([A-z0-9\.\-\+]+)' cC`sLt|ƒ}|jƒ}WdQXtj|ƒ}|rD|jƒdSdSdS(Ni(topentreadt _libtool_pattsearchtgroupsR(tla_filetftdatatm((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pyt_extract_dlname_fieldVs ulibdir='([^']+)'cC`sLt|ƒ}|jƒ}WdQXtj|ƒ}|rD|jƒdSdSdS(Ni(RRt_libtool_libdir_patRRR(RRRR ((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pyt_extract_libdir_fieldcs cC`sxt|ƒ}|dkrdStjƒdkrhtjj|ƒ}t|ƒ}|dkr\|S|d|Stjj|ƒS(NuDarwinu/(R!RtplatformtsystemRtpathtbasenameR#(Rtdlnamet dlbasenametlibdir((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytextract_libtool_shlibos     cC`sqt|ƒ}|dkr+td|ƒ‚ntjjtjj|ƒd|ƒ}|jddƒjddƒ}|S(Nu'%s has no dlname. Not a shared library?u.libsu .libs/.libsu .libs\.libs(R!Rt ValueErrorRR&tjointdirnametreplace(RR(tlibname((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytextract_libtools   cC`sœ|j }|sdS|j}|r0|jdƒSd}tjƒdkrQd}ny&tj|dgdtt j ƒƒWntj t fk r”dSX|gS(Nu ulibtooluDarwinuglibtoolu --versiontstdout( t nolibtoolRt libtool_pathR R$R%t subprocesst check_callRRtdevnulltCalledProcessErrortOSError(toptionstlibtool_infectionR4t libtool_cmd((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytget_libtool_commands    c C`s™t|dƒ„}t|dƒl}|jdƒ}|jdƒ}x:||kr~|dkr~|jdƒ}|jdƒ}qEW||kSWdQXWdQXdS(Nurbi t(RR(tpath1tpath2tf1tf2tbuf1tbuf2((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytfiles_are_identicalªscC`s+|jdƒs|Sdtjj|dƒS(Nu-Ii(t startswithRR&trealpath(tcflag((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytcflag_real_include_path´scC`såd„}d„}tjj|ƒ\}}|rf||ƒr@|Stjdkrá||ƒrá|dSn{xxtjdjtjƒD]]}|jdƒ}tjj||ƒ}||ƒrº|Stjdkr€||ƒr€|dSq€WdS(NcS`s%tjj|ƒo$tj|tjƒS(N(RR&tisfiletaccesstX_OK(tfpath((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytis_exe¼scS`sC|jƒjdƒ oBtjj|dƒoBtj|dtjƒS(Nu.exe(tlowertendswithRR&RJRKRL(RM((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pyt is_nt_exe¿suntu.exeuPATHu"( RR&R RRtpathseptstripR-R(tprogramRNRQRMtfnameR&texe_file((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytwhich»s        iÿcC`s tjj|ƒ\}}|s9tjj|ƒ\}}n|r­|r­tjj|ƒ r­yt|||ƒWn+tk r™}|jtjkrš‚qšnX|tkr­dSnytj ||ƒWnEtk r}| sÿ|jtjksÿtjj |ƒ r ‚q nXdS(u:Super-mkdir; create a leaf directory and all intermediate ones. Works like mkdir, except that any intermediate path segment (not just the rightmost) will be created if it does not exist. If the target directory already exists, raise an OSError if exist_ok is False. Otherwise no exception is raised. This is recursive. Note: This function has been imported from Python 3.4 sources and adapted to work with Python 2.X because get_user_cache_dir() uses the exist_ok parameter. It can be removed again when Python 2.X support is dropped. N( RR&R texiststmakedirsR9terrnotEEXISTtcdirtmkdirtisdir(Rtmodetexist_oktheadttailte((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pyRYÖs   ,cC`sôtjjdƒ}|dk rm|dk rBtjj||ƒ}nyt|dddtƒWnqmX|Sntjjdƒ}|dk rðtjj|dƒ}|dk rÄtjj||ƒ}nyt|dddtƒWndSX|SndS(uý This is a Python reimplemention of `g_get_user_cache_dir()` because we don't want to rely on the python-xdg package and we can't depend on GLib via introspection. If any changes are made to that function they'll need to be copied here. uXDG_CACHE_HOMER_iíR`u~u.cacheN( RRRRR&R-RYtTruet expanduser(tdirtxdg_cache_homethomedirtcachedir((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytget_user_cache_dirôs(    cC`skgtjjddƒjtjƒD] }|^q"}| rgtjdkrg|jdƒ|jdƒn|S(uÿ This is a Python reimplemention of `g_get_system_data_dirs()` because we don't want to rely on the python-xdg package and we can't depend on GLib via introspection. If any changes are made to that function they'll need to be copied here. u XDG_DATA_DIRSuuntu/usr/local/shareu /usr/share(RRRR RRRtappend(txt xdg_data_dirs((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pytget_system_data_dirss 4 ("t __future__RRRRRZtreRR5R$RRR RtcompileRRRRRRR!R"R#R+R1R=RERIRWtFalseRYRjRn(((so/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/utils.pyts:               "