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
|
Binary file
|
|
@@ -0,0 +1,130 @@
|
|
|
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,tempfile,optparse,sys,re
|
|
6
|
+
from waflib import Logs,Utils,Context
|
|
7
|
+
cmds='distclean configure build install clean uninstall check dist distcheck'.split()
|
|
8
|
+
options={}
|
|
9
|
+
commands=[]
|
|
10
|
+
lockfile=os.environ.get('WAFLOCK','.lock-waf_%s_build'%sys.platform)
|
|
11
|
+
try:cache_global=os.path.abspath(os.environ['WAFCACHE'])
|
|
12
|
+
except KeyError:cache_global=''
|
|
13
|
+
platform=Utils.unversioned_sys_platform()
|
|
14
|
+
class opt_parser(optparse.OptionParser):
|
|
15
|
+
def __init__(self,ctx):
|
|
16
|
+
optparse.OptionParser.__init__(self,conflict_handler="resolve",version='waf %s (%s)'%(Context.WAFVERSION,Context.WAFREVISION))
|
|
17
|
+
self.formatter.width=Logs.get_term_cols()
|
|
18
|
+
p=self.add_option
|
|
19
|
+
self.ctx=ctx
|
|
20
|
+
jobs=ctx.jobs()
|
|
21
|
+
p('-j','--jobs',dest='jobs',default=jobs,type='int',help='amount of parallel jobs (%r)'%jobs)
|
|
22
|
+
p('-k','--keep',dest='keep',default=0,action='count',help='keep running happily even if errors are found')
|
|
23
|
+
p('-v','--verbose',dest='verbose',default=0,action='count',help='verbosity level -v -vv or -vvv [default: 0]')
|
|
24
|
+
p('--nocache',dest='nocache',default=False,action='store_true',help='ignore the WAFCACHE (if set)')
|
|
25
|
+
p('--zones',dest='zones',default='',action='store',help='debugging zones (task_gen, deps, tasks, etc)')
|
|
26
|
+
gr=optparse.OptionGroup(self,'configure options')
|
|
27
|
+
self.add_option_group(gr)
|
|
28
|
+
gr.add_option('-o','--out',action='store',default='',help='build dir for the project',dest='out')
|
|
29
|
+
gr.add_option('-t','--top',action='store',default='',help='src dir for the project',dest='top')
|
|
30
|
+
default_prefix=os.environ.get('PREFIX')
|
|
31
|
+
if not default_prefix:
|
|
32
|
+
if platform=='win32':
|
|
33
|
+
d=tempfile.gettempdir()
|
|
34
|
+
default_prefix=d[0].upper()+d[1:]
|
|
35
|
+
else:
|
|
36
|
+
default_prefix='/usr/local/'
|
|
37
|
+
gr.add_option('--prefix',dest='prefix',default=default_prefix,help='installation prefix [default: %r]'%default_prefix)
|
|
38
|
+
gr.add_option('--download',dest='download',default=False,action='store_true',help='try to download the tools if missing')
|
|
39
|
+
gr=optparse.OptionGroup(self,'build and install options')
|
|
40
|
+
self.add_option_group(gr)
|
|
41
|
+
gr.add_option('-p','--progress',dest='progress_bar',default=0,action='count',help='-p: progress bar; -pp: ide output')
|
|
42
|
+
gr.add_option('--targets',dest='targets',default='',action='store',help='task generators, e.g. "target1,target2"')
|
|
43
|
+
gr=optparse.OptionGroup(self,'step options')
|
|
44
|
+
self.add_option_group(gr)
|
|
45
|
+
gr.add_option('--files',dest='files',default='',action='store',help='files to process, by regexp, e.g. "*/main.c,*/test/main.o"')
|
|
46
|
+
default_destdir=os.environ.get('DESTDIR','')
|
|
47
|
+
gr=optparse.OptionGroup(self,'install/uninstall options')
|
|
48
|
+
self.add_option_group(gr)
|
|
49
|
+
gr.add_option('--destdir',help='installation root [default: %r]'%default_destdir,default=default_destdir,dest='destdir')
|
|
50
|
+
gr.add_option('-f','--force',dest='force',default=False,action='store_true',help='force file installation')
|
|
51
|
+
def get_usage(self):
|
|
52
|
+
cmds_str={}
|
|
53
|
+
for cls in Context.classes:
|
|
54
|
+
if not cls.cmd or cls.cmd=='options':
|
|
55
|
+
continue
|
|
56
|
+
s=cls.__doc__ or''
|
|
57
|
+
cmds_str[cls.cmd]=s
|
|
58
|
+
if Context.g_module:
|
|
59
|
+
for(k,v)in Context.g_module.__dict__.items():
|
|
60
|
+
if k in['options','init','shutdown']:
|
|
61
|
+
continue
|
|
62
|
+
if type(v)is type(Context.create_context):
|
|
63
|
+
if v.__doc__ and not k.startswith('_'):
|
|
64
|
+
cmds_str[k]=v.__doc__
|
|
65
|
+
just=0
|
|
66
|
+
for k in cmds_str:
|
|
67
|
+
just=max(just,len(k))
|
|
68
|
+
lst=[' %s: %s'%(k.ljust(just),v)for(k,v)in cmds_str.items()]
|
|
69
|
+
lst.sort()
|
|
70
|
+
ret='\n'.join(lst)
|
|
71
|
+
return'''waf [commands] [options]
|
|
72
|
+
|
|
73
|
+
Main commands (example: ./waf build -j4)
|
|
74
|
+
%s
|
|
75
|
+
'''%ret
|
|
76
|
+
class OptionsContext(Context.Context):
|
|
77
|
+
cmd='options'
|
|
78
|
+
fun='options'
|
|
79
|
+
def __init__(self,**kw):
|
|
80
|
+
super(OptionsContext,self).__init__(**kw)
|
|
81
|
+
self.parser=opt_parser(self)
|
|
82
|
+
self.option_groups={}
|
|
83
|
+
def jobs(self):
|
|
84
|
+
count=int(os.environ.get('JOBS',0))
|
|
85
|
+
if count<1:
|
|
86
|
+
if'NUMBER_OF_PROCESSORS'in os.environ:
|
|
87
|
+
count=int(os.environ.get('NUMBER_OF_PROCESSORS',1))
|
|
88
|
+
else:
|
|
89
|
+
if hasattr(os,'sysconf_names'):
|
|
90
|
+
if'SC_NPROCESSORS_ONLN'in os.sysconf_names:
|
|
91
|
+
count=int(os.sysconf('SC_NPROCESSORS_ONLN'))
|
|
92
|
+
elif'SC_NPROCESSORS_CONF'in os.sysconf_names:
|
|
93
|
+
count=int(os.sysconf('SC_NPROCESSORS_CONF'))
|
|
94
|
+
if not count and os.name not in('nt','java'):
|
|
95
|
+
tmp=self.cmd_and_log(['sysctl','-n','hw.ncpu'])
|
|
96
|
+
if re.match('^[0-9]+$',tmp):
|
|
97
|
+
count=int(tmp)
|
|
98
|
+
if count<1:
|
|
99
|
+
count=1
|
|
100
|
+
elif count>1024:
|
|
101
|
+
count=1024
|
|
102
|
+
return count
|
|
103
|
+
def add_option(self,*k,**kw):
|
|
104
|
+
self.parser.add_option(*k,**kw)
|
|
105
|
+
def add_option_group(self,*k,**kw):
|
|
106
|
+
try:
|
|
107
|
+
gr=self.option_groups[k[0]]
|
|
108
|
+
except:
|
|
109
|
+
gr=self.parser.add_option_group(*k,**kw)
|
|
110
|
+
self.option_groups[k[0]]=gr
|
|
111
|
+
return gr
|
|
112
|
+
def get_option_group(self,opt_str):
|
|
113
|
+
try:
|
|
114
|
+
return self.option_groups[opt_str]
|
|
115
|
+
except KeyError:
|
|
116
|
+
for group in self.parser.option_groups:
|
|
117
|
+
if group.title==opt_str:
|
|
118
|
+
return group
|
|
119
|
+
return None
|
|
120
|
+
def parse_args(self,_args=None):
|
|
121
|
+
global options,commands
|
|
122
|
+
(options,leftover_args)=self.parser.parse_args(args=_args)
|
|
123
|
+
commands=leftover_args
|
|
124
|
+
if options.destdir:
|
|
125
|
+
options.destdir=os.path.abspath(os.path.expanduser(options.destdir))
|
|
126
|
+
if options.verbose>=1:
|
|
127
|
+
self.load('errcheck')
|
|
128
|
+
def execute(self):
|
|
129
|
+
super(OptionsContext,self).execute()
|
|
130
|
+
self.parse_args()
|
|
Binary file
|
|
@@ -0,0 +1,191 @@
|
|
|
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 random,atexit
|
|
6
|
+
try:
|
|
7
|
+
from queue import Queue
|
|
8
|
+
except:
|
|
9
|
+
from Queue import Queue
|
|
10
|
+
from waflib import Utils,Task,Errors
|
|
11
|
+
GAP=10
|
|
12
|
+
class TaskConsumer(Utils.threading.Thread):
|
|
13
|
+
def __init__(self):
|
|
14
|
+
Utils.threading.Thread.__init__(self)
|
|
15
|
+
self.ready=Queue()
|
|
16
|
+
self.setDaemon(1)
|
|
17
|
+
self.start()
|
|
18
|
+
def run(self):
|
|
19
|
+
try:
|
|
20
|
+
self.loop()
|
|
21
|
+
except:
|
|
22
|
+
pass
|
|
23
|
+
def loop(self):
|
|
24
|
+
while 1:
|
|
25
|
+
tsk=self.ready.get()
|
|
26
|
+
if not isinstance(tsk,Task.TaskBase):
|
|
27
|
+
tsk(self)
|
|
28
|
+
else:
|
|
29
|
+
tsk.process()
|
|
30
|
+
pool=Queue()
|
|
31
|
+
def get_pool():
|
|
32
|
+
try:
|
|
33
|
+
return pool.get(False)
|
|
34
|
+
except:
|
|
35
|
+
return TaskConsumer()
|
|
36
|
+
def put_pool(x):
|
|
37
|
+
pool.put(x)
|
|
38
|
+
def _free_resources():
|
|
39
|
+
global pool
|
|
40
|
+
lst=[]
|
|
41
|
+
while pool.qsize():
|
|
42
|
+
lst.append(pool.get())
|
|
43
|
+
for x in lst:
|
|
44
|
+
x.ready.put(None)
|
|
45
|
+
for x in lst:
|
|
46
|
+
x.join()
|
|
47
|
+
pool=None
|
|
48
|
+
atexit.register(_free_resources)
|
|
49
|
+
class Parallel(object):
|
|
50
|
+
def __init__(self,bld,j=2):
|
|
51
|
+
self.numjobs=j
|
|
52
|
+
self.bld=bld
|
|
53
|
+
self.outstanding=[]
|
|
54
|
+
self.frozen=[]
|
|
55
|
+
self.out=Queue(0)
|
|
56
|
+
self.count=0
|
|
57
|
+
self.processed=1
|
|
58
|
+
self.stop=False
|
|
59
|
+
self.error=[]
|
|
60
|
+
self.biter=None
|
|
61
|
+
self.dirty=False
|
|
62
|
+
def get_next_task(self):
|
|
63
|
+
if not self.outstanding:
|
|
64
|
+
return None
|
|
65
|
+
return self.outstanding.pop(0)
|
|
66
|
+
def postpone(self,tsk):
|
|
67
|
+
if random.randint(0,1):
|
|
68
|
+
self.frozen.insert(0,tsk)
|
|
69
|
+
else:
|
|
70
|
+
self.frozen.append(tsk)
|
|
71
|
+
def refill_task_list(self):
|
|
72
|
+
while self.count>self.numjobs*GAP:
|
|
73
|
+
self.get_out()
|
|
74
|
+
while not self.outstanding:
|
|
75
|
+
if self.count:
|
|
76
|
+
self.get_out()
|
|
77
|
+
elif self.frozen:
|
|
78
|
+
try:
|
|
79
|
+
cond=self.deadlock==self.processed
|
|
80
|
+
except:
|
|
81
|
+
pass
|
|
82
|
+
else:
|
|
83
|
+
if cond:
|
|
84
|
+
msg='check the build order for the tasks'
|
|
85
|
+
for tsk in self.frozen:
|
|
86
|
+
if not tsk.run_after:
|
|
87
|
+
msg='check the methods runnable_status'
|
|
88
|
+
break
|
|
89
|
+
lst=[]
|
|
90
|
+
for tsk in self.frozen:
|
|
91
|
+
lst.append('%s\t-> %r'%(repr(tsk),[id(x)for x in tsk.run_after]))
|
|
92
|
+
raise Errors.WafError('Deadlock detected: %s%s'%(msg,''.join(lst)))
|
|
93
|
+
self.deadlock=self.processed
|
|
94
|
+
if self.frozen:
|
|
95
|
+
self.outstanding+=self.frozen
|
|
96
|
+
self.frozen=[]
|
|
97
|
+
elif not self.count:
|
|
98
|
+
self.outstanding.extend(self.biter.next())
|
|
99
|
+
self.total=self.bld.total()
|
|
100
|
+
break
|
|
101
|
+
def add_more_tasks(self,tsk):
|
|
102
|
+
if getattr(tsk,'more_tasks',None):
|
|
103
|
+
self.outstanding+=tsk.more_tasks
|
|
104
|
+
self.total+=len(tsk.more_tasks)
|
|
105
|
+
def get_out(self):
|
|
106
|
+
tsk=self.out.get()
|
|
107
|
+
if not self.stop:
|
|
108
|
+
self.add_more_tasks(tsk)
|
|
109
|
+
self.count-=1
|
|
110
|
+
self.dirty=True
|
|
111
|
+
def error_handler(self,tsk):
|
|
112
|
+
if not self.bld.keep:
|
|
113
|
+
self.stop=True
|
|
114
|
+
self.error.append(tsk)
|
|
115
|
+
def add_task(self,tsk):
|
|
116
|
+
try:
|
|
117
|
+
self.pool
|
|
118
|
+
except AttributeError:
|
|
119
|
+
self.init_task_pool()
|
|
120
|
+
self.ready.put(tsk)
|
|
121
|
+
def init_task_pool(self):
|
|
122
|
+
pool=self.pool=[get_pool()for i in range(self.numjobs)]
|
|
123
|
+
self.ready=Queue(0)
|
|
124
|
+
def setq(consumer):
|
|
125
|
+
consumer.ready=self.ready
|
|
126
|
+
for x in pool:
|
|
127
|
+
x.ready.put(setq)
|
|
128
|
+
return pool
|
|
129
|
+
def free_task_pool(self):
|
|
130
|
+
def setq(consumer):
|
|
131
|
+
consumer.ready=Queue(0)
|
|
132
|
+
self.out.put(self)
|
|
133
|
+
try:
|
|
134
|
+
pool=self.pool
|
|
135
|
+
except:
|
|
136
|
+
pass
|
|
137
|
+
else:
|
|
138
|
+
for x in pool:
|
|
139
|
+
self.ready.put(setq)
|
|
140
|
+
for x in pool:
|
|
141
|
+
self.get_out()
|
|
142
|
+
for x in pool:
|
|
143
|
+
put_pool(x)
|
|
144
|
+
self.pool=[]
|
|
145
|
+
def start(self):
|
|
146
|
+
self.total=self.bld.total()
|
|
147
|
+
while not self.stop:
|
|
148
|
+
self.refill_task_list()
|
|
149
|
+
tsk=self.get_next_task()
|
|
150
|
+
if not tsk:
|
|
151
|
+
if self.count:
|
|
152
|
+
continue
|
|
153
|
+
else:
|
|
154
|
+
break
|
|
155
|
+
if tsk.hasrun:
|
|
156
|
+
self.processed+=1
|
|
157
|
+
continue
|
|
158
|
+
if self.stop:
|
|
159
|
+
break
|
|
160
|
+
try:
|
|
161
|
+
st=tsk.runnable_status()
|
|
162
|
+
except Exception:
|
|
163
|
+
self.processed+=1
|
|
164
|
+
if not self.stop and self.bld.keep:
|
|
165
|
+
tsk.hasrun=Task.SKIPPED
|
|
166
|
+
if self.bld.keep==1:
|
|
167
|
+
self.stop=True
|
|
168
|
+
continue
|
|
169
|
+
tsk.err_msg=Utils.ex_stack()
|
|
170
|
+
tsk.hasrun=Task.EXCEPTION
|
|
171
|
+
self.error_handler(tsk)
|
|
172
|
+
continue
|
|
173
|
+
if st==Task.ASK_LATER:
|
|
174
|
+
self.postpone(tsk)
|
|
175
|
+
elif st==Task.SKIP_ME:
|
|
176
|
+
self.processed+=1
|
|
177
|
+
tsk.hasrun=Task.SKIPPED
|
|
178
|
+
self.add_more_tasks(tsk)
|
|
179
|
+
else:
|
|
180
|
+
tsk.position=(self.processed,self.total)
|
|
181
|
+
self.count+=1
|
|
182
|
+
tsk.master=self
|
|
183
|
+
self.processed+=1
|
|
184
|
+
if self.numjobs==1:
|
|
185
|
+
tsk.process()
|
|
186
|
+
else:
|
|
187
|
+
self.add_task(tsk)
|
|
188
|
+
while self.error and self.count:
|
|
189
|
+
self.get_out()
|
|
190
|
+
assert(self.count==0 or self.stop)
|
|
191
|
+
self.free_task_pool()
|
|
Binary file
|
|
@@ -0,0 +1,358 @@
|
|
|
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,shutil,traceback,errno,sys,stat
|
|
6
|
+
from waflib import Utils,Configure,Logs,Options,ConfigSet,Context,Errors,Build,Node
|
|
7
|
+
build_dir_override=None
|
|
8
|
+
no_climb_commands=['configure']
|
|
9
|
+
default_cmd="build"
|
|
10
|
+
def waf_entry_point(current_directory,version,wafdir):
|
|
11
|
+
Logs.init_log()
|
|
12
|
+
if Context.WAFVERSION!=version:
|
|
13
|
+
Logs.error('Waf script %r and library %r do not match (directory %r)'%(version,Context.WAFVERSION,wafdir))
|
|
14
|
+
sys.exit(1)
|
|
15
|
+
if'--version'in sys.argv:
|
|
16
|
+
ctx=Context.create_context('options')
|
|
17
|
+
ctx.curdir=current_directory
|
|
18
|
+
ctx.parse_args()
|
|
19
|
+
sys.exit(0)
|
|
20
|
+
Context.waf_dir=wafdir
|
|
21
|
+
Context.launch_dir=current_directory
|
|
22
|
+
no_climb=os.environ.get('NOCLIMB',None)
|
|
23
|
+
if not no_climb:
|
|
24
|
+
for k in no_climb_commands:
|
|
25
|
+
if k in sys.argv:
|
|
26
|
+
no_climb=True
|
|
27
|
+
break
|
|
28
|
+
cur=current_directory
|
|
29
|
+
while cur:
|
|
30
|
+
lst=os.listdir(cur)
|
|
31
|
+
if Options.lockfile in lst:
|
|
32
|
+
env=ConfigSet.ConfigSet()
|
|
33
|
+
try:
|
|
34
|
+
env.load(os.path.join(cur,Options.lockfile))
|
|
35
|
+
ino=os.stat(cur)[stat.ST_INO]
|
|
36
|
+
except Exception:
|
|
37
|
+
pass
|
|
38
|
+
else:
|
|
39
|
+
for x in[env.run_dir,env.top_dir,env.out_dir]:
|
|
40
|
+
if Utils.is_win32:
|
|
41
|
+
if cur==x:
|
|
42
|
+
load=True
|
|
43
|
+
break
|
|
44
|
+
else:
|
|
45
|
+
try:
|
|
46
|
+
ino2=os.stat(x)[stat.ST_INO]
|
|
47
|
+
except:
|
|
48
|
+
pass
|
|
49
|
+
else:
|
|
50
|
+
if ino==ino2:
|
|
51
|
+
load=True
|
|
52
|
+
break
|
|
53
|
+
else:
|
|
54
|
+
Logs.warn('invalid lock file in %s'%cur)
|
|
55
|
+
load=False
|
|
56
|
+
if load:
|
|
57
|
+
Context.run_dir=env.run_dir
|
|
58
|
+
Context.top_dir=env.top_dir
|
|
59
|
+
Context.out_dir=env.out_dir
|
|
60
|
+
break
|
|
61
|
+
if not Context.run_dir:
|
|
62
|
+
if Context.WSCRIPT_FILE in lst:
|
|
63
|
+
Context.run_dir=cur
|
|
64
|
+
next=os.path.dirname(cur)
|
|
65
|
+
if next==cur:
|
|
66
|
+
break
|
|
67
|
+
cur=next
|
|
68
|
+
if no_climb:
|
|
69
|
+
break
|
|
70
|
+
if not Context.run_dir:
|
|
71
|
+
if'-h'in sys.argv or'--help'in sys.argv:
|
|
72
|
+
Logs.warn('No wscript file found: the help message may be incomplete')
|
|
73
|
+
ctx=Context.create_context('options')
|
|
74
|
+
ctx.curdir=current_directory
|
|
75
|
+
ctx.parse_args()
|
|
76
|
+
sys.exit(0)
|
|
77
|
+
Logs.error('Waf: Run from a directory containing a file named %r'%Context.WSCRIPT_FILE)
|
|
78
|
+
sys.exit(1)
|
|
79
|
+
try:
|
|
80
|
+
os.chdir(Context.run_dir)
|
|
81
|
+
except OSError:
|
|
82
|
+
Logs.error('Waf: The folder %r is unreadable'%Context.run_dir)
|
|
83
|
+
sys.exit(1)
|
|
84
|
+
try:
|
|
85
|
+
set_main_module(Context.run_dir+os.sep+Context.WSCRIPT_FILE)
|
|
86
|
+
except Errors.WafError ,e:
|
|
87
|
+
Logs.pprint('RED',e.verbose_msg)
|
|
88
|
+
Logs.error(str(e))
|
|
89
|
+
sys.exit(1)
|
|
90
|
+
except Exception ,e:
|
|
91
|
+
Logs.error('Waf: The wscript in %r is unreadable'%Context.run_dir,e)
|
|
92
|
+
traceback.print_exc(file=sys.stdout)
|
|
93
|
+
sys.exit(2)
|
|
94
|
+
try:
|
|
95
|
+
run_commands()
|
|
96
|
+
except Errors.WafError ,e:
|
|
97
|
+
if Logs.verbose>1:
|
|
98
|
+
Logs.pprint('RED',e.verbose_msg)
|
|
99
|
+
Logs.error(e.msg)
|
|
100
|
+
sys.exit(1)
|
|
101
|
+
except Exception ,e:
|
|
102
|
+
traceback.print_exc(file=sys.stdout)
|
|
103
|
+
sys.exit(2)
|
|
104
|
+
except KeyboardInterrupt:
|
|
105
|
+
Logs.pprint('RED','Interrupted')
|
|
106
|
+
sys.exit(68)
|
|
107
|
+
def set_main_module(file_path):
|
|
108
|
+
Context.g_module=Context.load_module(file_path)
|
|
109
|
+
Context.g_module.root_path=file_path
|
|
110
|
+
def set_def(obj):
|
|
111
|
+
name=obj.__name__
|
|
112
|
+
if not name in Context.g_module.__dict__:
|
|
113
|
+
setattr(Context.g_module,name,obj)
|
|
114
|
+
for k in[update,dist,distclean,distcheck,update]:
|
|
115
|
+
set_def(k)
|
|
116
|
+
if not'init'in Context.g_module.__dict__:
|
|
117
|
+
Context.g_module.init=Utils.nada
|
|
118
|
+
if not'shutdown'in Context.g_module.__dict__:
|
|
119
|
+
Context.g_module.shutdown=Utils.nada
|
|
120
|
+
if not'options'in Context.g_module.__dict__:
|
|
121
|
+
Context.g_module.options=Utils.nada
|
|
122
|
+
def parse_options():
|
|
123
|
+
Context.create_context('options').execute()
|
|
124
|
+
if not Options.commands:
|
|
125
|
+
Options.commands=[default_cmd]
|
|
126
|
+
Logs.verbose=Options.options.verbose
|
|
127
|
+
Logs.init_log()
|
|
128
|
+
if Options.options.zones:
|
|
129
|
+
Logs.zones=Options.options.zones.split(',')
|
|
130
|
+
if not Logs.verbose:
|
|
131
|
+
Logs.verbose=1
|
|
132
|
+
elif Logs.verbose>0:
|
|
133
|
+
Logs.zones=['runner']
|
|
134
|
+
if Logs.verbose>2:
|
|
135
|
+
Logs.zones=['*']
|
|
136
|
+
def run_command(cmd_name):
|
|
137
|
+
ctx=Context.create_context(cmd_name)
|
|
138
|
+
ctx.options=Options.options
|
|
139
|
+
ctx.cmd=cmd_name
|
|
140
|
+
ctx.execute()
|
|
141
|
+
return ctx
|
|
142
|
+
def run_commands():
|
|
143
|
+
parse_options()
|
|
144
|
+
run_command('init')
|
|
145
|
+
while Options.commands:
|
|
146
|
+
cmd_name=Options.commands.pop(0)
|
|
147
|
+
timer=Utils.Timer()
|
|
148
|
+
run_command(cmd_name)
|
|
149
|
+
if not Options.options.progress_bar:
|
|
150
|
+
elapsed=' (%s)'%str(timer)
|
|
151
|
+
Logs.info('%r finished successfully%s'%(cmd_name,elapsed))
|
|
152
|
+
run_command('shutdown')
|
|
153
|
+
def _can_distclean(name):
|
|
154
|
+
for k in'.o .moc .exe'.split():
|
|
155
|
+
if name.endswith(k):
|
|
156
|
+
return True
|
|
157
|
+
return False
|
|
158
|
+
def distclean_dir(dirname):
|
|
159
|
+
for(root,dirs,files)in os.walk(dirname):
|
|
160
|
+
for f in files:
|
|
161
|
+
if _can_distclean(f):
|
|
162
|
+
fname=root+os.sep+f
|
|
163
|
+
try:
|
|
164
|
+
os.unlink(fname)
|
|
165
|
+
except:
|
|
166
|
+
Logs.warn('could not remove %r'%fname)
|
|
167
|
+
for x in[Context.DBFILE,'config.log']:
|
|
168
|
+
try:
|
|
169
|
+
os.unlink(x)
|
|
170
|
+
except:
|
|
171
|
+
pass
|
|
172
|
+
try:
|
|
173
|
+
shutil.rmtree('c4che')
|
|
174
|
+
except:
|
|
175
|
+
pass
|
|
176
|
+
def distclean(ctx):
|
|
177
|
+
'''removes the build directory'''
|
|
178
|
+
lst=os.listdir('.')
|
|
179
|
+
for f in lst:
|
|
180
|
+
if f==Options.lockfile:
|
|
181
|
+
try:
|
|
182
|
+
proj=ConfigSet.ConfigSet(f)
|
|
183
|
+
except:
|
|
184
|
+
Logs.warn('could not read %r'%f)
|
|
185
|
+
continue
|
|
186
|
+
if proj['out_dir']!=proj['top_dir']:
|
|
187
|
+
try:
|
|
188
|
+
shutil.rmtree(proj['out_dir'])
|
|
189
|
+
except IOError:
|
|
190
|
+
pass
|
|
191
|
+
except OSError ,e:
|
|
192
|
+
if e.errno!=errno.ENOENT:
|
|
193
|
+
Logs.warn('project %r cannot be removed'%proj[Context.OUT])
|
|
194
|
+
else:
|
|
195
|
+
distclean_dir(proj['out_dir'])
|
|
196
|
+
for k in(proj['out_dir'],proj['top_dir'],proj['run_dir']):
|
|
197
|
+
try:
|
|
198
|
+
os.remove(os.path.join(k,Options.lockfile))
|
|
199
|
+
except OSError ,e:
|
|
200
|
+
if e.errno!=errno.ENOENT:
|
|
201
|
+
Logs.warn('file %r cannot be removed'%f)
|
|
202
|
+
if f.startswith('.waf-')and not Options.commands:
|
|
203
|
+
shutil.rmtree(f,ignore_errors=True)
|
|
204
|
+
class Dist(Context.Context):
|
|
205
|
+
cmd='dist'
|
|
206
|
+
fun='dist'
|
|
207
|
+
algo='tar.bz2'
|
|
208
|
+
ext_algo={}
|
|
209
|
+
def execute(self):
|
|
210
|
+
self.recurse([os.path.dirname(Context.g_module.root_path)])
|
|
211
|
+
self.archive()
|
|
212
|
+
def archive(self):
|
|
213
|
+
import tarfile
|
|
214
|
+
arch_name=self.get_arch_name()
|
|
215
|
+
try:
|
|
216
|
+
self.base_path
|
|
217
|
+
except:
|
|
218
|
+
self.base_path=self.path
|
|
219
|
+
node=self.base_path.make_node(arch_name)
|
|
220
|
+
try:
|
|
221
|
+
node.delete()
|
|
222
|
+
except:
|
|
223
|
+
pass
|
|
224
|
+
files=self.get_files()
|
|
225
|
+
if self.algo.startswith('tar.'):
|
|
226
|
+
tar=tarfile.open(arch_name,'w:'+self.algo.replace('tar.',''))
|
|
227
|
+
for x in files:
|
|
228
|
+
tinfo=tar.gettarinfo(name=x.abspath(),arcname=self.get_tar_prefix()+'/'+x.path_from(self.base_path))
|
|
229
|
+
tinfo.uid=0
|
|
230
|
+
tinfo.gid=0
|
|
231
|
+
tinfo.uname='root'
|
|
232
|
+
tinfo.gname='root'
|
|
233
|
+
fu=None
|
|
234
|
+
try:
|
|
235
|
+
fu=open(x.abspath(),'rb')
|
|
236
|
+
tar.addfile(tinfo,fileobj=fu)
|
|
237
|
+
finally:
|
|
238
|
+
fu.close()
|
|
239
|
+
tar.close()
|
|
240
|
+
elif self.algo=='zip':
|
|
241
|
+
import zipfile
|
|
242
|
+
zip=zipfile.ZipFile(arch_name,'w',compression=zipfile.ZIP_DEFLATED)
|
|
243
|
+
for x in files:
|
|
244
|
+
archive_name=self.get_base_name()+'/'+x.path_from(self.base_path)
|
|
245
|
+
zip.write(x.abspath(),archive_name,zipfile.ZIP_DEFLATED)
|
|
246
|
+
zip.close()
|
|
247
|
+
else:
|
|
248
|
+
self.fatal('Valid algo types are tar.bz2, tar.gz or zip')
|
|
249
|
+
try:
|
|
250
|
+
from hashlib import sha1 as sha
|
|
251
|
+
except ImportError:
|
|
252
|
+
from sha import sha
|
|
253
|
+
try:
|
|
254
|
+
digest=" (sha=%r)"%sha(node.read()).hexdigest()
|
|
255
|
+
except:
|
|
256
|
+
digest=''
|
|
257
|
+
Logs.info('New archive created: %s%s'%(self.arch_name,digest))
|
|
258
|
+
def get_tar_prefix(self):
|
|
259
|
+
try:
|
|
260
|
+
return self.tar_prefix
|
|
261
|
+
except:
|
|
262
|
+
return self.get_base_name()
|
|
263
|
+
def get_arch_name(self):
|
|
264
|
+
try:
|
|
265
|
+
self.arch_name
|
|
266
|
+
except:
|
|
267
|
+
self.arch_name=self.get_base_name()+'.'+self.ext_algo.get(self.algo,self.algo)
|
|
268
|
+
return self.arch_name
|
|
269
|
+
def get_base_name(self):
|
|
270
|
+
try:
|
|
271
|
+
self.base_name
|
|
272
|
+
except:
|
|
273
|
+
appname=getattr(Context.g_module,Context.APPNAME,'noname')
|
|
274
|
+
version=getattr(Context.g_module,Context.VERSION,'1.0')
|
|
275
|
+
self.base_name=appname+'-'+version
|
|
276
|
+
return self.base_name
|
|
277
|
+
def get_excl(self):
|
|
278
|
+
try:
|
|
279
|
+
return self.excl
|
|
280
|
+
except:
|
|
281
|
+
self.excl=Node.exclude_regs+' **/waf-1.6.* **/.waf-1.6* **/*~ **/*.rej **/*.orig **/*.pyc **/*.pyo **/*.bak **/*.swp **/.lock-w*'
|
|
282
|
+
nd=self.root.find_node(Context.out_dir)
|
|
283
|
+
if nd:
|
|
284
|
+
self.excl+=' '+nd.path_from(self.base_path)
|
|
285
|
+
return self.excl
|
|
286
|
+
def get_files(self):
|
|
287
|
+
try:
|
|
288
|
+
files=self.files
|
|
289
|
+
except:
|
|
290
|
+
files=self.base_path.ant_glob('**/*',excl=self.get_excl())
|
|
291
|
+
return files
|
|
292
|
+
def dist(ctx):
|
|
293
|
+
'''makes a tarball for redistributing the sources'''
|
|
294
|
+
pass
|
|
295
|
+
class DistCheck(Dist):
|
|
296
|
+
fun='distcheck'
|
|
297
|
+
cmd='distcheck'
|
|
298
|
+
def execute(self):
|
|
299
|
+
self.recurse([os.path.dirname(Context.g_module.root_path)])
|
|
300
|
+
self.archive()
|
|
301
|
+
self.check()
|
|
302
|
+
def check(self):
|
|
303
|
+
import tempfile,tarfile
|
|
304
|
+
t=None
|
|
305
|
+
try:
|
|
306
|
+
t=tarfile.open(self.get_arch_name())
|
|
307
|
+
for x in t:
|
|
308
|
+
t.extract(x)
|
|
309
|
+
finally:
|
|
310
|
+
if t:
|
|
311
|
+
t.close()
|
|
312
|
+
instdir=tempfile.mkdtemp('.inst',self.get_base_name())
|
|
313
|
+
ret=Utils.subprocess.Popen([sys.argv[0],'configure','install','uninstall','--destdir='+instdir],cwd=self.get_base_name()).wait()
|
|
314
|
+
if ret:
|
|
315
|
+
raise Errors.WafError('distcheck failed with code %i'%ret)
|
|
316
|
+
if os.path.exists(instdir):
|
|
317
|
+
raise Errors.WafError('distcheck succeeded, but files were left in %s'%instdir)
|
|
318
|
+
shutil.rmtree(self.get_base_name())
|
|
319
|
+
def distcheck(ctx):
|
|
320
|
+
'''checks if the project compiles (tarball from 'dist')'''
|
|
321
|
+
pass
|
|
322
|
+
def update(ctx):
|
|
323
|
+
'''updates the plugins from the *waflib/extras* directory'''
|
|
324
|
+
lst=Options.options.files.split(',')
|
|
325
|
+
if not lst:
|
|
326
|
+
lst=[x for x in Utils.listdir(Context.waf_dir+'/waflib/extras')if x.endswith('.py')]
|
|
327
|
+
for x in lst:
|
|
328
|
+
tool=x.replace('.py','')
|
|
329
|
+
try:
|
|
330
|
+
Configure.download_tool(tool,force=True,ctx=ctx)
|
|
331
|
+
except Errors.WafError:
|
|
332
|
+
Logs.error('Could not find the tool %s in the remote repository'%x)
|
|
333
|
+
def autoconfigure(execute_method):
|
|
334
|
+
def execute(self):
|
|
335
|
+
if not Configure.autoconfig:
|
|
336
|
+
return execute_method(self)
|
|
337
|
+
env=ConfigSet.ConfigSet()
|
|
338
|
+
do_config=False
|
|
339
|
+
try:
|
|
340
|
+
env.load(os.path.join(Context.top_dir,Options.lockfile))
|
|
341
|
+
except Exception:
|
|
342
|
+
Logs.warn('Configuring the project')
|
|
343
|
+
do_config=True
|
|
344
|
+
else:
|
|
345
|
+
if env.run_dir!=Context.run_dir:
|
|
346
|
+
do_config=True
|
|
347
|
+
else:
|
|
348
|
+
h=0
|
|
349
|
+
for f in env['files']:
|
|
350
|
+
h=hash((h,Utils.readf(f,'rb')))
|
|
351
|
+
do_config=h!=env.hash
|
|
352
|
+
if do_config:
|
|
353
|
+
Options.commands.insert(0,self.cmd)
|
|
354
|
+
Options.commands.insert(0,'configure')
|
|
355
|
+
return
|
|
356
|
+
return execute_method(self)
|
|
357
|
+
return execute
|
|
358
|
+
Build.BuildContext.execute=autoconfigure(Build.BuildContext.execute)
|