text_ux 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +25 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +51 -0
  7. data/Rakefile +18 -0
  8. data/ext/text_ux/extconf.rb +5 -0
  9. data/ext/text_ux/text_ux.cpp +252 -0
  10. data/lib/text_ux.rb +5 -0
  11. data/lib/text_ux/version.rb +3 -0
  12. data/spec/fixtures/test.ux +0 -0
  13. data/spec/spec_helper.rb +19 -0
  14. data/spec/text_ux_spec.rb +137 -0
  15. data/text_ux.gemspec +26 -0
  16. data/vendor/ux-trie/ux-0.1.9/.lock-waf_darwin_build +8 -0
  17. data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest-all.cc +9118 -0
  18. data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest.h +19537 -0
  19. data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest_main.cc +39 -0
  20. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Build.py +733 -0
  21. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Build.pyc +0 -0
  22. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ConfigSet.py +147 -0
  23. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ConfigSet.pyc +0 -0
  24. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Configure.py +314 -0
  25. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Configure.pyc +0 -0
  26. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Context.py +298 -0
  27. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Context.pyc +0 -0
  28. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Errors.py +37 -0
  29. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Errors.pyc +0 -0
  30. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Logs.py +149 -0
  31. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Logs.pyc +0 -0
  32. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Node.py +500 -0
  33. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Node.pyc +0 -0
  34. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Options.py +130 -0
  35. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Options.pyc +0 -0
  36. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Runner.py +191 -0
  37. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Runner.pyc +0 -0
  38. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Scripting.py +358 -0
  39. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Scripting.pyc +0 -0
  40. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Task.py +669 -0
  41. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Task.pyc +0 -0
  42. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/TaskGen.py +341 -0
  43. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/TaskGen.pyc +0 -0
  44. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/__init__.py +4 -0
  45. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/__init__.pyc +0 -0
  46. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ar.py +12 -0
  47. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ar.pyc +0 -0
  48. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/asm.py +25 -0
  49. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/bison.py +29 -0
  50. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c.py +27 -0
  51. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_aliases.py +56 -0
  52. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_aliases.pyc +0 -0
  53. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_config.py +708 -0
  54. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_config.pyc +0 -0
  55. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_osx.py +121 -0
  56. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_osx.pyc +0 -0
  57. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_preproc.py +606 -0
  58. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_preproc.pyc +0 -0
  59. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_tests.py +110 -0
  60. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_tests.pyc +0 -0
  61. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ccroot.py +372 -0
  62. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ccroot.pyc +0 -0
  63. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_c.py +39 -0
  64. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_cxx.py +39 -0
  65. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_cxx.pyc +0 -0
  66. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_d.py +30 -0
  67. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_fc.py +45 -0
  68. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cs.py +98 -0
  69. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cxx.py +27 -0
  70. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cxx.pyc +0 -0
  71. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d.py +51 -0
  72. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d_config.py +47 -0
  73. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d_scan.py +133 -0
  74. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/dbus.py +30 -0
  75. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/dmd.py +43 -0
  76. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/errcheck.py +153 -0
  77. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc.py +123 -0
  78. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc_config.py +271 -0
  79. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc_scan.py +68 -0
  80. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/flex.py +27 -0
  81. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/g95.py +55 -0
  82. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gas.py +10 -0
  83. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gcc.py +98 -0
  84. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gdc.py +34 -0
  85. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gfortran.py +69 -0
  86. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/glib2.py +174 -0
  87. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gnu_dirs.py +65 -0
  88. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gxx.py +98 -0
  89. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gxx.pyc +0 -0
  90. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/icc.py +31 -0
  91. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/icpc.py +30 -0
  92. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ifort.py +42 -0
  93. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/intltool.py +78 -0
  94. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/irixcc.py +49 -0
  95. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/javaw.py +272 -0
  96. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/kde4.py +49 -0
  97. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/lua.py +19 -0
  98. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/msvc.py +650 -0
  99. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/nasm.py +13 -0
  100. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/perl.py +78 -0
  101. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/python.py +303 -0
  102. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/qt4.py +424 -0
  103. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ruby.py +104 -0
  104. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/suncc.py +54 -0
  105. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/suncxx.py +55 -0
  106. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/tex.py +222 -0
  107. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/vala.py +215 -0
  108. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/waf_unit_test.py +79 -0
  109. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/winres.py +34 -0
  110. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/xlc.py +46 -0
  111. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/xlcxx.py +46 -0
  112. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Utils.py +334 -0
  113. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Utils.pyc +0 -0
  114. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/__init__.py +4 -0
  115. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/__init__.pyc +0 -0
  116. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ansiterm.py +173 -0
  117. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ansiterm.pyc +0 -0
  118. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/__init__.py +4 -0
  119. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/__init__.pyc +0 -0
  120. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/compat15.py +223 -0
  121. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/compat15.pyc +0 -0
  122. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/fixpy2.py +50 -0
  123. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/fixpy2.pyc +0 -0
  124. data/vendor/ux-trie/ux-0.1.9/src/bitVec.cpp +119 -0
  125. data/vendor/ux-trie/ux-0.1.9/src/bitVec.hpp +64 -0
  126. data/vendor/ux-trie/ux-0.1.9/src/bitVecTest.cpp +143 -0
  127. data/vendor/ux-trie/ux-0.1.9/src/cmdline.h +809 -0
  128. data/vendor/ux-trie/ux-0.1.9/src/rsDic.cpp +121 -0
  129. data/vendor/ux-trie/ux-0.1.9/src/rsDic.hpp +57 -0
  130. data/vendor/ux-trie/ux-0.1.9/src/ux.hpp +26 -0
  131. data/vendor/ux-trie/ux-0.1.9/src/uxMain.cpp +206 -0
  132. data/vendor/ux-trie/ux-0.1.9/src/uxMap.cpp +0 -0
  133. data/vendor/ux-trie/ux-0.1.9/src/uxMap.hpp +248 -0
  134. data/vendor/ux-trie/ux-0.1.9/src/uxMapTest.cpp +139 -0
  135. data/vendor/ux-trie/ux-0.1.9/src/uxTest.cpp +229 -0
  136. data/vendor/ux-trie/ux-0.1.9/src/uxTrie.cpp +529 -0
  137. data/vendor/ux-trie/ux-0.1.9/src/uxTrie.hpp +220 -0
  138. data/vendor/ux-trie/ux-0.1.9/src/uxUtil.cpp +92 -0
  139. data/vendor/ux-trie/ux-0.1.9/src/uxUtil.hpp +35 -0
  140. data/vendor/ux-trie/ux-0.1.9/src/wscript +43 -0
  141. data/vendor/ux-trie/ux-0.1.9/unittest_gtest.py +0 -0
  142. data/vendor/ux-trie/ux-0.1.9/unittest_gtest.pyc +0 -0
  143. data/vendor/ux-trie/ux-0.1.9/unittestt.py +166 -0
  144. data/vendor/ux-trie/ux-0.1.9/ux.pc.in +10 -0
  145. data/vendor/ux-trie/ux-0.1.9/waf +0 -0
  146. data/vendor/ux-trie/ux-0.1.9/wscript +32 -0
  147. metadata +249 -0
