text_ux 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2006, Google Inc.
|
|
2
|
+
// All rights reserved.
|
|
3
|
+
//
|
|
4
|
+
// Redistribution and use in source and binary forms, with or without
|
|
5
|
+
// modification, are permitted provided that the following conditions are
|
|
6
|
+
// met:
|
|
7
|
+
//
|
|
8
|
+
// * Redistributions of source code must retain the above copyright
|
|
9
|
+
// notice, this list of conditions and the following disclaimer.
|
|
10
|
+
// * Redistributions in binary form must reproduce the above
|
|
11
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
12
|
+
// in the documentation and/or other materials provided with the
|
|
13
|
+
// distribution.
|
|
14
|
+
// * Neither the name of Google Inc. nor the names of its
|
|
15
|
+
// contributors may be used to endorse or promote products derived from
|
|
16
|
+
// this software without specific prior written permission.
|
|
17
|
+
//
|
|
18
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
19
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
20
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
21
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
22
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
23
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
24
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
25
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
26
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
27
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
+
|
|
30
|
+
#include <iostream>
|
|
31
|
+
|
|
32
|
+
#include "gtest/gtest.h"
|
|
33
|
+
|
|
34
|
+
GTEST_API_ int main(int argc, char **argv) {
|
|
35
|
+
std::cout << "Running main() from gtest_main.cc\n";
|
|
36
|
+
|
|
37
|
+
testing::InitGoogleTest(&argc, argv);
|
|
38
|
+
return RUN_ALL_TESTS();
|
|
39
|
+
}
|
|
@@ -0,0 +1,733 @@
|
|
|
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 os,sys,errno,re,shutil
|
|
6
|
+
try:import cPickle
|
|
7
|
+
except:import pickle as cPickle
|
|
8
|
+
from waflib import Runner,TaskGen,Utils,ConfigSet,Task,Logs,Options,Context,Errors
|
|
9
|
+
import waflib.Node
|
|
10
|
+
CACHE_DIR='c4che'
|
|
11
|
+
CACHE_SUFFIX='_cache.py'
|
|
12
|
+
INSTALL=1337
|
|
13
|
+
UNINSTALL=-1337
|
|
14
|
+
SAVED_ATTRS='root node_deps raw_deps task_sigs'.split()
|
|
15
|
+
CFG_FILES='cfg_files'
|
|
16
|
+
POST_AT_ONCE=0
|
|
17
|
+
POST_LAZY=1
|
|
18
|
+
POST_BOTH=2
|
|
19
|
+
class BuildContext(Context.Context):
|
|
20
|
+
'''executes the build'''
|
|
21
|
+
cmd='build'
|
|
22
|
+
variant=''
|
|
23
|
+
def __init__(self,**kw):
|
|
24
|
+
super(BuildContext,self).__init__(**kw)
|
|
25
|
+
self.is_install=0
|
|
26
|
+
self.top_dir=kw.get('top_dir',Context.top_dir)
|
|
27
|
+
self.run_dir=kw.get('run_dir',Context.run_dir)
|
|
28
|
+
self.post_mode=POST_AT_ONCE
|
|
29
|
+
self.out_dir=kw.get('out_dir',Context.out_dir)
|
|
30
|
+
self.cache_dir=kw.get('cache_dir',None)
|
|
31
|
+
if not self.cache_dir:
|
|
32
|
+
self.cache_dir=self.out_dir+os.sep+CACHE_DIR
|
|
33
|
+
self.all_envs={}
|
|
34
|
+
self.task_sigs={}
|
|
35
|
+
self.node_deps={}
|
|
36
|
+
self.raw_deps={}
|
|
37
|
+
self.cache_dir_contents={}
|
|
38
|
+
self.task_gen_cache_names={}
|
|
39
|
+
self.launch_dir=Context.launch_dir
|
|
40
|
+
self.jobs=Options.options.jobs
|
|
41
|
+
self.targets=Options.options.targets
|
|
42
|
+
self.keep=Options.options.keep
|
|
43
|
+
self.cache_global=Options.cache_global
|
|
44
|
+
self.nocache=Options.options.nocache
|
|
45
|
+
self.progress_bar=Options.options.progress_bar
|
|
46
|
+
self.deps_man=Utils.defaultdict(list)
|
|
47
|
+
self.current_group=0
|
|
48
|
+
self.groups=[]
|
|
49
|
+
self.group_names={}
|
|
50
|
+
def get_variant_dir(self):
|
|
51
|
+
if not self.variant:
|
|
52
|
+
return self.out_dir
|
|
53
|
+
return os.path.join(self.out_dir,self.variant)
|
|
54
|
+
variant_dir=property(get_variant_dir,None)
|
|
55
|
+
def __call__(self,*k,**kw):
|
|
56
|
+
kw['bld']=self
|
|
57
|
+
ret=TaskGen.task_gen(*k,**kw)
|
|
58
|
+
self.task_gen_cache_names={}
|
|
59
|
+
self.add_to_group(ret,group=kw.get('group',None))
|
|
60
|
+
return ret
|
|
61
|
+
def __copy__(self):
|
|
62
|
+
raise Errors.WafError('build contexts are not supposed to be copied')
|
|
63
|
+
def install_files(self,*k,**kw):
|
|
64
|
+
pass
|
|
65
|
+
def install_as(self,*k,**kw):
|
|
66
|
+
pass
|
|
67
|
+
def symlink_as(self,*k,**kw):
|
|
68
|
+
pass
|
|
69
|
+
def load_envs(self):
|
|
70
|
+
try:
|
|
71
|
+
lst=Utils.listdir(self.cache_dir)
|
|
72
|
+
except OSError ,e:
|
|
73
|
+
if e.errno==errno.ENOENT:
|
|
74
|
+
raise Errors.WafError('The project was not configured: run "waf configure" first!')
|
|
75
|
+
else:
|
|
76
|
+
raise
|
|
77
|
+
if not lst:
|
|
78
|
+
raise Errors.WafError('The cache directory is empty: reconfigure the project')
|
|
79
|
+
for fname in lst:
|
|
80
|
+
if fname.endswith(CACHE_SUFFIX):
|
|
81
|
+
env=ConfigSet.ConfigSet(os.path.join(self.cache_dir,fname))
|
|
82
|
+
name=fname[:-len(CACHE_SUFFIX)]
|
|
83
|
+
self.all_envs[name]=env
|
|
84
|
+
for f in env[CFG_FILES]:
|
|
85
|
+
newnode=self.root.find_resource(f)
|
|
86
|
+
try:
|
|
87
|
+
h=Utils.h_file(newnode.abspath())
|
|
88
|
+
except(IOError,AttributeError):
|
|
89
|
+
Logs.error('cannot find %r'%f)
|
|
90
|
+
h=Utils.SIG_NIL
|
|
91
|
+
newnode.sig=h
|
|
92
|
+
def init_dirs(self):
|
|
93
|
+
if not(os.path.isabs(self.top_dir)and os.path.isabs(self.out_dir)):
|
|
94
|
+
raise Errors.WafError('The project was not configured: run "waf configure" first!')
|
|
95
|
+
self.path=self.srcnode=self.root.find_dir(self.top_dir)
|
|
96
|
+
self.bldnode=self.root.make_node(self.variant_dir)
|
|
97
|
+
self.bldnode.mkdir()
|
|
98
|
+
def execute(self):
|
|
99
|
+
self.restore()
|
|
100
|
+
if not self.all_envs:
|
|
101
|
+
self.load_envs()
|
|
102
|
+
self.execute_build()
|
|
103
|
+
def execute_build(self):
|
|
104
|
+
Logs.info("Waf: Entering directory `%s'"%self.variant_dir)
|
|
105
|
+
self.recurse([self.run_dir])
|
|
106
|
+
self.pre_build()
|
|
107
|
+
self.timer=Utils.Timer()
|
|
108
|
+
if self.progress_bar:
|
|
109
|
+
sys.stderr.write(Logs.colors.cursor_off)
|
|
110
|
+
try:
|
|
111
|
+
self.compile()
|
|
112
|
+
finally:
|
|
113
|
+
if self.progress_bar==1:
|
|
114
|
+
c=len(self.returned_tasks)or 1
|
|
115
|
+
self.to_log(self.progress_line(c,c,Logs.colors.BLUE,Logs.colors.NORMAL))
|
|
116
|
+
print('')
|
|
117
|
+
sys.stdout.flush()
|
|
118
|
+
sys.stderr.write(Logs.colors.cursor_on)
|
|
119
|
+
Logs.info("Waf: Leaving directory `%s'"%self.variant_dir)
|
|
120
|
+
self.post_build()
|
|
121
|
+
def restore(self):
|
|
122
|
+
try:
|
|
123
|
+
env=ConfigSet.ConfigSet(os.path.join(self.cache_dir,'build.config.py'))
|
|
124
|
+
except(IOError,OSError):
|
|
125
|
+
pass
|
|
126
|
+
else:
|
|
127
|
+
if env['version']<Context.HEXVERSION:
|
|
128
|
+
raise Errors.WafError('Version mismatch! reconfigure the project')
|
|
129
|
+
for t in env['tools']:
|
|
130
|
+
self.setup(**t)
|
|
131
|
+
f=None
|
|
132
|
+
try:
|
|
133
|
+
dbfn=os.path.join(self.variant_dir,Context.DBFILE)
|
|
134
|
+
try:
|
|
135
|
+
f=open(dbfn,'rb')
|
|
136
|
+
except(IOError,EOFError):
|
|
137
|
+
Logs.debug('build: could not load the build cache %s (missing)'%dbfn)
|
|
138
|
+
else:
|
|
139
|
+
try:
|
|
140
|
+
waflib.Node.pickle_lock.acquire()
|
|
141
|
+
waflib.Node.Nod3=self.node_class
|
|
142
|
+
try:
|
|
143
|
+
data=cPickle.load(f)
|
|
144
|
+
except Exception ,e:
|
|
145
|
+
Logs.debug('build: could not pickle the build cache %s: %r'%(dbfn,e))
|
|
146
|
+
else:
|
|
147
|
+
for x in SAVED_ATTRS:
|
|
148
|
+
setattr(self,x,data[x])
|
|
149
|
+
finally:
|
|
150
|
+
waflib.Node.pickle_lock.release()
|
|
151
|
+
finally:
|
|
152
|
+
if f:
|
|
153
|
+
f.close()
|
|
154
|
+
self.init_dirs()
|
|
155
|
+
def store(self):
|
|
156
|
+
data={}
|
|
157
|
+
for x in SAVED_ATTRS:
|
|
158
|
+
data[x]=getattr(self,x)
|
|
159
|
+
db=os.path.join(self.variant_dir,Context.DBFILE)
|
|
160
|
+
try:
|
|
161
|
+
waflib.Node.pickle_lock.acquire()
|
|
162
|
+
waflib.Node.Nod3=self.node_class
|
|
163
|
+
f=None
|
|
164
|
+
try:
|
|
165
|
+
f=open(db+'.tmp','wb')
|
|
166
|
+
cPickle.dump(data,f)
|
|
167
|
+
finally:
|
|
168
|
+
if f:
|
|
169
|
+
f.close()
|
|
170
|
+
finally:
|
|
171
|
+
waflib.Node.pickle_lock.release()
|
|
172
|
+
try:
|
|
173
|
+
st=os.stat(db)
|
|
174
|
+
os.unlink(db)
|
|
175
|
+
if not Utils.is_win32:
|
|
176
|
+
os.chown(db+'.tmp',st.st_uid,st.st_gid)
|
|
177
|
+
except(AttributeError,OSError):
|
|
178
|
+
pass
|
|
179
|
+
os.rename(db+'.tmp',db)
|
|
180
|
+
def compile(self):
|
|
181
|
+
Logs.debug('build: compile()')
|
|
182
|
+
self.producer=Runner.Parallel(self,self.jobs)
|
|
183
|
+
self.producer.biter=self.get_build_iterator()
|
|
184
|
+
self.returned_tasks=[]
|
|
185
|
+
try:
|
|
186
|
+
self.producer.start()
|
|
187
|
+
except KeyboardInterrupt:
|
|
188
|
+
self.store()
|
|
189
|
+
raise
|
|
190
|
+
else:
|
|
191
|
+
if self.producer.dirty:
|
|
192
|
+
self.store()
|
|
193
|
+
if self.producer.error:
|
|
194
|
+
raise Errors.BuildError(self.producer.error)
|
|
195
|
+
def setup(self,tool,tooldir=None,funs=None):
|
|
196
|
+
if isinstance(tool,list):
|
|
197
|
+
for i in tool:self.setup(i,tooldir)
|
|
198
|
+
return
|
|
199
|
+
module=Context.load_tool(tool,tooldir)
|
|
200
|
+
if hasattr(module,"setup"):module.setup(self)
|
|
201
|
+
def get_env(self):
|
|
202
|
+
try:
|
|
203
|
+
return self.all_envs[self.variant]
|
|
204
|
+
except KeyError:
|
|
205
|
+
return self.all_envs['']
|
|
206
|
+
def set_env(self,val):
|
|
207
|
+
self.all_envs[self.variant]=val
|
|
208
|
+
env=property(get_env,set_env)
|
|
209
|
+
def add_manual_dependency(self,path,value):
|
|
210
|
+
if isinstance(path,waflib.Node.Node):
|
|
211
|
+
node=path
|
|
212
|
+
elif os.path.isabs(path):
|
|
213
|
+
node=self.root.find_resource(path)
|
|
214
|
+
else:
|
|
215
|
+
node=self.path.find_resource(path)
|
|
216
|
+
self.deps_man[id(node)].append(value)
|
|
217
|
+
def launch_node(self):
|
|
218
|
+
try:
|
|
219
|
+
return self.p_ln
|
|
220
|
+
except AttributeError:
|
|
221
|
+
self.p_ln=self.root.find_dir(self.launch_dir)
|
|
222
|
+
return self.p_ln
|
|
223
|
+
def hash_env_vars(self,env,vars_lst):
|
|
224
|
+
if not env.table:
|
|
225
|
+
env=env.parent
|
|
226
|
+
if not env:
|
|
227
|
+
return Utils.SIG_NIL
|
|
228
|
+
idx=str(id(env))+str(vars_lst)
|
|
229
|
+
try:
|
|
230
|
+
cache=self.cache_env
|
|
231
|
+
except AttributeError:
|
|
232
|
+
cache=self.cache_env={}
|
|
233
|
+
else:
|
|
234
|
+
try:
|
|
235
|
+
return self.cache_env[idx]
|
|
236
|
+
except KeyError:
|
|
237
|
+
pass
|
|
238
|
+
lst=[env[a]for a in vars_lst]
|
|
239
|
+
ret=Utils.h_list(lst)
|
|
240
|
+
Logs.debug('envhash: %s %r',Utils.to_hex(ret),lst)
|
|
241
|
+
cache[idx]=ret
|
|
242
|
+
return ret
|
|
243
|
+
def get_tgen_by_name(self,name):
|
|
244
|
+
cache=self.task_gen_cache_names
|
|
245
|
+
if not cache:
|
|
246
|
+
for g in self.groups:
|
|
247
|
+
for tg in g:
|
|
248
|
+
try:
|
|
249
|
+
cache[tg.name]=tg
|
|
250
|
+
except AttributeError:
|
|
251
|
+
pass
|
|
252
|
+
try:
|
|
253
|
+
return cache[name]
|
|
254
|
+
except KeyError:
|
|
255
|
+
raise Errors.WafError('Could not find a task generator for the name %r'%name)
|
|
256
|
+
def progress_line(self,state,total,col1,col2):
|
|
257
|
+
n=len(str(total))
|
|
258
|
+
Utils.rot_idx+=1
|
|
259
|
+
ind=Utils.rot_chr[Utils.rot_idx%4]
|
|
260
|
+
pc=(100.*state)/total
|
|
261
|
+
eta=str(self.timer)
|
|
262
|
+
fs="[%%%dd/%%%dd][%%s%%2d%%%%%%s][%s]["%(n,n,ind)
|
|
263
|
+
left=fs%(state,total,col1,pc,col2)
|
|
264
|
+
right='][%s%s%s]'%(col1,eta,col2)
|
|
265
|
+
cols=Logs.get_term_cols()-len(left)-len(right)+2*len(col1)+2*len(col2)
|
|
266
|
+
if cols<7:cols=7
|
|
267
|
+
ratio=((cols*state)//total)-1
|
|
268
|
+
bar=('='*ratio+'>').ljust(cols)
|
|
269
|
+
msg=Utils.indicator%(left,bar,right)
|
|
270
|
+
return msg
|
|
271
|
+
def declare_chain(self,*k,**kw):
|
|
272
|
+
return TaskGen.declare_chain(*k,**kw)
|
|
273
|
+
def pre_build(self):
|
|
274
|
+
for m in getattr(self,'pre_funs',[]):
|
|
275
|
+
m(self)
|
|
276
|
+
def post_build(self):
|
|
277
|
+
for m in getattr(self,'post_funs',[]):
|
|
278
|
+
m(self)
|
|
279
|
+
def add_pre_fun(self,meth):
|
|
280
|
+
try:
|
|
281
|
+
self.pre_funs.append(meth)
|
|
282
|
+
except AttributeError:
|
|
283
|
+
self.pre_funs=[meth]
|
|
284
|
+
def add_post_fun(self,meth):
|
|
285
|
+
try:
|
|
286
|
+
self.post_funs.append(meth)
|
|
287
|
+
except AttributeError:
|
|
288
|
+
self.post_funs=[meth]
|
|
289
|
+
def get_group(self,x):
|
|
290
|
+
if not self.groups:
|
|
291
|
+
self.add_group()
|
|
292
|
+
if x is None:
|
|
293
|
+
return self.groups[self.current_group]
|
|
294
|
+
if x in self.group_names:
|
|
295
|
+
return self.group_names[x]
|
|
296
|
+
return self.groups[x]
|
|
297
|
+
def add_to_group(self,tgen,group=None):
|
|
298
|
+
assert(isinstance(tgen,TaskGen.task_gen)or isinstance(tgen,Task.TaskBase))
|
|
299
|
+
tgen.bld=self
|
|
300
|
+
self.get_group(group).append(tgen)
|
|
301
|
+
def get_group_name(self,g):
|
|
302
|
+
if not isinstance(g,list):
|
|
303
|
+
g=self.groups[g]
|
|
304
|
+
for x in self.group_names:
|
|
305
|
+
if id(self.group_names[x])==id(g):
|
|
306
|
+
return x
|
|
307
|
+
return''
|
|
308
|
+
def get_group_idx(self,tg):
|
|
309
|
+
se=id(tg)
|
|
310
|
+
for i in range(len(self.groups)):
|
|
311
|
+
for t in self.groups[i]:
|
|
312
|
+
if id(t)==se:
|
|
313
|
+
return i
|
|
314
|
+
return None
|
|
315
|
+
def add_group(self,name=None,move=True):
|
|
316
|
+
if name and name in self.group_names:
|
|
317
|
+
Logs.error('add_group: name %s already present'%name)
|
|
318
|
+
g=[]
|
|
319
|
+
self.group_names[name]=g
|
|
320
|
+
self.groups.append(g)
|
|
321
|
+
if move:
|
|
322
|
+
self.current_group=len(self.groups)-1
|
|
323
|
+
def set_group(self,idx):
|
|
324
|
+
if isinstance(idx,str):
|
|
325
|
+
g=self.group_names[idx]
|
|
326
|
+
for i in range(len(self.groups)):
|
|
327
|
+
if id(g)==id(self.groups[i]):
|
|
328
|
+
self.current_group=i
|
|
329
|
+
else:
|
|
330
|
+
self.current_group=idx
|
|
331
|
+
def total(self):
|
|
332
|
+
total=0
|
|
333
|
+
for group in self.groups:
|
|
334
|
+
for tg in group:
|
|
335
|
+
try:
|
|
336
|
+
total+=len(tg.tasks)
|
|
337
|
+
except AttributeError:
|
|
338
|
+
total+=1
|
|
339
|
+
return total
|
|
340
|
+
def get_targets(self):
|
|
341
|
+
to_post=[]
|
|
342
|
+
min_grp=0
|
|
343
|
+
for name in self.targets.split(','):
|
|
344
|
+
tg=self.get_tgen_by_name(name)
|
|
345
|
+
if not tg:
|
|
346
|
+
raise Errors.WafError('target %r does not exist'%name)
|
|
347
|
+
m=self.get_group_idx(tg)
|
|
348
|
+
if m>min_grp:
|
|
349
|
+
min_grp=m
|
|
350
|
+
to_post=[tg]
|
|
351
|
+
elif m==min_grp:
|
|
352
|
+
to_post.append(tg)
|
|
353
|
+
return(min_grp,to_post)
|
|
354
|
+
def post_group(self):
|
|
355
|
+
if self.targets=='*':
|
|
356
|
+
for tg in self.groups[self.cur]:
|
|
357
|
+
try:
|
|
358
|
+
f=tg.post
|
|
359
|
+
except AttributeError:
|
|
360
|
+
pass
|
|
361
|
+
else:
|
|
362
|
+
f()
|
|
363
|
+
elif self.targets:
|
|
364
|
+
if self.cur<self._min_grp:
|
|
365
|
+
for tg in self.groups[self.cur]:
|
|
366
|
+
try:
|
|
367
|
+
f=tg.post
|
|
368
|
+
except AttributeError:
|
|
369
|
+
pass
|
|
370
|
+
else:
|
|
371
|
+
f()
|
|
372
|
+
else:
|
|
373
|
+
for tg in self._exact_tg:
|
|
374
|
+
tg.post()
|
|
375
|
+
else:
|
|
376
|
+
ln=self.launch_node()
|
|
377
|
+
for tg in self.groups[self.cur]:
|
|
378
|
+
try:
|
|
379
|
+
f=tg.post
|
|
380
|
+
except AttributeError:
|
|
381
|
+
pass
|
|
382
|
+
else:
|
|
383
|
+
if tg.path.is_child_of(ln):
|
|
384
|
+
f()
|
|
385
|
+
def get_tasks_group(self,idx):
|
|
386
|
+
tasks=[]
|
|
387
|
+
for tg in self.groups[idx]:
|
|
388
|
+
if isinstance(tg,Task.TaskBase):
|
|
389
|
+
tasks.append(tg)
|
|
390
|
+
else:
|
|
391
|
+
tasks.extend(tg.tasks)
|
|
392
|
+
return tasks
|
|
393
|
+
def get_build_iterator(self):
|
|
394
|
+
self.cur=0
|
|
395
|
+
if self.targets and self.targets!='*':
|
|
396
|
+
(self._min_grp,self._exact_tg)=self.get_targets()
|
|
397
|
+
global lazy_post
|
|
398
|
+
if self.post_mode!=POST_LAZY:
|
|
399
|
+
while self.cur<len(self.groups):
|
|
400
|
+
self.post_group()
|
|
401
|
+
self.cur+=1
|
|
402
|
+
self.cur=0
|
|
403
|
+
while self.cur<len(self.groups):
|
|
404
|
+
if self.post_mode!=POST_AT_ONCE:
|
|
405
|
+
self.post_group()
|
|
406
|
+
tasks=self.get_tasks_group(self.cur)
|
|
407
|
+
Task.set_file_constraints(tasks)
|
|
408
|
+
Task.set_precedence_constraints(tasks)
|
|
409
|
+
self.cur_tasks=tasks
|
|
410
|
+
self.cur+=1
|
|
411
|
+
if not tasks:
|
|
412
|
+
continue
|
|
413
|
+
yield tasks
|
|
414
|
+
while 1:
|
|
415
|
+
yield[]
|
|
416
|
+
class inst(Task.Task):
|
|
417
|
+
color='CYAN'
|
|
418
|
+
def post(self):
|
|
419
|
+
buf=[]
|
|
420
|
+
for x in self.source:
|
|
421
|
+
if isinstance(x,waflib.Node.Node):
|
|
422
|
+
y=x
|
|
423
|
+
else:
|
|
424
|
+
y=self.path.find_resource(x)
|
|
425
|
+
if not y:
|
|
426
|
+
idx=self.generator.bld.get_group_idx(self)
|
|
427
|
+
for tg in self.generator.bld.groups[idx]:
|
|
428
|
+
if not isinstance(tg,inst)and id(tg)!=id(self):
|
|
429
|
+
tg.post()
|
|
430
|
+
y=self.path.find_resource(x)
|
|
431
|
+
if y:
|
|
432
|
+
break
|
|
433
|
+
else:
|
|
434
|
+
raise Errors.WafError('could not find %r in %r'%(x,self.path))
|
|
435
|
+
buf.append(y)
|
|
436
|
+
self.inputs=buf
|
|
437
|
+
def runnable_status(self):
|
|
438
|
+
ret=super(inst,self).runnable_status()
|
|
439
|
+
if ret==Task.SKIP_ME:
|
|
440
|
+
return Task.RUN_ME
|
|
441
|
+
return ret
|
|
442
|
+
def __str__(self):
|
|
443
|
+
return''
|
|
444
|
+
def run(self):
|
|
445
|
+
return self.generator.exec_task()
|
|
446
|
+
def get_install_path(self,destdir=True):
|
|
447
|
+
dest=Utils.subst_vars(self.dest,self.env)
|
|
448
|
+
dest=dest.replace('/',os.sep)
|
|
449
|
+
if destdir and Options.options.destdir:
|
|
450
|
+
dest=os.path.join(Options.options.destdir,os.path.splitdrive(dest)[1].lstrip(os.sep))
|
|
451
|
+
return dest
|
|
452
|
+
def exec_install_files(self):
|
|
453
|
+
destpath=self.get_install_path()
|
|
454
|
+
if not destpath:
|
|
455
|
+
raise Errors.WafError('unknown installation path %r'%self.generator)
|
|
456
|
+
for x,y in zip(self.source,self.inputs):
|
|
457
|
+
if self.relative_trick:
|
|
458
|
+
destfile=os.path.join(destpath,y.path_from(self.path))
|
|
459
|
+
Utils.check_dir(os.path.dirname(destfile))
|
|
460
|
+
else:
|
|
461
|
+
destfile=os.path.join(destpath,y.name)
|
|
462
|
+
self.generator.bld.do_install(y.abspath(),destfile,self.chmod)
|
|
463
|
+
def exec_install_as(self):
|
|
464
|
+
destfile=self.get_install_path()
|
|
465
|
+
self.generator.bld.do_install(self.inputs[0].abspath(),destfile,self.chmod)
|
|
466
|
+
def exec_symlink_as(self):
|
|
467
|
+
destfile=self.get_install_path()
|
|
468
|
+
self.generator.bld.do_link(self.link,destfile)
|
|
469
|
+
class InstallContext(BuildContext):
|
|
470
|
+
'''installs the targets on the system'''
|
|
471
|
+
cmd='install'
|
|
472
|
+
def __init__(self,**kw):
|
|
473
|
+
super(InstallContext,self).__init__(**kw)
|
|
474
|
+
self.uninstall=[]
|
|
475
|
+
self.is_install=INSTALL
|
|
476
|
+
def do_install(self,src,tgt,chmod=Utils.O644):
|
|
477
|
+
d,_=os.path.split(tgt)
|
|
478
|
+
if not d:
|
|
479
|
+
raise Errors.WafError('Invalid installation given %r->%r'%(src,tgt))
|
|
480
|
+
Utils.check_dir(d)
|
|
481
|
+
srclbl=src.replace(self.srcnode.abspath()+os.sep,'')
|
|
482
|
+
if not Options.options.force:
|
|
483
|
+
try:
|
|
484
|
+
st1=os.stat(tgt)
|
|
485
|
+
st2=os.stat(src)
|
|
486
|
+
except OSError:
|
|
487
|
+
pass
|
|
488
|
+
else:
|
|
489
|
+
if st1.st_mtime+2>=st2.st_mtime and st1.st_size==st2.st_size:
|
|
490
|
+
if not self.progress_bar:
|
|
491
|
+
Logs.info('- install %s (from %s)'%(tgt,srclbl))
|
|
492
|
+
return False
|
|
493
|
+
if not self.progress_bar:
|
|
494
|
+
Logs.info('+ install %s (from %s)'%(tgt,srclbl))
|
|
495
|
+
try:
|
|
496
|
+
os.remove(tgt)
|
|
497
|
+
except OSError:
|
|
498
|
+
pass
|
|
499
|
+
try:
|
|
500
|
+
shutil.copy2(src,tgt)
|
|
501
|
+
os.chmod(tgt,chmod)
|
|
502
|
+
except IOError:
|
|
503
|
+
try:
|
|
504
|
+
os.stat(src)
|
|
505
|
+
except(OSError,IOError):
|
|
506
|
+
Logs.error('File %r does not exist'%src)
|
|
507
|
+
raise Errors.WafError('Could not install the file %r'%tgt)
|
|
508
|
+
def do_link(self,src,tgt):
|
|
509
|
+
d,_=os.path.split(tgt)
|
|
510
|
+
Utils.check_dir(d)
|
|
511
|
+
link=False
|
|
512
|
+
if not os.path.islink(tgt):
|
|
513
|
+
link=True
|
|
514
|
+
elif os.readlink(tgt)!=src:
|
|
515
|
+
link=True
|
|
516
|
+
if link:
|
|
517
|
+
try:os.remove(tgt)
|
|
518
|
+
except OSError:pass
|
|
519
|
+
if not self.progress_bar:
|
|
520
|
+
Logs.info('+ symlink %s (to %s)'%(tgt,src))
|
|
521
|
+
os.symlink(src,tgt)
|
|
522
|
+
else:
|
|
523
|
+
if not self.progress_bar:
|
|
524
|
+
Logs.info('- symlink %s (to %s)'%(tgt,src))
|
|
525
|
+
def run_task_now(self,tsk,postpone):
|
|
526
|
+
tsk.post()
|
|
527
|
+
if not postpone:
|
|
528
|
+
if tsk.runnable_status()==Task.ASK_LATER:
|
|
529
|
+
raise self.WafError('cannot post the task %r'%tsk)
|
|
530
|
+
tsk.run()
|
|
531
|
+
def install_files(self,dest,files,env=None,chmod=Utils.O644,relative_trick=False,cwd=None,add=True,postpone=True):
|
|
532
|
+
tsk=inst(env=env or self.env)
|
|
533
|
+
tsk.bld=self
|
|
534
|
+
tsk.path=cwd or self.path
|
|
535
|
+
tsk.chmod=chmod
|
|
536
|
+
if isinstance(files,waflib.Node.Node):
|
|
537
|
+
tsk.source=[files]
|
|
538
|
+
else:
|
|
539
|
+
tsk.source=Utils.to_list(files)
|
|
540
|
+
tsk.dest=dest
|
|
541
|
+
tsk.exec_task=tsk.exec_install_files
|
|
542
|
+
tsk.relative_trick=relative_trick
|
|
543
|
+
if add:self.add_to_group(tsk)
|
|
544
|
+
self.run_task_now(tsk,postpone)
|
|
545
|
+
return tsk
|
|
546
|
+
def install_as(self,dest,srcfile,env=None,chmod=Utils.O644,cwd=None,add=True,postpone=True):
|
|
547
|
+
tsk=inst(env=env or self.env)
|
|
548
|
+
tsk.bld=self
|
|
549
|
+
tsk.path=cwd or self.path
|
|
550
|
+
tsk.chmod=chmod
|
|
551
|
+
tsk.source=[srcfile]
|
|
552
|
+
tsk.dest=dest
|
|
553
|
+
tsk.exec_task=tsk.exec_install_as
|
|
554
|
+
if add:self.add_to_group(tsk)
|
|
555
|
+
self.run_task_now(tsk,postpone)
|
|
556
|
+
return tsk
|
|
557
|
+
def symlink_as(self,dest,src,env=None,cwd=None,add=True,postpone=True):
|
|
558
|
+
if Utils.is_win32:
|
|
559
|
+
return
|
|
560
|
+
tsk=inst(env=env or self.env)
|
|
561
|
+
tsk.bld=self
|
|
562
|
+
tsk.dest=dest
|
|
563
|
+
tsk.path=cwd or self.path
|
|
564
|
+
tsk.source=[]
|
|
565
|
+
tsk.link=src
|
|
566
|
+
tsk.exec_task=tsk.exec_symlink_as
|
|
567
|
+
if add:self.add_to_group(tsk)
|
|
568
|
+
self.run_task_now(tsk,postpone)
|
|
569
|
+
return tsk
|
|
570
|
+
class UninstallContext(InstallContext):
|
|
571
|
+
'''removes the targets installed'''
|
|
572
|
+
cmd='uninstall'
|
|
573
|
+
def __init__(self,**kw):
|
|
574
|
+
super(UninstallContext,self).__init__(**kw)
|
|
575
|
+
self.is_install=UNINSTALL
|
|
576
|
+
def do_install(self,src,tgt,chmod=Utils.O644):
|
|
577
|
+
if not self.progress_bar:
|
|
578
|
+
Logs.info('- remove %s'%tgt)
|
|
579
|
+
self.uninstall.append(tgt)
|
|
580
|
+
try:
|
|
581
|
+
os.remove(tgt)
|
|
582
|
+
except OSError ,e:
|
|
583
|
+
if e.errno!=errno.ENOENT:
|
|
584
|
+
if not getattr(self,'uninstall_error',None):
|
|
585
|
+
self.uninstall_error=True
|
|
586
|
+
Logs.warn('build: some files could not be uninstalled (retry with -vv to list them)')
|
|
587
|
+
if Logs.verbose>1:
|
|
588
|
+
Logs.warn('could not remove %s (error code %r)'%(e.filename,e.errno))
|
|
589
|
+
while tgt:
|
|
590
|
+
tgt=os.path.dirname(tgt)
|
|
591
|
+
try:
|
|
592
|
+
os.rmdir(tgt)
|
|
593
|
+
except OSError:
|
|
594
|
+
break
|
|
595
|
+
def do_link(self,src,tgt):
|
|
596
|
+
try:
|
|
597
|
+
if not self.progress_bar:
|
|
598
|
+
Logs.info('- unlink %s'%tgt)
|
|
599
|
+
os.remove(tgt)
|
|
600
|
+
except OSError:
|
|
601
|
+
pass
|
|
602
|
+
while tgt:
|
|
603
|
+
tgt=os.path.dirname(tgt)
|
|
604
|
+
try:
|
|
605
|
+
os.rmdir(tgt)
|
|
606
|
+
except OSError:
|
|
607
|
+
break
|
|
608
|
+
def execute(self):
|
|
609
|
+
try:
|
|
610
|
+
def runnable_status(self):
|
|
611
|
+
return Task.SKIP_ME
|
|
612
|
+
setattr(Task.Task,'runnable_status_back',Task.Task.runnable_status)
|
|
613
|
+
setattr(Task.Task,'runnable_status',runnable_status)
|
|
614
|
+
super(UninstallContext,self).execute()
|
|
615
|
+
finally:
|
|
616
|
+
setattr(Task.Task,'runnable_status',Task.Task.runnable_status_back)
|
|
617
|
+
class CleanContext(BuildContext):
|
|
618
|
+
'''cleans the project'''
|
|
619
|
+
cmd='clean'
|
|
620
|
+
def execute(self):
|
|
621
|
+
self.restore()
|
|
622
|
+
if not self.all_envs:
|
|
623
|
+
self.load_envs()
|
|
624
|
+
self.recurse([self.run_dir])
|
|
625
|
+
try:
|
|
626
|
+
self.clean()
|
|
627
|
+
finally:
|
|
628
|
+
self.store()
|
|
629
|
+
def clean(self):
|
|
630
|
+
Logs.debug('build: clean called')
|
|
631
|
+
if self.bldnode!=self.srcnode:
|
|
632
|
+
lst=[self.root.find_or_declare(f)for f in self.env[CFG_FILES]]
|
|
633
|
+
for n in self.bldnode.ant_glob('**/*',excl='lock* *conf_check_*/** config.log c4che/*'):
|
|
634
|
+
if n in lst:
|
|
635
|
+
continue
|
|
636
|
+
n.delete()
|
|
637
|
+
self.root.children={}
|
|
638
|
+
for v in'node_deps task_sigs raw_deps'.split():
|
|
639
|
+
setattr(self,v,{})
|
|
640
|
+
class ListContext(BuildContext):
|
|
641
|
+
'''lists the targets to execute'''
|
|
642
|
+
cmd='list'
|
|
643
|
+
def execute(self):
|
|
644
|
+
self.restore()
|
|
645
|
+
if not self.all_envs:
|
|
646
|
+
self.load_envs()
|
|
647
|
+
self.recurse([self.run_dir])
|
|
648
|
+
self.pre_build()
|
|
649
|
+
self.timer=Utils.Timer()
|
|
650
|
+
for g in self.groups:
|
|
651
|
+
for tg in g:
|
|
652
|
+
try:
|
|
653
|
+
f=tg.post
|
|
654
|
+
except AttributeError:
|
|
655
|
+
pass
|
|
656
|
+
else:
|
|
657
|
+
f()
|
|
658
|
+
try:
|
|
659
|
+
self.get_tgen_by_name('')
|
|
660
|
+
except:
|
|
661
|
+
pass
|
|
662
|
+
lst=list(self.task_gen_cache_names.keys())
|
|
663
|
+
lst.sort()
|
|
664
|
+
for k in lst:
|
|
665
|
+
Logs.pprint('GREEN',k)
|
|
666
|
+
class StepContext(BuildContext):
|
|
667
|
+
'''executes tasks in a step-by-step fashion, for debugging'''
|
|
668
|
+
cmd='step'
|
|
669
|
+
def __init__(self,**kw):
|
|
670
|
+
super(StepContext,self).__init__(**kw)
|
|
671
|
+
self.files=Options.options.files
|
|
672
|
+
def compile(self):
|
|
673
|
+
if not self.files:
|
|
674
|
+
Logs.warn('Add a pattern for the debug build, for example "waf step --files=main.c,app"')
|
|
675
|
+
BuildContext.compile(self)
|
|
676
|
+
return
|
|
677
|
+
for g in self.groups:
|
|
678
|
+
for tg in g:
|
|
679
|
+
try:
|
|
680
|
+
f=tg.post
|
|
681
|
+
except AttributeError:
|
|
682
|
+
pass
|
|
683
|
+
else:
|
|
684
|
+
f()
|
|
685
|
+
for pat in self.files.split(','):
|
|
686
|
+
matcher=self.get_matcher(pat)
|
|
687
|
+
for tg in g:
|
|
688
|
+
if isinstance(tg,Task.TaskBase):
|
|
689
|
+
lst=[tg]
|
|
690
|
+
else:
|
|
691
|
+
lst=tg.tasks
|
|
692
|
+
for tsk in lst:
|
|
693
|
+
do_exec=False
|
|
694
|
+
for node in getattr(tsk,'inputs',[]):
|
|
695
|
+
if matcher(node,output=False):
|
|
696
|
+
do_exec=True
|
|
697
|
+
break
|
|
698
|
+
for node in getattr(tsk,'outputs',[]):
|
|
699
|
+
if matcher(node,output=True):
|
|
700
|
+
do_exec=True
|
|
701
|
+
break
|
|
702
|
+
if do_exec:
|
|
703
|
+
ret=tsk.run()
|
|
704
|
+
Logs.info('%s -> exit %r'%(str(tsk),ret))
|
|
705
|
+
def get_matcher(self,pat):
|
|
706
|
+
inn=True
|
|
707
|
+
out=True
|
|
708
|
+
if pat.startswith('in:'):
|
|
709
|
+
out=False
|
|
710
|
+
pat=pat.replace('in:','')
|
|
711
|
+
elif pat.startswith('out:'):
|
|
712
|
+
inn=False
|
|
713
|
+
pat=pat.replace('out:','')
|
|
714
|
+
anode=self.root.find_node(pat)
|
|
715
|
+
pattern=None
|
|
716
|
+
if not anode:
|
|
717
|
+
if not pat.startswith('^'):
|
|
718
|
+
pat='^.+?%s'%pat
|
|
719
|
+
if not pat.endswith('$'):
|
|
720
|
+
pat='%s$'%pat
|
|
721
|
+
pattern=re.compile(pat)
|
|
722
|
+
def match(node,output):
|
|
723
|
+
if output==True and not out:
|
|
724
|
+
return False
|
|
725
|
+
if output==False and not inn:
|
|
726
|
+
return False
|
|
727
|
+
if anode:
|
|
728
|
+
return anode==node
|
|
729
|
+
else:
|
|
730
|
+
return pattern.match(node.abspath())
|
|
731
|
+
return match
|
|
732
|
+
BuildContext.store=Utils.nogc(BuildContext.store)
|
|
733
|
+
BuildContext.restore=Utils.nogc(BuildContext.restore)
|