text_ux 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +25 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +51 -0
- data/Rakefile +18 -0
- data/ext/text_ux/extconf.rb +5 -0
- data/ext/text_ux/text_ux.cpp +252 -0
- data/lib/text_ux.rb +5 -0
- data/lib/text_ux/version.rb +3 -0
- data/spec/fixtures/test.ux +0 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/text_ux_spec.rb +137 -0
- data/text_ux.gemspec +26 -0
- data/vendor/ux-trie/ux-0.1.9/.lock-waf_darwin_build +8 -0
- data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest-all.cc +9118 -0
- data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest.h +19537 -0
- data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest_main.cc +39 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Build.py +733 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Build.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ConfigSet.py +147 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ConfigSet.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Configure.py +314 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Configure.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Context.py +298 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Context.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Errors.py +37 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Errors.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Logs.py +149 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Logs.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Node.py +500 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Node.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Options.py +130 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Options.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Runner.py +191 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Runner.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Scripting.py +358 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Scripting.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Task.py +669 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Task.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/TaskGen.py +341 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/TaskGen.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/__init__.py +4 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/__init__.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ar.py +12 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ar.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/asm.py +25 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/bison.py +29 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c.py +27 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_aliases.py +56 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_aliases.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_config.py +708 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_config.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_osx.py +121 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_osx.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_preproc.py +606 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_preproc.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_tests.py +110 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_tests.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ccroot.py +372 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ccroot.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_c.py +39 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_cxx.py +39 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_cxx.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_d.py +30 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_fc.py +45 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cs.py +98 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cxx.py +27 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cxx.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d.py +51 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d_config.py +47 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d_scan.py +133 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/dbus.py +30 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/dmd.py +43 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/errcheck.py +153 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc.py +123 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc_config.py +271 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc_scan.py +68 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/flex.py +27 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/g95.py +55 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gas.py +10 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gcc.py +98 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gdc.py +34 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gfortran.py +69 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/glib2.py +174 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gnu_dirs.py +65 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gxx.py +98 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gxx.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/icc.py +31 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/icpc.py +30 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ifort.py +42 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/intltool.py +78 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/irixcc.py +49 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/javaw.py +272 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/kde4.py +49 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/lua.py +19 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/msvc.py +650 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/nasm.py +13 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/perl.py +78 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/python.py +303 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/qt4.py +424 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ruby.py +104 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/suncc.py +54 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/suncxx.py +55 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/tex.py +222 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/vala.py +215 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/waf_unit_test.py +79 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/winres.py +34 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/xlc.py +46 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/xlcxx.py +46 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Utils.py +334 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Utils.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/__init__.py +4 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/__init__.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ansiterm.py +173 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ansiterm.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/__init__.py +4 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/__init__.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/compat15.py +223 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/compat15.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/fixpy2.py +50 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/fixpy2.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/src/bitVec.cpp +119 -0
- data/vendor/ux-trie/ux-0.1.9/src/bitVec.hpp +64 -0
- data/vendor/ux-trie/ux-0.1.9/src/bitVecTest.cpp +143 -0
- data/vendor/ux-trie/ux-0.1.9/src/cmdline.h +809 -0
- data/vendor/ux-trie/ux-0.1.9/src/rsDic.cpp +121 -0
- data/vendor/ux-trie/ux-0.1.9/src/rsDic.hpp +57 -0
- data/vendor/ux-trie/ux-0.1.9/src/ux.hpp +26 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxMain.cpp +206 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxMap.cpp +0 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxMap.hpp +248 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxMapTest.cpp +139 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxTest.cpp +229 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxTrie.cpp +529 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxTrie.hpp +220 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxUtil.cpp +92 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxUtil.hpp +35 -0
- data/vendor/ux-trie/ux-0.1.9/src/wscript +43 -0
- data/vendor/ux-trie/ux-0.1.9/unittest_gtest.py +0 -0
- data/vendor/ux-trie/ux-0.1.9/unittest_gtest.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/unittestt.py +166 -0
- data/vendor/ux-trie/ux-0.1.9/ux.pc.in +10 -0
- data/vendor/ux-trie/ux-0.1.9/waf +0 -0
- data/vendor/ux-trie/ux-0.1.9/wscript +32 -0
- metadata +249 -0
Binary file
|
@@ -0,0 +1,500 @@
|
|
1
|
+
#! /usr/bin/env python
|
2
|
+
# encoding: utf-8
|
3
|
+
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
|
4
|
+
|
5
|
+
import sys
|
6
|
+
if sys.hexversion < 0x020400f0: from sets import Set as set
|
7
|
+
import os,re,sys,shutil
|
8
|
+
from waflib import Utils,Errors
|
9
|
+
exclude_regs='''
|
10
|
+
**/*~
|
11
|
+
**/#*#
|
12
|
+
**/.#*
|
13
|
+
**/%*%
|
14
|
+
**/._*
|
15
|
+
**/CVS
|
16
|
+
**/CVS/**
|
17
|
+
**/.cvsignore
|
18
|
+
**/SCCS
|
19
|
+
**/SCCS/**
|
20
|
+
**/vssver.scc
|
21
|
+
**/.svn
|
22
|
+
**/.svn/**
|
23
|
+
**/BitKeeper
|
24
|
+
**/.git
|
25
|
+
**/.git/**
|
26
|
+
**/.gitignore
|
27
|
+
**/.bzr
|
28
|
+
**/.bzrignore
|
29
|
+
**/.bzr/**
|
30
|
+
**/.hg
|
31
|
+
**/.hg/**
|
32
|
+
**/_MTN
|
33
|
+
**/_MTN/**
|
34
|
+
**/.arch-ids
|
35
|
+
**/{arch}
|
36
|
+
**/_darcs
|
37
|
+
**/_darcs/**
|
38
|
+
**/.DS_Store'''
|
39
|
+
def split_path(path):
|
40
|
+
return path.split('/')
|
41
|
+
def split_path_cygwin(path):
|
42
|
+
if path.startswith('//'):
|
43
|
+
ret=path.split('/')[2:]
|
44
|
+
ret[0]='/'+ret[0]
|
45
|
+
return ret
|
46
|
+
return path.split('/')
|
47
|
+
re_sp=re.compile('[/\\\\]')
|
48
|
+
def split_path_win32(path):
|
49
|
+
if path.startswith('\\\\'):
|
50
|
+
ret=re.split(re_sp,path)[2:]
|
51
|
+
ret[0]='\\'+ret[0]
|
52
|
+
return ret
|
53
|
+
return re.split(re_sp,path)
|
54
|
+
if sys.platform=='cygwin':
|
55
|
+
split_path=split_path_cygwin
|
56
|
+
elif Utils.is_win32:
|
57
|
+
split_path=split_path_win32
|
58
|
+
class Node(object):
|
59
|
+
__slots__=('name','sig','children','parent','cache_abspath','cache_isdir')
|
60
|
+
def __init__(self,name,parent):
|
61
|
+
self.name=name
|
62
|
+
self.parent=parent
|
63
|
+
if parent:
|
64
|
+
if name in parent.children:
|
65
|
+
raise Errors.WafError('node %s exists in the parent files %r already'%(name,parent))
|
66
|
+
parent.children[name]=self
|
67
|
+
def __setstate__(self,data):
|
68
|
+
self.name=data[0]
|
69
|
+
self.parent=data[1]
|
70
|
+
if data[2]is not None:
|
71
|
+
self.children=data[2]
|
72
|
+
if data[3]is not None:
|
73
|
+
self.sig=data[3]
|
74
|
+
def __getstate__(self):
|
75
|
+
return(self.name,self.parent,getattr(self,'children',None),getattr(self,'sig',None))
|
76
|
+
def __str__(self):
|
77
|
+
return self.name
|
78
|
+
def __repr__(self):
|
79
|
+
return self.abspath()
|
80
|
+
def __hash__(self):
|
81
|
+
return id(self)
|
82
|
+
def __eq__(self,node):
|
83
|
+
return id(self)==id(node)
|
84
|
+
def __copy__(self):
|
85
|
+
raise Errors.WafError('nodes are not supposed to be copied')
|
86
|
+
def read(self,flags='r'):
|
87
|
+
return Utils.readf(self.abspath(),flags)
|
88
|
+
def write(self,data,flags='w'):
|
89
|
+
f=None
|
90
|
+
try:
|
91
|
+
f=open(self.abspath(),flags)
|
92
|
+
f.write(data)
|
93
|
+
finally:
|
94
|
+
if f:
|
95
|
+
f.close()
|
96
|
+
def chmod(self,val):
|
97
|
+
os.chmod(self.abspath(),val)
|
98
|
+
def delete(self):
|
99
|
+
try:
|
100
|
+
if getattr(self,'children',None):
|
101
|
+
shutil.rmtree(self.abspath())
|
102
|
+
else:
|
103
|
+
os.unlink(self.abspath())
|
104
|
+
except:
|
105
|
+
pass
|
106
|
+
try:
|
107
|
+
delattr(self,'children')
|
108
|
+
except:
|
109
|
+
pass
|
110
|
+
def suffix(self):
|
111
|
+
k=max(0,self.name.rfind('.'))
|
112
|
+
return self.name[k:]
|
113
|
+
def height(self):
|
114
|
+
d=self
|
115
|
+
val=-1
|
116
|
+
while d:
|
117
|
+
d=d.parent
|
118
|
+
val+=1
|
119
|
+
return val
|
120
|
+
def listdir(self):
|
121
|
+
lst=Utils.listdir(self.abspath())
|
122
|
+
lst.sort()
|
123
|
+
return lst
|
124
|
+
def mkdir(self):
|
125
|
+
if getattr(self,'cache_isdir',None):
|
126
|
+
return
|
127
|
+
try:
|
128
|
+
self.parent.mkdir()
|
129
|
+
except:
|
130
|
+
pass
|
131
|
+
if self.name:
|
132
|
+
try:
|
133
|
+
os.makedirs(self.abspath())
|
134
|
+
except OSError:
|
135
|
+
pass
|
136
|
+
if not os.path.isdir(self.abspath()):
|
137
|
+
raise Errors.WafError('Could not create the directory %s'%self.abspath())
|
138
|
+
try:
|
139
|
+
self.children
|
140
|
+
except:
|
141
|
+
self.children={}
|
142
|
+
self.cache_isdir=True
|
143
|
+
def find_node(self,lst):
|
144
|
+
if isinstance(lst,str):
|
145
|
+
lst=[x for x in split_path(lst)if x and x!='.']
|
146
|
+
cur=self
|
147
|
+
for x in lst:
|
148
|
+
if x=='..':
|
149
|
+
cur=cur.parent or cur
|
150
|
+
continue
|
151
|
+
try:
|
152
|
+
if x in cur.children:
|
153
|
+
cur=cur.children[x]
|
154
|
+
continue
|
155
|
+
except:
|
156
|
+
cur.children={}
|
157
|
+
cur=self.__class__(x,cur)
|
158
|
+
try:
|
159
|
+
os.stat(cur.abspath())
|
160
|
+
except:
|
161
|
+
del cur.parent.children[x]
|
162
|
+
return None
|
163
|
+
ret=cur
|
164
|
+
try:
|
165
|
+
while not getattr(cur.parent,'cache_isdir',None):
|
166
|
+
cur=cur.parent
|
167
|
+
cur.cache_isdir=True
|
168
|
+
except AttributeError:
|
169
|
+
pass
|
170
|
+
return ret
|
171
|
+
def make_node(self,lst):
|
172
|
+
if isinstance(lst,str):
|
173
|
+
lst=[x for x in split_path(lst)if x and x!='.']
|
174
|
+
cur=self
|
175
|
+
for x in lst:
|
176
|
+
if x=='..':
|
177
|
+
cur=cur.parent or cur
|
178
|
+
continue
|
179
|
+
if getattr(cur,'children',{}):
|
180
|
+
if x in cur.children:
|
181
|
+
cur=cur.children[x]
|
182
|
+
continue
|
183
|
+
else:
|
184
|
+
cur.children={}
|
185
|
+
cur=self.__class__(x,cur)
|
186
|
+
return cur
|
187
|
+
def search(self,lst):
|
188
|
+
if isinstance(lst,str):
|
189
|
+
lst=[x for x in split_path(lst)if x and x!='.']
|
190
|
+
cur=self
|
191
|
+
try:
|
192
|
+
for x in lst:
|
193
|
+
if x=='..':
|
194
|
+
cur=cur.parent or cur
|
195
|
+
else:
|
196
|
+
cur=cur.children[x]
|
197
|
+
return cur
|
198
|
+
except:
|
199
|
+
pass
|
200
|
+
def path_from(self,node):
|
201
|
+
c1=self
|
202
|
+
c2=node
|
203
|
+
c1h=c1.height()
|
204
|
+
c2h=c2.height()
|
205
|
+
lst=[]
|
206
|
+
up=0
|
207
|
+
while c1h>c2h:
|
208
|
+
lst.append(c1.name)
|
209
|
+
c1=c1.parent
|
210
|
+
c1h-=1
|
211
|
+
while c2h>c1h:
|
212
|
+
up+=1
|
213
|
+
c2=c2.parent
|
214
|
+
c2h-=1
|
215
|
+
while id(c1)!=id(c2):
|
216
|
+
lst.append(c1.name)
|
217
|
+
up+=1
|
218
|
+
c1=c1.parent
|
219
|
+
c2=c2.parent
|
220
|
+
for i in range(up):
|
221
|
+
lst.append('..')
|
222
|
+
lst.reverse()
|
223
|
+
return os.sep.join(lst)or'.'
|
224
|
+
def abspath(self):
|
225
|
+
try:
|
226
|
+
return self.cache_abspath
|
227
|
+
except:
|
228
|
+
pass
|
229
|
+
if os.sep=='/':
|
230
|
+
if not self.parent:
|
231
|
+
val=os.sep
|
232
|
+
elif not self.parent.name:
|
233
|
+
val=os.sep+self.name
|
234
|
+
else:
|
235
|
+
val=self.parent.abspath()+os.sep+self.name
|
236
|
+
else:
|
237
|
+
if not self.parent:
|
238
|
+
val=''
|
239
|
+
elif not self.parent.name:
|
240
|
+
val=self.name+os.sep
|
241
|
+
else:
|
242
|
+
val=self.parent.abspath().rstrip(os.sep)+os.sep+self.name
|
243
|
+
self.cache_abspath=val
|
244
|
+
return val
|
245
|
+
def is_child_of(self,node):
|
246
|
+
p=self
|
247
|
+
diff=self.height()-node.height()
|
248
|
+
while diff>0:
|
249
|
+
diff-=1
|
250
|
+
p=p.parent
|
251
|
+
return id(p)==id(node)
|
252
|
+
def ant_iter(self,accept=None,maxdepth=25,pats=[],dir=False,src=True,remove=True):
|
253
|
+
dircont=self.listdir()
|
254
|
+
dircont.sort()
|
255
|
+
try:
|
256
|
+
lst=set(self.children.keys())
|
257
|
+
if remove:
|
258
|
+
for x in lst-set(dircont):
|
259
|
+
del self.children[x]
|
260
|
+
except:
|
261
|
+
self.children={}
|
262
|
+
for name in dircont:
|
263
|
+
npats=accept(name,pats)
|
264
|
+
if npats and npats[0]:
|
265
|
+
accepted=[]in npats[0]
|
266
|
+
node=self.make_node([name])
|
267
|
+
isdir=os.path.isdir(node.abspath())
|
268
|
+
if accepted:
|
269
|
+
if isdir:
|
270
|
+
if dir:
|
271
|
+
yield node
|
272
|
+
else:
|
273
|
+
if src:
|
274
|
+
yield node
|
275
|
+
if getattr(node,'cache_isdir',None)or isdir:
|
276
|
+
node.cache_isdir=True
|
277
|
+
if maxdepth:
|
278
|
+
for k in node.ant_iter(accept=accept,maxdepth=maxdepth-1,pats=npats,dir=dir,src=src):
|
279
|
+
yield k
|
280
|
+
raise StopIteration
|
281
|
+
def ant_glob(self,*k,**kw):
|
282
|
+
src=kw.get('src',True)
|
283
|
+
dir=kw.get('dir',False)
|
284
|
+
excl=kw.get('excl',exclude_regs)
|
285
|
+
incl=k and k[0]or kw.get('incl','**')
|
286
|
+
def to_pat(s):
|
287
|
+
lst=Utils.to_list(s)
|
288
|
+
ret=[]
|
289
|
+
for x in lst:
|
290
|
+
x=x.replace('\\','/').replace('//','/')
|
291
|
+
if x.endswith('/'):
|
292
|
+
x+='**'
|
293
|
+
lst2=x.split('/')
|
294
|
+
accu=[]
|
295
|
+
for k in lst2:
|
296
|
+
if k=='**':
|
297
|
+
accu.append(k)
|
298
|
+
else:
|
299
|
+
k=k.replace('.','[.]').replace('*','.*').replace('?','.').replace('+','\\+')
|
300
|
+
k='^%s$'%k
|
301
|
+
try:
|
302
|
+
accu.append(re.compile(k))
|
303
|
+
except Exception ,e:
|
304
|
+
raise Errors.WafError("Invalid pattern: %s"%k,e)
|
305
|
+
ret.append(accu)
|
306
|
+
return ret
|
307
|
+
def filtre(name,nn):
|
308
|
+
ret=[]
|
309
|
+
for lst in nn:
|
310
|
+
if not lst:
|
311
|
+
pass
|
312
|
+
elif lst[0]=='**':
|
313
|
+
ret.append(lst)
|
314
|
+
if len(lst)>1:
|
315
|
+
if lst[1].match(name):
|
316
|
+
ret.append(lst[2:])
|
317
|
+
else:
|
318
|
+
ret.append([])
|
319
|
+
elif lst[0].match(name):
|
320
|
+
ret.append(lst[1:])
|
321
|
+
return ret
|
322
|
+
def accept(name,pats):
|
323
|
+
nacc=filtre(name,pats[0])
|
324
|
+
nrej=filtre(name,pats[1])
|
325
|
+
if[]in nrej:
|
326
|
+
nacc=[]
|
327
|
+
return[nacc,nrej]
|
328
|
+
ret=[x for x in self.ant_iter(accept=accept,pats=[to_pat(incl),to_pat(excl)],maxdepth=25,dir=dir,src=src,remove=kw.get('remove',True))]
|
329
|
+
if kw.get('flat',False):
|
330
|
+
return' '.join([x.path_from(self)for x in ret])
|
331
|
+
return ret
|
332
|
+
def find_nodes(self,find_dirs=True,find_files=True,match_fun=lambda x:True):
|
333
|
+
x="""
|
334
|
+
Recursively finds nodes::
|
335
|
+
|
336
|
+
def configure(cnf):
|
337
|
+
cnf.find_nodes()
|
338
|
+
|
339
|
+
:param find_dirs: whether to return directories
|
340
|
+
:param find_files: whether to return files
|
341
|
+
:param match_fun: matching function, taking a node as parameter
|
342
|
+
:rtype generator
|
343
|
+
:return: a generator that iterates over all the requested files
|
344
|
+
"""
|
345
|
+
files=self.listdir()
|
346
|
+
for f in files:
|
347
|
+
node=self.make_node([f])
|
348
|
+
if os.path.isdir(node.abspath()):
|
349
|
+
if find_dirs and match_fun(node):
|
350
|
+
yield node
|
351
|
+
gen=node.find_nodes(find_dirs,find_files,match_fun)
|
352
|
+
for g in gen:
|
353
|
+
yield g
|
354
|
+
else:
|
355
|
+
if find_files and match_fun(node):
|
356
|
+
yield node
|
357
|
+
def is_src(self):
|
358
|
+
cur=self
|
359
|
+
x=id(self.ctx.srcnode)
|
360
|
+
y=id(self.ctx.bldnode)
|
361
|
+
while cur.parent:
|
362
|
+
if id(cur)==y:
|
363
|
+
return False
|
364
|
+
if id(cur)==x:
|
365
|
+
return True
|
366
|
+
cur=cur.parent
|
367
|
+
return False
|
368
|
+
def is_bld(self):
|
369
|
+
cur=self
|
370
|
+
y=id(self.ctx.bldnode)
|
371
|
+
while cur.parent:
|
372
|
+
if id(cur)==y:
|
373
|
+
return True
|
374
|
+
cur=cur.parent
|
375
|
+
return False
|
376
|
+
def get_src(self):
|
377
|
+
cur=self
|
378
|
+
x=id(self.ctx.srcnode)
|
379
|
+
y=id(self.ctx.bldnode)
|
380
|
+
lst=[]
|
381
|
+
while cur.parent:
|
382
|
+
if id(cur)==y:
|
383
|
+
lst.reverse()
|
384
|
+
return self.ctx.srcnode.make_node(lst)
|
385
|
+
if id(cur)==x:
|
386
|
+
return self
|
387
|
+
lst.append(cur.name)
|
388
|
+
cur=cur.parent
|
389
|
+
return self
|
390
|
+
def get_bld(self):
|
391
|
+
cur=self
|
392
|
+
x=id(self.ctx.srcnode)
|
393
|
+
y=id(self.ctx.bldnode)
|
394
|
+
lst=[]
|
395
|
+
while cur.parent:
|
396
|
+
if id(cur)==y:
|
397
|
+
return self
|
398
|
+
if id(cur)==x:
|
399
|
+
lst.reverse()
|
400
|
+
return self.ctx.bldnode.make_node(lst)
|
401
|
+
lst.append(cur.name)
|
402
|
+
cur=cur.parent
|
403
|
+
return self
|
404
|
+
def find_resource(self,lst):
|
405
|
+
if isinstance(lst,str):
|
406
|
+
lst=[x for x in split_path(lst)if x and x!='.']
|
407
|
+
node=self.get_bld().search(lst)
|
408
|
+
if not node:
|
409
|
+
self=self.get_src()
|
410
|
+
node=self.search(lst)
|
411
|
+
if not node:
|
412
|
+
node=self.find_node(lst)
|
413
|
+
try:
|
414
|
+
pat=node.abspath()
|
415
|
+
if os.path.isdir(pat):
|
416
|
+
return None
|
417
|
+
except:
|
418
|
+
pass
|
419
|
+
return node
|
420
|
+
def find_or_declare(self,lst):
|
421
|
+
if isinstance(lst,str):
|
422
|
+
lst=[x for x in split_path(lst)if x and x!='.']
|
423
|
+
node=self.get_bld().search(lst)
|
424
|
+
if node:
|
425
|
+
if not os.path.isfile(node.abspath()):
|
426
|
+
node.sig=None
|
427
|
+
try:
|
428
|
+
node.parent.mkdir()
|
429
|
+
except:
|
430
|
+
pass
|
431
|
+
return node
|
432
|
+
self=self.get_src()
|
433
|
+
node=self.find_node(lst)
|
434
|
+
if node:
|
435
|
+
if not os.path.isfile(node.abspath()):
|
436
|
+
node.sig=None
|
437
|
+
try:
|
438
|
+
node.parent.mkdir()
|
439
|
+
except:
|
440
|
+
pass
|
441
|
+
return node
|
442
|
+
node=self.get_bld().make_node(lst)
|
443
|
+
node.parent.mkdir()
|
444
|
+
return node
|
445
|
+
def find_dir(self,lst):
|
446
|
+
if isinstance(lst,str):
|
447
|
+
lst=[x for x in split_path(lst)if x and x!='.']
|
448
|
+
node=self.find_node(lst)
|
449
|
+
try:
|
450
|
+
if not os.path.isdir(node.abspath()):
|
451
|
+
return None
|
452
|
+
except(OSError,AttributeError):
|
453
|
+
return None
|
454
|
+
return node
|
455
|
+
def change_ext(self,ext,ext_in=None):
|
456
|
+
name=self.name
|
457
|
+
if ext_in is None:
|
458
|
+
k=name.rfind('.')
|
459
|
+
if k>=0:
|
460
|
+
name=name[:k]+ext
|
461
|
+
else:
|
462
|
+
name=name+ext
|
463
|
+
else:
|
464
|
+
name=name[:-len(ext_in)]+ext
|
465
|
+
return self.parent.find_or_declare([name])
|
466
|
+
def nice_path(self,env=None):
|
467
|
+
return self.path_from(self.ctx.launch_node())
|
468
|
+
def bldpath(self):
|
469
|
+
return self.path_from(self.ctx.bldnode)
|
470
|
+
def srcpath(self):
|
471
|
+
return self.path_from(self.ctx.srcnode)
|
472
|
+
def relpath(self):
|
473
|
+
cur=self
|
474
|
+
x=id(self.ctx.bldnode)
|
475
|
+
while cur.parent:
|
476
|
+
if id(cur)==x:
|
477
|
+
return self.bldpath()
|
478
|
+
cur=cur.parent
|
479
|
+
return self.srcpath()
|
480
|
+
def bld_dir(self):
|
481
|
+
return self.parent.bldpath()
|
482
|
+
def bld_base(self):
|
483
|
+
s=os.path.splitext(self.name)[0]
|
484
|
+
return self.bld_dir()+os.sep+s
|
485
|
+
def get_bld_sig(self):
|
486
|
+
try:
|
487
|
+
ret=self.ctx.hash_cache[id(self)]
|
488
|
+
except KeyError:
|
489
|
+
pass
|
490
|
+
except AttributeError:
|
491
|
+
self.ctx.hash_cache={}
|
492
|
+
else:
|
493
|
+
return ret
|
494
|
+
if not self.is_bld()or self.ctx.bldnode is self.ctx.srcnode:
|
495
|
+
self.sig=Utils.h_file(self.abspath())
|
496
|
+
self.ctx.hash_cache[id(self)]=ret=self.sig
|
497
|
+
return ret
|
498
|
+
pickle_lock=Utils.threading.Lock()
|
499
|
+
class Nod3(Node):
|
500
|
+
pass
|