@@ -0,0 +1,147 @@
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 copy,re
8
+ from waflib import Logs,Utils
9
+ re_imp=re.compile('^(#)*?([^#=]*?)\ =\ (.*?)$',re.M)
10
+ class ConfigSet(object):
11
+ __slots__=('table','parent')
12
+ def __init__(self,filename=None):
13
+ self.table={}
14
+ if filename:
15
+ self.load(filename)
16
+ def __contains__(self,key):
17
+ if key in self.table:return True
18
+ try:return self.parent.__contains__(key)
19
+ except AttributeError:return False
20
+ def keys(self):
21
+ keys=set()
22
+ cur=self
23
+ while cur:
24
+ keys.update(cur.table.keys())
25
+ cur=getattr(cur,'parent',None)
26
+ keys=list(keys)
27
+ keys.sort()
28
+ return keys
29
+ def __str__(self):
30
+ return"\n".join(["%r %r"%(x,self.__getitem__(x))for x in self.keys()])
31
+ def __getitem__(self,key):
32
+ try:
33
+ while 1:
34
+ x=self.table.get(key,None)
35
+ if not x is None:
36
+ return x
37
+ self=self.parent
38
+ except AttributeError:
39
+ return[]
40
+ def __setitem__(self,key,value):
41
+ self.table[key]=value
42
+ def __delitem__(self,key):
43
+ self[key]=[]
44
+ def __getattr__(self,name):
45
+ if name in self.__slots__:
46
+ return object.__getattr__(self,name)
47
+ else:
48
+ return self[name]
49
+ def __setattr__(self,name,value):
50
+ if name in self.__slots__:
51
+ object.__setattr__(self,name,value)
52
+ else:
53
+ self[name]=value
54
+ def __delattr__(self,name):
55
+ if name in self.__slots__:
56
+ object.__delattr__(self,name)
57
+ else:
58
+ del self[name]
59
+ def derive(self):
60
+ newenv=ConfigSet()
61
+ newenv.parent=self
62
+ return newenv
63
+ def detach(self):
64
+ tbl=self.get_merged_dict()
65
+ try:
66
+ delattr(self,'parent')
67
+ except AttributeError:
68
+ pass
69
+ else:
70
+ keys=tbl.keys()
71
+ for x in keys:
72
+ tbl[x]=copy.deepcopy(tbl[x])
73
+ self.table=tbl
74
+ def get_flat(self,key):
75
+ s=self[key]
76
+ if isinstance(s,str):return s
77
+ return' '.join(s)
78
+ def _get_list_value_for_modification(self,key):
79
+ try:
80
+ value=self.table[key]
81
+ except KeyError:
82
+ try:value=self.parent[key]
83
+ except AttributeError:value=[]
84
+ if isinstance(value,list):
85
+ value=value[:]
86
+ else:
87
+ value=[value]
88
+ else:
89
+ if not isinstance(value,list):
90
+ value=[value]
91
+ self.table[key]=value
92
+ return value
93
+ def append_value(self,var,val):
94
+ current_value=self._get_list_value_for_modification(var)
95
+ if isinstance(val,str):
96
+ val=[val]
97
+ current_value.extend(val)
98
+ def prepend_value(self,var,val):
99
+ if isinstance(val,str):
100
+ val=[val]
101
+ self.table[var]=val+self._get_list_value_for_modification(var)
102
+ def append_unique(self,var,val):
103
+ if isinstance(val,str):
104
+ val=[val]
105
+ current_value=self._get_list_value_for_modification(var)
106
+ for x in val:
107
+ if x not in current_value:
108
+ current_value.append(x)
109
+ def get_merged_dict(self):
110
+ table_list=[]
111
+ env=self
112
+ while 1:
113
+ table_list.insert(0,env.table)
114
+ try:env=env.parent
115
+ except AttributeError:break
116
+ merged_table={}
117
+ for table in table_list:
118
+ merged_table.update(table)
119
+ return merged_table
120
+ def store(self,filename):
121
+ f=None
122
+ try:
123
+ f=open(filename,'w')
124
+ merged_table=self.get_merged_dict()
125
+ keys=list(merged_table.keys())
126
+ keys.sort()
127
+ for k in keys:
128
+ if k!='undo_stack':
129
+ f.write('%s = %r\n'%(k,merged_table[k]))
130
+ finally:
131
+ if f:
132
+ f.close()
133
+ def load(self,filename):
134
+ tbl=self.table
135
+ code=Utils.readf(filename)
136
+ for m in re_imp.finditer(code):
137
+ g=m.group
138
+ tbl[g(2)]=eval(g(3))
139
+ Logs.debug('env: %s'%str(self.table))
140
+ def update(self,d):
141
+ for k,v in d.items():
142
+ self[k]=v
143
+ def stash(self):
144
+ self.undo_stack=self.undo_stack+[self.table]
145
+ self.table=self.table.copy()
146
+ def revert(self):
147
+ self.table=self.undo_stack.pop(-1)
@@ -0,0 +1,314 @@
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,shlex,sys,time
6
+ from waflib import ConfigSet,Utils,Options,Logs,Context,Build,Errors
7
+ try:
8
+ from urllib import request
9
+ except:
10
+ from urllib import urlopen
11
+ else:
12
+ urlopen=request.urlopen
13
+ BREAK='break'
14
+ CONTINUE='continue'
15
+ WAF_CONFIG_LOG='config.log'
16
+ autoconfig=False
17
+ conf_template='''# project %(app)s configured on %(now)s by
18
+ # waf %(wafver)s (abi %(abi)s, python %(pyver)x on %(systype)s)
19
+ # using %(args)s
20
+ #'''
21
+ def download_check(node):
22
+ pass
23
+ def download_tool(tool,force=False,ctx=None):
24
+ for x in Utils.to_list(Context.remote_repo):
25
+ for sub in Utils.to_list(Context.remote_locs):
26
+ url='/'.join((x,sub,tool+'.py'))
27
+ try:
28
+ web=urlopen(url)
29
+ try:
30
+ if web.getcode()!=200:
31
+ continue
32
+ except AttributeError:
33
+ pass
34
+ except Exception:
35
+ continue
36
+ else:
37
+ tmp=ctx.root.make_node(os.sep.join((Context.waf_dir,'waflib','extras',tool+'.py')))
38
+ tmp.write(web.read())
39
+ Logs.warn('Downloaded %s from %s'%(tool,url))
40
+ download_check(tmp)
41
+ try:
42
+ module=Context.load_tool(tool)
43
+ except:
44
+ Logs.warn('The tool %s from %s is unusable'%(tool,url))
45
+ try:
46
+ tmp.delete()
47
+ except:
48
+ pass
49
+ continue
50
+ return module
51
+ raise Errors.WafError('Could not load the Waf tool')
52
+ class ConfigurationContext(Context.Context):
53
+ '''configures the project'''
54
+ cmd='configure'
55
+ error_handlers=[]
56
+ def __init__(self,**kw):
57
+ super(ConfigurationContext,self).__init__(**kw)
58
+ self.environ=dict(os.environ)
59
+ self.all_envs={}
60
+ self.top_dir=None
61
+ self.out_dir=None
62
+ self.tools=[]
63
+ self.hash=0
64
+ self.files=[]
65
+ self.tool_cache=[]
66
+ self.setenv('')
67
+ def setenv(self,name,env=None):
68
+ if not env:
69
+ env=ConfigSet.ConfigSet()
70
+ self.prepare_env(env)
71
+ else:
72
+ env=env.derive()
73
+ self.all_envs[name]=env
74
+ self.variant=name
75
+ def get_env(self):
76
+ return self.all_envs[self.variant]
77
+ def set_env(self,val):
78
+ self.all_envs[self.variant]=val
79
+ env=property(get_env,set_env)
80
+ def init_dirs(self):
81
+ top=self.top_dir
82
+ if not top:
83
+ top=Options.options.top
84
+ if not top:
85
+ top=getattr(Context.g_module,Context.TOP,None)
86
+ if not top:
87
+ top=self.path.abspath()
88
+ top=os.path.abspath(top)
89
+ self.srcnode=(os.path.isabs(top)and self.root or self.path).find_dir(top)
90
+ assert(self.srcnode)
91
+ out=self.out_dir
92
+ if not out:
93
+ out=Options.options.out
94
+ if not out:
95
+ out=getattr(Context.g_module,Context.OUT,None)
96
+ if not out:
97
+ out=Options.lockfile.replace('.lock-waf_%s_'%sys.platform,'').replace('.lock-waf','')
98
+ self.bldnode=(os.path.isabs(out)and self.root or self.path).make_node(out)
99
+ self.bldnode.mkdir()
100
+ if not os.path.isdir(self.bldnode.abspath()):
101
+ conf.fatal('could not create the build directory %s'%self.bldnode.abspath())
102
+ def execute(self):
103
+ self.init_dirs()
104
+ self.cachedir=self.bldnode.make_node(Build.CACHE_DIR)
105
+ self.cachedir.mkdir()
106
+ path=os.path.join(self.bldnode.abspath(),WAF_CONFIG_LOG)
107
+ self.logger=Logs.make_logger(path,'cfg')
108
+ app=getattr(Context.g_module,'APPNAME','')
109
+ if app:
110
+ ver=getattr(Context.g_module,'VERSION','')
111
+ if ver:
112
+ app="%s (%s)"%(app,ver)
113
+ now=time.ctime()
114
+ pyver=sys.hexversion
115
+ systype=sys.platform
116
+ args=" ".join(sys.argv)
117
+ wafver=Context.WAFVERSION
118
+ abi=Context.ABI
119
+ self.to_log(conf_template%vars())
120
+ self.msg('Setting top to',self.srcnode.abspath())
121
+ self.msg('Setting out to',self.bldnode.abspath())
122
+ if id(self.srcnode)==id(self.bldnode):
123
+ Logs.warn('Setting top == out (remember to use "update_outputs")')
124
+ elif id(self.path)!=id(self.srcnode):
125
+ if self.srcnode.is_child_of(self.path):
126
+ Logs.warn('Are you certain that you do not want to set top="." ?')
127
+ super(ConfigurationContext,self).execute()
128
+ self.store()
129
+ Context.top_dir=self.srcnode.abspath()
130
+ Context.out_dir=self.bldnode.abspath()
131
+ env=ConfigSet.ConfigSet()
132
+ env['argv']=sys.argv
133
+ env['options']=Options.options.__dict__
134
+ env.run_dir=Context.run_dir
135
+ env.top_dir=Context.top_dir
136
+ env.out_dir=Context.out_dir
137
+ env['hash']=self.hash
138
+ env['files']=self.files
139
+ env['environ']=dict(self.environ)
140
+ if not self.env.NO_LOCK_IN_RUN:
141
+ env.store(Context.run_dir+os.sep+Options.lockfile)
142
+ if not self.env.NO_LOCK_IN_TOP:
143
+ env.store(Context.top_dir+os.sep+Options.lockfile)
144
+ if not self.env.NO_LOCK_IN_OUT:
145
+ env.store(Context.out_dir+os.sep+Options.lockfile)
146
+ def prepare_env(self,env):
147
+ if not env.PREFIX:
148
+ env.PREFIX=os.path.abspath(os.path.expanduser(Options.options.prefix))
149
+ if not env.BINDIR:
150
+ env.BINDIR=Utils.subst_vars('${PREFIX}/bin',env)
151
+ if not env.LIBDIR:
152
+ env.LIBDIR=Utils.subst_vars('${PREFIX}/lib',env)
153
+ def store(self):
154
+ n=self.cachedir.make_node('build.config.py')
155
+ n.write('version = 0x%x\ntools = %r\n'%(Context.HEXVERSION,self.tools))
156
+ if not self.all_envs:
157
+ self.fatal('nothing to store in the configuration context!')
158
+ for key in self.all_envs:
159
+ tmpenv=self.all_envs[key]
160
+ tmpenv.store(os.path.join(self.cachedir.abspath(),key+Build.CACHE_SUFFIX))
161
+ def load(self,input,tooldir=None,funs=None,download=True):
162
+ tools=Utils.to_list(input)
163
+ if tooldir:tooldir=Utils.to_list(tooldir)
164
+ for tool in tools:
165
+ mag=(tool,id(self.env),funs)
166
+ if mag in self.tool_cache:
167
+ self.to_log('(tool %s is already loaded, skipping)'%tool)
168
+ continue
169
+ self.tool_cache.append(mag)
170
+ module=None
171
+ try:
172
+ module=Context.load_tool(tool,tooldir)
173
+ except ImportError ,e:
174
+ if Options.options.download:
175
+ module=download_tool(tool,ctx=self)
176
+ if not module:
177
+ self.fatal('Could not load the Waf tool %r or download a suitable replacement from the repository (sys.path %r)\n%s'%(tool,sys.path,e))
178
+ else:
179
+ self.fatal('Could not load the Waf tool %r from %r (try the --download option?):\n%s'%(tool,sys.path,e))
180
+ except Exception ,e:
181
+ self.to_log('imp %r (%r & %r)'%(tool,tooldir,funs))
182
+ self.to_log(Utils.ex_stack())
183
+ raise
184
+ if funs is not None:
185
+ self.eval_rules(funs)
186
+ else:
187
+ func=getattr(module,'configure',None)
188
+ if func:
189
+ if type(func)is type(Utils.readf):func(self)
190
+ else:self.eval_rules(func)
191
+ self.tools.append({'tool':tool,'tooldir':tooldir,'funs':funs})
192
+ def post_recurse(self,node):
193
+ super(ConfigurationContext,self).post_recurse(node)
194
+ self.hash=hash((self.hash,node.read('rb')))
195
+ self.files.append(node.abspath())
196
+ def eval_rules(self,rules):
197
+ self.rules=Utils.to_list(rules)
198
+ for x in self.rules:
199
+ f=getattr(self,x)
200
+ if not f:self.fatal("No such method '%s'."%x)
201
+ try:
202
+ f()
203
+ except Exception ,e:
204
+ ret=self.err_handler(x,e)
205
+ if ret==BREAK:
206
+ break
207
+ elif ret==CONTINUE:
208
+ continue
209
+ else:
210
+ raise
211
+ def err_handler(self,fun,error):
212
+ pass
213
+ def conf(f):
214
+ def fun(*k,**kw):
215
+ mandatory=True
216
+ if'mandatory'in kw:
217
+ mandatory=kw['mandatory']
218
+ del kw['mandatory']
219
+ try:
220
+ return f(*k,**kw)
221
+ except Errors.ConfigurationError ,e:
222
+ if mandatory:
223
+ raise e
224
+ setattr(ConfigurationContext,f.__name__,fun)
225
+ setattr(Build.BuildContext,f.__name__,fun)
226
+ return f
227
+ def add_os_flags(self,var,dest=None):
228
+ try:self.env.append_value(dest or var,shlex.split(self.environ[var]))
229
+ except KeyError:pass
230
+ def cmd_to_list(self,cmd):
231
+ if isinstance(cmd,str)and cmd.find(' '):
232
+ try:
233
+ os.stat(cmd)
234
+ except OSError:
235
+ return shlex.split(cmd)
236
+ else:
237
+ return[cmd]
238
+ return cmd
239
+ def check_waf_version(self,mini='1.6.0',maxi='1.7.0'):
240
+ self.start_msg('Checking for waf version in %s-%s'%(str(mini),str(maxi)))
241
+ ver=Context.HEXVERSION
242
+ if Utils.num2ver(mini)>ver:
243
+ self.fatal('waf version should be at least %r (%r found)'%(Utils.num2ver(mini),ver))
244
+ if Utils.num2ver(maxi)<ver:
245
+ self.fatal('waf version should be at most %r (%r found)'%(Utils.num2ver(maxi),ver))
246
+ self.end_msg('ok')
247
+ def find_file(self,filename,path_list=[]):
248
+ for n in Utils.to_list(filename):
249
+ for d in Utils.to_list(path_list):
250
+ p=os.path.join(d,n)
251
+ if os.path.exists(p):
252
+ return p
253
+ self.fatal('Could not find %r'%filename)
254
+ def find_program(self,filename,**kw):
255
+ exts=kw.get('exts',Utils.is_win32 and'.exe,.com,.bat,.cmd'or',.sh,.pl,.py')
256
+ environ=kw.get('environ',os.environ)
257
+ ret=''
258
+ filename=Utils.to_list(filename)
259
+ var=kw.get('var','')
260
+ if not var:
261
+ var=filename[0].upper()
262
+ if self.env[var]:
263
+ ret=self.env[var]
264
+ elif var in environ:
265
+ ret=environ[var]
266
+ path_list=kw.get('path_list','')
267
+ if not ret:
268
+ if path_list:
269
+ path_list=Utils.to_list(path_list)
270
+ else:
271
+ path_list=environ.get('PATH','').split(os.pathsep)
272
+ if not isinstance(filename,list):
273
+ filename=[filename]
274
+ for a in exts.split(','):
275
+ if ret:
276
+ break
277
+ for b in filename:
278
+ if ret:
279
+ break
280
+ for c in path_list:
281
+ if ret:
282
+ break
283
+ x=os.path.expanduser(os.path.join(c,b+a))
284
+ if os.path.isfile(x):
285
+ ret=x
286
+ if not ret and Utils.winreg:
287
+ ret=Utils.get_registry_app_path(Utils.winreg.HKEY_CURRENT_USER,filename)
288
+ if not ret and Utils.winreg:
289
+ ret=Utils.get_registry_app_path(Utils.winreg.HKEY_LOCAL_MACHINE,filename)
290
+ self.msg('Checking for program '+','.join(filename),ret or False)
291
+ self.to_log('find program=%r paths=%r var=%r -> %r'%(filename,path_list,var,ret))
292
+ if not ret:
293
+ self.fatal(kw.get('errmsg','')or'Could not find the program %s'%','.join(filename))
294
+ if var:
295
+ self.env[var]=ret
296
+ return ret
297
+ def find_perl_program(self,filename,path_list=[],var=None,environ=None,exts=''):
298
+ try:
299
+ app=self.find_program(filename,path_list=path_list,var=var,environ=environ,exts=exts)
300
+ except:
301
+ self.find_program('perl',var='PERL')
302
+ app=self.find_file(filename,os.environ['PATH'].split(os.pathsep))
303
+ if not app:
304
+ raise
305
+ if var:
306
+ self.env[var]=Utils.to_list(self.env['PERL'])+[app]
307
+ self.msg('Checking for %r'%filename,app)
308
+
309
+ conf(add_os_flags)
310
+ conf(cmd_to_list)
311
+ conf(check_waf_version)
312
+ conf(find_file)
313
+ conf(find_program)
314
+ conf(find_perl_program)