therubyracer 0.5.0-x86-linux → 0.11.0beta5-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of therubyracer might be problematic. Click here for more details.
- data/.gitignore +23 -11
- data/.travis.yml +10 -0
- data/Changelog.md +242 -0
- data/Gemfile +16 -0
- data/README.md +185 -0
- data/Rakefile +42 -51
- data/benchmarks.rb +217 -0
- data/ext/v8/accessor.cc +181 -0
- data/ext/v8/array.cc +26 -0
- data/ext/v8/backref.cc +56 -0
- data/ext/v8/build.rb +52 -0
- data/ext/v8/constants.cc +34 -0
- data/ext/v8/constraints.cc +52 -0
- data/ext/v8/context.cc +130 -0
- data/ext/v8/date.cc +18 -0
- data/ext/v8/exception.cc +38 -0
- data/ext/v8/extconf.rb +16 -29
- data/ext/v8/external.cc +43 -0
- data/ext/v8/function.cc +58 -0
- data/ext/v8/gc.cc +43 -0
- data/ext/v8/handles.cc +34 -0
- data/ext/v8/heap.cc +31 -0
- data/ext/v8/init.cc +39 -0
- data/ext/v8/init.so +0 -0
- data/ext/v8/invocation.cc +86 -0
- data/ext/v8/locker.cc +77 -0
- data/ext/v8/message.cc +51 -0
- data/ext/v8/object.cc +334 -0
- data/ext/v8/primitive.cc +8 -0
- data/ext/v8/rr.cc +83 -0
- data/ext/v8/rr.h +883 -0
- data/ext/v8/script.cc +80 -0
- data/ext/v8/signature.cc +18 -0
- data/ext/v8/stack.cc +75 -0
- data/ext/v8/string.cc +47 -0
- data/ext/v8/template.cc +175 -0
- data/ext/v8/trycatch.cc +86 -0
- data/ext/v8/v8.cc +87 -0
- data/ext/v8/value.cc +239 -0
- data/lib/v8.rb +30 -9
- data/lib/v8/access.rb +5 -0
- data/lib/v8/access/indices.rb +40 -0
- data/lib/v8/access/invocation.rb +47 -0
- data/lib/v8/access/names.rb +65 -0
- data/lib/v8/array.rb +26 -0
- data/lib/v8/context.rb +217 -75
- data/lib/v8/conversion.rb +35 -0
- data/lib/v8/conversion/array.rb +11 -0
- data/lib/v8/conversion/class.rb +120 -0
- data/lib/v8/conversion/code.rb +38 -0
- data/lib/v8/conversion/fundamental.rb +11 -0
- data/lib/v8/conversion/hash.rb +11 -0
- data/lib/v8/conversion/indentity.rb +31 -0
- data/lib/v8/conversion/method.rb +26 -0
- data/lib/v8/conversion/object.rb +28 -0
- data/lib/v8/conversion/primitive.rb +7 -0
- data/lib/v8/conversion/proc.rb +5 -0
- data/lib/v8/conversion/reference.rb +16 -0
- data/lib/v8/conversion/string.rb +12 -0
- data/lib/v8/conversion/symbol.rb +7 -0
- data/lib/v8/conversion/time.rb +13 -0
- data/lib/v8/error.rb +25 -0
- data/lib/v8/error/protect.rb +20 -0
- data/lib/v8/error/try.rb +15 -0
- data/lib/v8/function.rb +28 -0
- data/lib/v8/object.rb +69 -28
- data/lib/v8/util/weakcell.rb +29 -0
- data/lib/v8/version.rb +3 -0
- data/spec/c/array_spec.rb +17 -0
- data/spec/c/constants_spec.rb +20 -0
- data/spec/c/exception_spec.rb +26 -0
- data/spec/c/external_spec.rb +9 -0
- data/spec/c/function_spec.rb +46 -0
- data/spec/c/handles_spec.rb +35 -0
- data/spec/c/locker_spec.rb +38 -0
- data/spec/c/object_spec.rb +46 -0
- data/spec/c/script_spec.rb +28 -0
- data/spec/c/string_spec.rb +16 -0
- data/spec/c/template_spec.rb +30 -0
- data/spec/c/trycatch_spec.rb +51 -0
- data/spec/mem/blunt_spec.rb +42 -0
- data/spec/redjs_spec.rb +10 -0
- data/spec/spec_helper.rb +43 -12
- data/spec/threading_spec.rb +52 -0
- data/spec/v8/context_spec.rb +19 -0
- data/spec/v8/conversion_spec.rb +9 -0
- data/spec/v8/error_spec.rb +21 -0
- data/spec/v8/function_spec.rb +9 -0
- data/spec/v8/object_spec.rb +15 -0
- data/thefrontside.png +0 -0
- data/therubyracer.gemspec +15 -676
- metadata +146 -680
- data/.gitmodules +0 -3
- data/Doxyfile +0 -1514
- data/History.txt +0 -51
- data/README.rdoc +0 -158
- data/docs/data_conversion.txt +0 -18
- data/ext/v8/callbacks.cpp +0 -160
- data/ext/v8/callbacks.h +0 -14
- data/ext/v8/convert_ruby.cpp +0 -8
- data/ext/v8/convert_ruby.h +0 -99
- data/ext/v8/convert_string.cpp +0 -10
- data/ext/v8/convert_string.h +0 -73
- data/ext/v8/convert_v8.cpp +0 -9
- data/ext/v8/convert_v8.h +0 -121
- data/ext/v8/converters.cpp +0 -83
- data/ext/v8/converters.h +0 -23
- data/ext/v8/upstream/2.0.6/.gitignore +0 -26
- data/ext/v8/upstream/2.0.6/AUTHORS +0 -23
- data/ext/v8/upstream/2.0.6/ChangeLog +0 -1479
- data/ext/v8/upstream/2.0.6/LICENSE +0 -55
- data/ext/v8/upstream/2.0.6/SConstruct +0 -1028
- data/ext/v8/upstream/2.0.6/include/v8-debug.h +0 -275
- data/ext/v8/upstream/2.0.6/include/v8.h +0 -3236
- data/ext/v8/upstream/2.0.6/src/SConscript +0 -283
- data/ext/v8/upstream/2.0.6/src/accessors.cc +0 -695
- data/ext/v8/upstream/2.0.6/src/accessors.h +0 -114
- data/ext/v8/upstream/2.0.6/src/allocation.cc +0 -198
- data/ext/v8/upstream/2.0.6/src/allocation.h +0 -169
- data/ext/v8/upstream/2.0.6/src/api.cc +0 -3831
- data/ext/v8/upstream/2.0.6/src/api.h +0 -479
- data/ext/v8/upstream/2.0.6/src/apinatives.js +0 -110
- data/ext/v8/upstream/2.0.6/src/apiutils.h +0 -69
- data/ext/v8/upstream/2.0.6/src/arguments.h +0 -97
- data/ext/v8/upstream/2.0.6/src/arm/assembler-arm-inl.h +0 -277
- data/ext/v8/upstream/2.0.6/src/arm/assembler-arm.cc +0 -1821
- data/ext/v8/upstream/2.0.6/src/arm/assembler-arm.h +0 -1027
- data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2-inl.h +0 -267
- data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2.cc +0 -1821
- data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2.h +0 -1027
- data/ext/v8/upstream/2.0.6/src/arm/builtins-arm.cc +0 -1271
- data/ext/v8/upstream/2.0.6/src/arm/codegen-arm-inl.h +0 -74
- data/ext/v8/upstream/2.0.6/src/arm/codegen-arm.cc +0 -6682
- data/ext/v8/upstream/2.0.6/src/arm/codegen-arm.h +0 -535
- data/ext/v8/upstream/2.0.6/src/arm/constants-arm.cc +0 -112
- data/ext/v8/upstream/2.0.6/src/arm/constants-arm.h +0 -347
- data/ext/v8/upstream/2.0.6/src/arm/cpu-arm.cc +0 -132
- data/ext/v8/upstream/2.0.6/src/arm/debug-arm.cc +0 -213
- data/ext/v8/upstream/2.0.6/src/arm/disasm-arm.cc +0 -1166
- data/ext/v8/upstream/2.0.6/src/arm/fast-codegen-arm.cc +0 -1698
- data/ext/v8/upstream/2.0.6/src/arm/frames-arm.cc +0 -123
- data/ext/v8/upstream/2.0.6/src/arm/frames-arm.h +0 -162
- data/ext/v8/upstream/2.0.6/src/arm/ic-arm.cc +0 -849
- data/ext/v8/upstream/2.0.6/src/arm/jump-target-arm.cc +0 -238
- data/ext/v8/upstream/2.0.6/src/arm/macro-assembler-arm.cc +0 -1259
- data/ext/v8/upstream/2.0.6/src/arm/macro-assembler-arm.h +0 -423
- data/ext/v8/upstream/2.0.6/src/arm/regexp-macro-assembler-arm.cc +0 -1266
- data/ext/v8/upstream/2.0.6/src/arm/regexp-macro-assembler-arm.h +0 -282
- data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm-inl.h +0 -103
- data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm.cc +0 -59
- data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm.h +0 -43
- data/ext/v8/upstream/2.0.6/src/arm/simulator-arm.cc +0 -2264
- data/ext/v8/upstream/2.0.6/src/arm/simulator-arm.h +0 -306
- data/ext/v8/upstream/2.0.6/src/arm/stub-cache-arm.cc +0 -1516
- data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.cc +0 -412
- data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.h +0 -532
- data/ext/v8/upstream/2.0.6/src/array.js +0 -1154
- data/ext/v8/upstream/2.0.6/src/assembler.cc +0 -772
- data/ext/v8/upstream/2.0.6/src/assembler.h +0 -525
- data/ext/v8/upstream/2.0.6/src/ast.cc +0 -512
- data/ext/v8/upstream/2.0.6/src/ast.h +0 -1820
- data/ext/v8/upstream/2.0.6/src/bootstrapper.cc +0 -1680
- data/ext/v8/upstream/2.0.6/src/bootstrapper.h +0 -103
- data/ext/v8/upstream/2.0.6/src/builtins.cc +0 -851
- data/ext/v8/upstream/2.0.6/src/builtins.h +0 -245
- data/ext/v8/upstream/2.0.6/src/bytecodes-irregexp.h +0 -104
- data/ext/v8/upstream/2.0.6/src/char-predicates-inl.h +0 -86
- data/ext/v8/upstream/2.0.6/src/char-predicates.h +0 -65
- data/ext/v8/upstream/2.0.6/src/checks.cc +0 -100
- data/ext/v8/upstream/2.0.6/src/checks.h +0 -284
- data/ext/v8/upstream/2.0.6/src/code-stubs.cc +0 -164
- data/ext/v8/upstream/2.0.6/src/code-stubs.h +0 -164
- data/ext/v8/upstream/2.0.6/src/code.h +0 -68
- data/ext/v8/upstream/2.0.6/src/codegen-inl.h +0 -88
- data/ext/v8/upstream/2.0.6/src/codegen.cc +0 -504
- data/ext/v8/upstream/2.0.6/src/codegen.h +0 -522
- data/ext/v8/upstream/2.0.6/src/compilation-cache.cc +0 -490
- data/ext/v8/upstream/2.0.6/src/compilation-cache.h +0 -98
- data/ext/v8/upstream/2.0.6/src/compiler.cc +0 -1132
- data/ext/v8/upstream/2.0.6/src/compiler.h +0 -107
- data/ext/v8/upstream/2.0.6/src/contexts.cc +0 -256
- data/ext/v8/upstream/2.0.6/src/contexts.h +0 -345
- data/ext/v8/upstream/2.0.6/src/conversions-inl.h +0 -95
- data/ext/v8/upstream/2.0.6/src/conversions.cc +0 -709
- data/ext/v8/upstream/2.0.6/src/conversions.h +0 -118
- data/ext/v8/upstream/2.0.6/src/counters.cc +0 -78
- data/ext/v8/upstream/2.0.6/src/counters.h +0 -239
- data/ext/v8/upstream/2.0.6/src/cpu.h +0 -65
- data/ext/v8/upstream/2.0.6/src/d8-debug.cc +0 -345
- data/ext/v8/upstream/2.0.6/src/d8-debug.h +0 -155
- data/ext/v8/upstream/2.0.6/src/d8-posix.cc +0 -675
- data/ext/v8/upstream/2.0.6/src/d8-readline.cc +0 -128
- data/ext/v8/upstream/2.0.6/src/d8-windows.cc +0 -42
- data/ext/v8/upstream/2.0.6/src/d8.cc +0 -776
- data/ext/v8/upstream/2.0.6/src/d8.h +0 -225
- data/ext/v8/upstream/2.0.6/src/d8.js +0 -1625
- data/ext/v8/upstream/2.0.6/src/date-delay.js +0 -1138
- data/ext/v8/upstream/2.0.6/src/dateparser-inl.h +0 -114
- data/ext/v8/upstream/2.0.6/src/dateparser.cc +0 -186
- data/ext/v8/upstream/2.0.6/src/dateparser.h +0 -240
- data/ext/v8/upstream/2.0.6/src/debug-agent.cc +0 -425
- data/ext/v8/upstream/2.0.6/src/debug-agent.h +0 -129
- data/ext/v8/upstream/2.0.6/src/debug-delay.js +0 -2073
- data/ext/v8/upstream/2.0.6/src/debug.cc +0 -2751
- data/ext/v8/upstream/2.0.6/src/debug.h +0 -866
- data/ext/v8/upstream/2.0.6/src/disasm.h +0 -77
- data/ext/v8/upstream/2.0.6/src/disassembler.cc +0 -318
- data/ext/v8/upstream/2.0.6/src/disassembler.h +0 -56
- data/ext/v8/upstream/2.0.6/src/dtoa-config.c +0 -91
- data/ext/v8/upstream/2.0.6/src/execution.cc +0 -701
- data/ext/v8/upstream/2.0.6/src/execution.h +0 -312
- data/ext/v8/upstream/2.0.6/src/factory.cc +0 -957
- data/ext/v8/upstream/2.0.6/src/factory.h +0 -393
- data/ext/v8/upstream/2.0.6/src/fast-codegen.cc +0 -725
- data/ext/v8/upstream/2.0.6/src/fast-codegen.h +0 -371
- data/ext/v8/upstream/2.0.6/src/flag-definitions.h +0 -426
- data/ext/v8/upstream/2.0.6/src/flags.cc +0 -555
- data/ext/v8/upstream/2.0.6/src/flags.h +0 -81
- data/ext/v8/upstream/2.0.6/src/frame-element.cc +0 -45
- data/ext/v8/upstream/2.0.6/src/frame-element.h +0 -235
- data/ext/v8/upstream/2.0.6/src/frames-inl.h +0 -215
- data/ext/v8/upstream/2.0.6/src/frames.cc +0 -749
- data/ext/v8/upstream/2.0.6/src/frames.h +0 -659
- data/ext/v8/upstream/2.0.6/src/func-name-inferrer.cc +0 -76
- data/ext/v8/upstream/2.0.6/src/func-name-inferrer.h +0 -135
- data/ext/v8/upstream/2.0.6/src/global-handles.cc +0 -516
- data/ext/v8/upstream/2.0.6/src/global-handles.h +0 -180
- data/ext/v8/upstream/2.0.6/src/globals.h +0 -608
- data/ext/v8/upstream/2.0.6/src/handles-inl.h +0 -76
- data/ext/v8/upstream/2.0.6/src/handles.cc +0 -811
- data/ext/v8/upstream/2.0.6/src/handles.h +0 -367
- data/ext/v8/upstream/2.0.6/src/hashmap.cc +0 -226
- data/ext/v8/upstream/2.0.6/src/hashmap.h +0 -120
- data/ext/v8/upstream/2.0.6/src/heap-inl.h +0 -407
- data/ext/v8/upstream/2.0.6/src/heap-profiler.cc +0 -695
- data/ext/v8/upstream/2.0.6/src/heap-profiler.h +0 -277
- data/ext/v8/upstream/2.0.6/src/heap.cc +0 -4204
- data/ext/v8/upstream/2.0.6/src/heap.h +0 -1704
- data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32-inl.h +0 -325
- data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32.cc +0 -2375
- data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32.h +0 -914
- data/ext/v8/upstream/2.0.6/src/ia32/builtins-ia32.cc +0 -1222
- data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32-inl.h +0 -46
- data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32.cc +0 -9770
- data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32.h +0 -834
- data/ext/v8/upstream/2.0.6/src/ia32/cpu-ia32.cc +0 -79
- data/ext/v8/upstream/2.0.6/src/ia32/debug-ia32.cc +0 -208
- data/ext/v8/upstream/2.0.6/src/ia32/disasm-ia32.cc +0 -1357
- data/ext/v8/upstream/2.0.6/src/ia32/fast-codegen-ia32.cc +0 -1813
- data/ext/v8/upstream/2.0.6/src/ia32/frames-ia32.cc +0 -111
- data/ext/v8/upstream/2.0.6/src/ia32/frames-ia32.h +0 -135
- data/ext/v8/upstream/2.0.6/src/ia32/ic-ia32.cc +0 -1490
- data/ext/v8/upstream/2.0.6/src/ia32/jump-target-ia32.cc +0 -432
- data/ext/v8/upstream/2.0.6/src/ia32/macro-assembler-ia32.cc +0 -1517
- data/ext/v8/upstream/2.0.6/src/ia32/macro-assembler-ia32.h +0 -528
- data/ext/v8/upstream/2.0.6/src/ia32/regexp-macro-assembler-ia32.cc +0 -1219
- data/ext/v8/upstream/2.0.6/src/ia32/regexp-macro-assembler-ia32.h +0 -230
- data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32-inl.h +0 -82
- data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32.cc +0 -99
- data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32.h +0 -43
- data/ext/v8/upstream/2.0.6/src/ia32/simulator-ia32.cc +0 -30
- data/ext/v8/upstream/2.0.6/src/ia32/simulator-ia32.h +0 -62
- data/ext/v8/upstream/2.0.6/src/ia32/stub-cache-ia32.cc +0 -1961
- data/ext/v8/upstream/2.0.6/src/ia32/virtual-frame-ia32.cc +0 -1105
- data/ext/v8/upstream/2.0.6/src/ia32/virtual-frame-ia32.h +0 -580
- data/ext/v8/upstream/2.0.6/src/ic-inl.h +0 -93
- data/ext/v8/upstream/2.0.6/src/ic.cc +0 -1426
- data/ext/v8/upstream/2.0.6/src/ic.h +0 -443
- data/ext/v8/upstream/2.0.6/src/interpreter-irregexp.cc +0 -646
- data/ext/v8/upstream/2.0.6/src/interpreter-irregexp.h +0 -48
- data/ext/v8/upstream/2.0.6/src/json-delay.js +0 -254
- data/ext/v8/upstream/2.0.6/src/jsregexp.cc +0 -5234
- data/ext/v8/upstream/2.0.6/src/jsregexp.h +0 -1439
- data/ext/v8/upstream/2.0.6/src/jump-target-inl.h +0 -49
- data/ext/v8/upstream/2.0.6/src/jump-target.cc +0 -383
- data/ext/v8/upstream/2.0.6/src/jump-target.h +0 -280
- data/ext/v8/upstream/2.0.6/src/list-inl.h +0 -166
- data/ext/v8/upstream/2.0.6/src/list.h +0 -158
- data/ext/v8/upstream/2.0.6/src/log-inl.h +0 -126
- data/ext/v8/upstream/2.0.6/src/log-utils.cc +0 -503
- data/ext/v8/upstream/2.0.6/src/log-utils.h +0 -292
- data/ext/v8/upstream/2.0.6/src/log.cc +0 -1457
- data/ext/v8/upstream/2.0.6/src/log.h +0 -371
- data/ext/v8/upstream/2.0.6/src/macro-assembler.h +0 -93
- data/ext/v8/upstream/2.0.6/src/macros.py +0 -137
- data/ext/v8/upstream/2.0.6/src/mark-compact.cc +0 -2007
- data/ext/v8/upstream/2.0.6/src/mark-compact.h +0 -442
- data/ext/v8/upstream/2.0.6/src/math.js +0 -263
- data/ext/v8/upstream/2.0.6/src/memory.h +0 -74
- data/ext/v8/upstream/2.0.6/src/messages.cc +0 -177
- data/ext/v8/upstream/2.0.6/src/messages.h +0 -112
- data/ext/v8/upstream/2.0.6/src/messages.js +0 -937
- data/ext/v8/upstream/2.0.6/src/mirror-delay.js +0 -2332
- data/ext/v8/upstream/2.0.6/src/mksnapshot.cc +0 -169
- data/ext/v8/upstream/2.0.6/src/natives.h +0 -63
- data/ext/v8/upstream/2.0.6/src/objects-debug.cc +0 -1317
- data/ext/v8/upstream/2.0.6/src/objects-inl.h +0 -3044
- data/ext/v8/upstream/2.0.6/src/objects.cc +0 -8306
- data/ext/v8/upstream/2.0.6/src/objects.h +0 -4960
- data/ext/v8/upstream/2.0.6/src/oprofile-agent.cc +0 -116
- data/ext/v8/upstream/2.0.6/src/oprofile-agent.h +0 -69
- data/ext/v8/upstream/2.0.6/src/parser.cc +0 -4810
- data/ext/v8/upstream/2.0.6/src/parser.h +0 -195
- data/ext/v8/upstream/2.0.6/src/platform-freebsd.cc +0 -645
- data/ext/v8/upstream/2.0.6/src/platform-linux.cc +0 -808
- data/ext/v8/upstream/2.0.6/src/platform-macos.cc +0 -643
- data/ext/v8/upstream/2.0.6/src/platform-nullos.cc +0 -454
- data/ext/v8/upstream/2.0.6/src/platform-openbsd.cc +0 -597
- data/ext/v8/upstream/2.0.6/src/platform-posix.cc +0 -380
- data/ext/v8/upstream/2.0.6/src/platform-win32.cc +0 -1908
- data/ext/v8/upstream/2.0.6/src/platform.h +0 -556
- data/ext/v8/upstream/2.0.6/src/prettyprinter.cc +0 -1511
- data/ext/v8/upstream/2.0.6/src/prettyprinter.h +0 -219
- data/ext/v8/upstream/2.0.6/src/property.cc +0 -96
- data/ext/v8/upstream/2.0.6/src/property.h +0 -327
- data/ext/v8/upstream/2.0.6/src/regexp-delay.js +0 -406
- data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp-inl.h +0 -78
- data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp.cc +0 -464
- data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp.h +0 -141
- data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-tracer.cc +0 -356
- data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-tracer.h +0 -103
- data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler.cc +0 -240
- data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler.h +0 -220
- data/ext/v8/upstream/2.0.6/src/regexp-stack.cc +0 -103
- data/ext/v8/upstream/2.0.6/src/regexp-stack.h +0 -123
- data/ext/v8/upstream/2.0.6/src/register-allocator-inl.h +0 -74
- data/ext/v8/upstream/2.0.6/src/register-allocator.cc +0 -100
- data/ext/v8/upstream/2.0.6/src/register-allocator.h +0 -295
- data/ext/v8/upstream/2.0.6/src/rewriter.cc +0 -855
- data/ext/v8/upstream/2.0.6/src/rewriter.h +0 -54
- data/ext/v8/upstream/2.0.6/src/runtime.cc +0 -8163
- data/ext/v8/upstream/2.0.6/src/runtime.h +0 -432
- data/ext/v8/upstream/2.0.6/src/runtime.js +0 -626
- data/ext/v8/upstream/2.0.6/src/scanner.cc +0 -1098
- data/ext/v8/upstream/2.0.6/src/scanner.h +0 -425
- data/ext/v8/upstream/2.0.6/src/scopeinfo.cc +0 -649
- data/ext/v8/upstream/2.0.6/src/scopeinfo.h +0 -236
- data/ext/v8/upstream/2.0.6/src/scopes.cc +0 -963
- data/ext/v8/upstream/2.0.6/src/scopes.h +0 -401
- data/ext/v8/upstream/2.0.6/src/serialize.cc +0 -1260
- data/ext/v8/upstream/2.0.6/src/serialize.h +0 -404
- data/ext/v8/upstream/2.0.6/src/shell.h +0 -55
- data/ext/v8/upstream/2.0.6/src/simulator.h +0 -41
- data/ext/v8/upstream/2.0.6/src/smart-pointer.h +0 -109
- data/ext/v8/upstream/2.0.6/src/snapshot-common.cc +0 -97
- data/ext/v8/upstream/2.0.6/src/snapshot-empty.cc +0 -40
- data/ext/v8/upstream/2.0.6/src/snapshot.h +0 -59
- data/ext/v8/upstream/2.0.6/src/spaces-inl.h +0 -372
- data/ext/v8/upstream/2.0.6/src/spaces.cc +0 -2864
- data/ext/v8/upstream/2.0.6/src/spaces.h +0 -2072
- data/ext/v8/upstream/2.0.6/src/string-stream.cc +0 -584
- data/ext/v8/upstream/2.0.6/src/string-stream.h +0 -189
- data/ext/v8/upstream/2.0.6/src/string.js +0 -901
- data/ext/v8/upstream/2.0.6/src/stub-cache.cc +0 -1108
- data/ext/v8/upstream/2.0.6/src/stub-cache.h +0 -578
- data/ext/v8/upstream/2.0.6/src/third_party/dtoa/COPYING +0 -15
- data/ext/v8/upstream/2.0.6/src/third_party/dtoa/dtoa.c +0 -3330
- data/ext/v8/upstream/2.0.6/src/third_party/valgrind/valgrind.h +0 -3925
- data/ext/v8/upstream/2.0.6/src/token.cc +0 -56
- data/ext/v8/upstream/2.0.6/src/token.h +0 -270
- data/ext/v8/upstream/2.0.6/src/top.cc +0 -991
- data/ext/v8/upstream/2.0.6/src/top.h +0 -459
- data/ext/v8/upstream/2.0.6/src/unicode-inl.h +0 -238
- data/ext/v8/upstream/2.0.6/src/unicode.cc +0 -749
- data/ext/v8/upstream/2.0.6/src/unicode.h +0 -279
- data/ext/v8/upstream/2.0.6/src/uri.js +0 -415
- data/ext/v8/upstream/2.0.6/src/usage-analyzer.cc +0 -426
- data/ext/v8/upstream/2.0.6/src/usage-analyzer.h +0 -40
- data/ext/v8/upstream/2.0.6/src/utils.cc +0 -322
- data/ext/v8/upstream/2.0.6/src/utils.h +0 -592
- data/ext/v8/upstream/2.0.6/src/v8-counters.cc +0 -55
- data/ext/v8/upstream/2.0.6/src/v8-counters.h +0 -198
- data/ext/v8/upstream/2.0.6/src/v8.cc +0 -193
- data/ext/v8/upstream/2.0.6/src/v8.h +0 -119
- data/ext/v8/upstream/2.0.6/src/v8natives.js +0 -846
- data/ext/v8/upstream/2.0.6/src/v8threads.cc +0 -450
- data/ext/v8/upstream/2.0.6/src/v8threads.h +0 -144
- data/ext/v8/upstream/2.0.6/src/variables.cc +0 -163
- data/ext/v8/upstream/2.0.6/src/variables.h +0 -235
- data/ext/v8/upstream/2.0.6/src/version.cc +0 -88
- data/ext/v8/upstream/2.0.6/src/version.h +0 -64
- data/ext/v8/upstream/2.0.6/src/virtual-frame.cc +0 -381
- data/ext/v8/upstream/2.0.6/src/virtual-frame.h +0 -44
- data/ext/v8/upstream/2.0.6/src/x64/assembler-x64-inl.h +0 -352
- data/ext/v8/upstream/2.0.6/src/x64/assembler-x64.cc +0 -2539
- data/ext/v8/upstream/2.0.6/src/x64/assembler-x64.h +0 -1399
- data/ext/v8/upstream/2.0.6/src/x64/builtins-x64.cc +0 -1255
- data/ext/v8/upstream/2.0.6/src/x64/codegen-x64-inl.h +0 -46
- data/ext/v8/upstream/2.0.6/src/x64/codegen-x64.cc +0 -8223
- data/ext/v8/upstream/2.0.6/src/x64/codegen-x64.h +0 -785
- data/ext/v8/upstream/2.0.6/src/x64/cpu-x64.cc +0 -79
- data/ext/v8/upstream/2.0.6/src/x64/debug-x64.cc +0 -202
- data/ext/v8/upstream/2.0.6/src/x64/disasm-x64.cc +0 -1596
- data/ext/v8/upstream/2.0.6/src/x64/fast-codegen-x64.cc +0 -1820
- data/ext/v8/upstream/2.0.6/src/x64/frames-x64.cc +0 -109
- data/ext/v8/upstream/2.0.6/src/x64/frames-x64.h +0 -121
- data/ext/v8/upstream/2.0.6/src/x64/ic-x64.cc +0 -1392
- data/ext/v8/upstream/2.0.6/src/x64/jump-target-x64.cc +0 -432
- data/ext/v8/upstream/2.0.6/src/x64/macro-assembler-x64.cc +0 -2409
- data/ext/v8/upstream/2.0.6/src/x64/macro-assembler-x64.h +0 -765
- data/ext/v8/upstream/2.0.6/src/x64/regexp-macro-assembler-x64.cc +0 -1337
- data/ext/v8/upstream/2.0.6/src/x64/regexp-macro-assembler-x64.h +0 -295
- data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64-inl.h +0 -86
- data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64.cc +0 -84
- data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64.h +0 -43
- data/ext/v8/upstream/2.0.6/src/x64/simulator-x64.cc +0 -27
- data/ext/v8/upstream/2.0.6/src/x64/simulator-x64.h +0 -63
- data/ext/v8/upstream/2.0.6/src/x64/stub-cache-x64.cc +0 -1884
- data/ext/v8/upstream/2.0.6/src/x64/virtual-frame-x64.cc +0 -1089
- data/ext/v8/upstream/2.0.6/src/x64/virtual-frame-x64.h +0 -560
- data/ext/v8/upstream/2.0.6/src/zone-inl.h +0 -297
- data/ext/v8/upstream/2.0.6/src/zone.cc +0 -193
- data/ext/v8/upstream/2.0.6/src/zone.h +0 -305
- data/ext/v8/upstream/2.0.6/tools/codemap.js +0 -258
- data/ext/v8/upstream/2.0.6/tools/consarray.js +0 -93
- data/ext/v8/upstream/2.0.6/tools/csvparser.js +0 -98
- data/ext/v8/upstream/2.0.6/tools/gyp/v8.gyp +0 -620
- data/ext/v8/upstream/2.0.6/tools/js2c.py +0 -376
- data/ext/v8/upstream/2.0.6/tools/jsmin.py +0 -280
- data/ext/v8/upstream/2.0.6/tools/linux-tick-processor +0 -24
- data/ext/v8/upstream/2.0.6/tools/linux-tick-processor.py +0 -78
- data/ext/v8/upstream/2.0.6/tools/logreader.js +0 -320
- data/ext/v8/upstream/2.0.6/tools/mac-nm +0 -18
- data/ext/v8/upstream/2.0.6/tools/mac-tick-processor +0 -6
- data/ext/v8/upstream/2.0.6/tools/oprofile/annotate +0 -7
- data/ext/v8/upstream/2.0.6/tools/oprofile/common +0 -19
- data/ext/v8/upstream/2.0.6/tools/oprofile/dump +0 -7
- data/ext/v8/upstream/2.0.6/tools/oprofile/report +0 -7
- data/ext/v8/upstream/2.0.6/tools/oprofile/reset +0 -7
- data/ext/v8/upstream/2.0.6/tools/oprofile/run +0 -14
- data/ext/v8/upstream/2.0.6/tools/oprofile/shutdown +0 -7
- data/ext/v8/upstream/2.0.6/tools/oprofile/start +0 -7
- data/ext/v8/upstream/2.0.6/tools/presubmit.py +0 -299
- data/ext/v8/upstream/2.0.6/tools/process-heap-prof.py +0 -120
- data/ext/v8/upstream/2.0.6/tools/profile.js +0 -621
- data/ext/v8/upstream/2.0.6/tools/profile_view.js +0 -224
- data/ext/v8/upstream/2.0.6/tools/run-valgrind.py +0 -77
- data/ext/v8/upstream/2.0.6/tools/splaytree.js +0 -322
- data/ext/v8/upstream/2.0.6/tools/splaytree.py +0 -226
- data/ext/v8/upstream/2.0.6/tools/stats-viewer.py +0 -456
- data/ext/v8/upstream/2.0.6/tools/test.py +0 -1370
- data/ext/v8/upstream/2.0.6/tools/tickprocessor-driver.js +0 -53
- data/ext/v8/upstream/2.0.6/tools/tickprocessor.js +0 -731
- data/ext/v8/upstream/2.0.6/tools/tickprocessor.py +0 -535
- data/ext/v8/upstream/2.0.6/tools/utils.py +0 -82
- data/ext/v8/upstream/2.0.6/tools/visual_studio/README.txt +0 -71
- data/ext/v8/upstream/2.0.6/tools/visual_studio/arm.vsprops +0 -14
- data/ext/v8/upstream/2.0.6/tools/visual_studio/common.vsprops +0 -35
- data/ext/v8/upstream/2.0.6/tools/visual_studio/d8.vcproj +0 -199
- data/ext/v8/upstream/2.0.6/tools/visual_studio/d8_arm.vcproj +0 -199
- data/ext/v8/upstream/2.0.6/tools/visual_studio/d8_x64.vcproj +0 -201
- data/ext/v8/upstream/2.0.6/tools/visual_studio/d8js2c.cmd +0 -6
- data/ext/v8/upstream/2.0.6/tools/visual_studio/debug.vsprops +0 -17
- data/ext/v8/upstream/2.0.6/tools/visual_studio/ia32.vsprops +0 -13
- data/ext/v8/upstream/2.0.6/tools/visual_studio/js2c.cmd +0 -6
- data/ext/v8/upstream/2.0.6/tools/visual_studio/release.vsprops +0 -24
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8.sln +0 -101
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8.vcproj +0 -223
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_arm.sln +0 -74
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_arm.vcproj +0 -223
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base.vcproj +0 -971
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base_arm.vcproj +0 -983
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base_x64.vcproj +0 -959
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest.vcproj +0 -255
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest_arm.vcproj +0 -243
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest_x64.vcproj +0 -257
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_mksnapshot.vcproj +0 -151
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -151
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample.vcproj +0 -151
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample_arm.vcproj +0 -151
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample_x64.vcproj +0 -151
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample.vcproj +0 -151
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -151
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -153
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot.vcproj +0 -142
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_cc.vcproj +0 -92
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -92
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_x64.vcproj +0 -142
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_x64.sln +0 -101
- data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_x64.vcproj +0 -223
- data/ext/v8/upstream/2.0.6/tools/visual_studio/x64.vsprops +0 -13
- data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.bat +0 -5
- data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.py +0 -137
- data/ext/v8/upstream/Makefile +0 -32
- data/ext/v8/upstream/fpic-on-linux-amd64.patch +0 -13
- data/ext/v8/upstream/no-strict-aliasing.patch +0 -13
- data/ext/v8/upstream/scons/CHANGES.txt +0 -5183
- data/ext/v8/upstream/scons/LICENSE.txt +0 -20
- data/ext/v8/upstream/scons/MANIFEST +0 -202
- data/ext/v8/upstream/scons/PKG-INFO +0 -13
- data/ext/v8/upstream/scons/README.txt +0 -273
- data/ext/v8/upstream/scons/RELEASE.txt +0 -1040
- data/ext/v8/upstream/scons/engine/SCons/Action.py +0 -1256
- data/ext/v8/upstream/scons/engine/SCons/Builder.py +0 -868
- data/ext/v8/upstream/scons/engine/SCons/CacheDir.py +0 -217
- data/ext/v8/upstream/scons/engine/SCons/Conftest.py +0 -794
- data/ext/v8/upstream/scons/engine/SCons/Debug.py +0 -237
- data/ext/v8/upstream/scons/engine/SCons/Defaults.py +0 -485
- data/ext/v8/upstream/scons/engine/SCons/Environment.py +0 -2327
- data/ext/v8/upstream/scons/engine/SCons/Errors.py +0 -207
- data/ext/v8/upstream/scons/engine/SCons/Executor.py +0 -636
- data/ext/v8/upstream/scons/engine/SCons/Job.py +0 -435
- data/ext/v8/upstream/scons/engine/SCons/Memoize.py +0 -292
- data/ext/v8/upstream/scons/engine/SCons/Node/Alias.py +0 -153
- data/ext/v8/upstream/scons/engine/SCons/Node/FS.py +0 -3220
- data/ext/v8/upstream/scons/engine/SCons/Node/Python.py +0 -128
- data/ext/v8/upstream/scons/engine/SCons/Node/__init__.py +0 -1341
- data/ext/v8/upstream/scons/engine/SCons/Options/BoolOption.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Options/EnumOption.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Options/ListOption.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Options/PackageOption.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Options/PathOption.py +0 -76
- data/ext/v8/upstream/scons/engine/SCons/Options/__init__.py +0 -74
- data/ext/v8/upstream/scons/engine/SCons/PathList.py +0 -232
- data/ext/v8/upstream/scons/engine/SCons/Platform/__init__.py +0 -236
- data/ext/v8/upstream/scons/engine/SCons/Platform/aix.py +0 -70
- data/ext/v8/upstream/scons/engine/SCons/Platform/cygwin.py +0 -55
- data/ext/v8/upstream/scons/engine/SCons/Platform/darwin.py +0 -46
- data/ext/v8/upstream/scons/engine/SCons/Platform/hpux.py +0 -46
- data/ext/v8/upstream/scons/engine/SCons/Platform/irix.py +0 -44
- data/ext/v8/upstream/scons/engine/SCons/Platform/os2.py +0 -58
- data/ext/v8/upstream/scons/engine/SCons/Platform/posix.py +0 -264
- data/ext/v8/upstream/scons/engine/SCons/Platform/sunos.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Platform/win32.py +0 -386
- data/ext/v8/upstream/scons/engine/SCons/SConf.py +0 -1038
- data/ext/v8/upstream/scons/engine/SCons/SConsign.py +0 -381
- data/ext/v8/upstream/scons/engine/SCons/Scanner/C.py +0 -132
- data/ext/v8/upstream/scons/engine/SCons/Scanner/D.py +0 -74
- data/ext/v8/upstream/scons/engine/SCons/Scanner/Dir.py +0 -111
- data/ext/v8/upstream/scons/engine/SCons/Scanner/Fortran.py +0 -320
- data/ext/v8/upstream/scons/engine/SCons/Scanner/IDL.py +0 -48
- data/ext/v8/upstream/scons/engine/SCons/Scanner/LaTeX.py +0 -378
- data/ext/v8/upstream/scons/engine/SCons/Scanner/Prog.py +0 -103
- data/ext/v8/upstream/scons/engine/SCons/Scanner/RC.py +0 -55
- data/ext/v8/upstream/scons/engine/SCons/Scanner/__init__.py +0 -415
- data/ext/v8/upstream/scons/engine/SCons/Script/Interactive.py +0 -386
- data/ext/v8/upstream/scons/engine/SCons/Script/Main.py +0 -1360
- data/ext/v8/upstream/scons/engine/SCons/Script/SConsOptions.py +0 -944
- data/ext/v8/upstream/scons/engine/SCons/Script/SConscript.py +0 -642
- data/ext/v8/upstream/scons/engine/SCons/Script/__init__.py +0 -414
- data/ext/v8/upstream/scons/engine/SCons/Sig.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Subst.py +0 -911
- data/ext/v8/upstream/scons/engine/SCons/Taskmaster.py +0 -1030
- data/ext/v8/upstream/scons/engine/SCons/Tool/386asm.py +0 -61
- data/ext/v8/upstream/scons/engine/SCons/Tool/BitKeeper.py +0 -65
- data/ext/v8/upstream/scons/engine/SCons/Tool/CVS.py +0 -73
- data/ext/v8/upstream/scons/engine/SCons/Tool/FortranCommon.py +0 -247
- data/ext/v8/upstream/scons/engine/SCons/Tool/JavaCommon.py +0 -324
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/__init__.py +0 -56
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/arch.py +0 -61
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/common.py +0 -210
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/netframework.py +0 -84
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/sdk.py +0 -321
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vc.py +0 -367
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vs.py +0 -497
- data/ext/v8/upstream/scons/engine/SCons/Tool/Perforce.py +0 -104
- data/ext/v8/upstream/scons/engine/SCons/Tool/PharLapCommon.py +0 -138
- data/ext/v8/upstream/scons/engine/SCons/Tool/RCS.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/SCCS.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/Subversion.py +0 -71
- data/ext/v8/upstream/scons/engine/SCons/Tool/__init__.py +0 -675
- data/ext/v8/upstream/scons/engine/SCons/Tool/aixc++.py +0 -82
- data/ext/v8/upstream/scons/engine/SCons/Tool/aixcc.py +0 -74
- data/ext/v8/upstream/scons/engine/SCons/Tool/aixf77.py +0 -80
- data/ext/v8/upstream/scons/engine/SCons/Tool/aixlink.py +0 -76
- data/ext/v8/upstream/scons/engine/SCons/Tool/applelink.py +0 -71
- data/ext/v8/upstream/scons/engine/SCons/Tool/ar.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/as.py +0 -78
- data/ext/v8/upstream/scons/engine/SCons/Tool/bcc32.py +0 -82
- data/ext/v8/upstream/scons/engine/SCons/Tool/c++.py +0 -99
- data/ext/v8/upstream/scons/engine/SCons/Tool/cc.py +0 -114
- data/ext/v8/upstream/scons/engine/SCons/Tool/cvf.py +0 -58
- data/ext/v8/upstream/scons/engine/SCons/Tool/default.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Tool/dmd.py +0 -224
- data/ext/v8/upstream/scons/engine/SCons/Tool/dvi.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/dvipdf.py +0 -125
- data/ext/v8/upstream/scons/engine/SCons/Tool/dvips.py +0 -94
- data/ext/v8/upstream/scons/engine/SCons/Tool/f77.py +0 -62
- data/ext/v8/upstream/scons/engine/SCons/Tool/f90.py +0 -62
- data/ext/v8/upstream/scons/engine/SCons/Tool/f95.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/filesystem.py +0 -98
- data/ext/v8/upstream/scons/engine/SCons/Tool/fortran.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/g++.py +0 -90
- data/ext/v8/upstream/scons/engine/SCons/Tool/g77.py +0 -73
- data/ext/v8/upstream/scons/engine/SCons/Tool/gas.py +0 -53
- data/ext/v8/upstream/scons/engine/SCons/Tool/gcc.py +0 -80
- data/ext/v8/upstream/scons/engine/SCons/Tool/gfortran.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/gnulink.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/gs.py +0 -81
- data/ext/v8/upstream/scons/engine/SCons/Tool/hpc++.py +0 -85
- data/ext/v8/upstream/scons/engine/SCons/Tool/hpcc.py +0 -53
- data/ext/v8/upstream/scons/engine/SCons/Tool/hplink.py +0 -77
- data/ext/v8/upstream/scons/engine/SCons/Tool/icc.py +0 -59
- data/ext/v8/upstream/scons/engine/SCons/Tool/icl.py +0 -52
- data/ext/v8/upstream/scons/engine/SCons/Tool/ifl.py +0 -72
- data/ext/v8/upstream/scons/engine/SCons/Tool/ifort.py +0 -90
- data/ext/v8/upstream/scons/engine/SCons/Tool/ilink.py +0 -59
- data/ext/v8/upstream/scons/engine/SCons/Tool/ilink32.py +0 -60
- data/ext/v8/upstream/scons/engine/SCons/Tool/install.py +0 -229
- data/ext/v8/upstream/scons/engine/SCons/Tool/intelc.py +0 -490
- data/ext/v8/upstream/scons/engine/SCons/Tool/ipkg.py +0 -71
- data/ext/v8/upstream/scons/engine/SCons/Tool/jar.py +0 -110
- data/ext/v8/upstream/scons/engine/SCons/Tool/javac.py +0 -234
- data/ext/v8/upstream/scons/engine/SCons/Tool/javah.py +0 -138
- data/ext/v8/upstream/scons/engine/SCons/Tool/latex.py +0 -79
- data/ext/v8/upstream/scons/engine/SCons/Tool/lex.py +0 -99
- data/ext/v8/upstream/scons/engine/SCons/Tool/link.py +0 -121
- data/ext/v8/upstream/scons/engine/SCons/Tool/linkloc.py +0 -112
- data/ext/v8/upstream/scons/engine/SCons/Tool/m4.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/masm.py +0 -77
- data/ext/v8/upstream/scons/engine/SCons/Tool/midl.py +0 -90
- data/ext/v8/upstream/scons/engine/SCons/Tool/mingw.py +0 -159
- data/ext/v8/upstream/scons/engine/SCons/Tool/mslib.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/mslink.py +0 -266
- data/ext/v8/upstream/scons/engine/SCons/Tool/mssdk.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Tool/msvc.py +0 -269
- data/ext/v8/upstream/scons/engine/SCons/Tool/msvs.py +0 -1439
- data/ext/v8/upstream/scons/engine/SCons/Tool/mwcc.py +0 -208
- data/ext/v8/upstream/scons/engine/SCons/Tool/mwld.py +0 -107
- data/ext/v8/upstream/scons/engine/SCons/Tool/nasm.py +0 -72
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/__init__.py +0 -314
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/ipk.py +0 -185
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/msi.py +0 -526
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/rpm.py +0 -367
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_tarbz2.py +0 -43
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_targz.py +0 -43
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_zip.py +0 -43
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/tarbz2.py +0 -44
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/targz.py +0 -44
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/zip.py +0 -44
- data/ext/v8/upstream/scons/engine/SCons/Tool/pdf.py +0 -78
- data/ext/v8/upstream/scons/engine/SCons/Tool/pdflatex.py +0 -83
- data/ext/v8/upstream/scons/engine/SCons/Tool/pdftex.py +0 -108
- data/ext/v8/upstream/scons/engine/SCons/Tool/qt.py +0 -336
- data/ext/v8/upstream/scons/engine/SCons/Tool/rmic.py +0 -121
- data/ext/v8/upstream/scons/engine/SCons/Tool/rpcgen.py +0 -70
- data/ext/v8/upstream/scons/engine/SCons/Tool/rpm.py +0 -132
- data/ext/v8/upstream/scons/engine/SCons/Tool/sgiar.py +0 -68
- data/ext/v8/upstream/scons/engine/SCons/Tool/sgic++.py +0 -58
- data/ext/v8/upstream/scons/engine/SCons/Tool/sgicc.py +0 -53
- data/ext/v8/upstream/scons/engine/SCons/Tool/sgilink.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunar.py +0 -67
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunc++.py +0 -142
- data/ext/v8/upstream/scons/engine/SCons/Tool/suncc.py +0 -58
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunf77.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunf90.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunf95.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunlink.py +0 -77
- data/ext/v8/upstream/scons/engine/SCons/Tool/swig.py +0 -186
- data/ext/v8/upstream/scons/engine/SCons/Tool/tar.py +0 -73
- data/ext/v8/upstream/scons/engine/SCons/Tool/tex.py +0 -805
- data/ext/v8/upstream/scons/engine/SCons/Tool/textfile.py +0 -175
- data/ext/v8/upstream/scons/engine/SCons/Tool/tlib.py +0 -53
- data/ext/v8/upstream/scons/engine/SCons/Tool/wix.py +0 -100
- data/ext/v8/upstream/scons/engine/SCons/Tool/yacc.py +0 -131
- data/ext/v8/upstream/scons/engine/SCons/Tool/zip.py +0 -100
- data/ext/v8/upstream/scons/engine/SCons/Util.py +0 -1645
- data/ext/v8/upstream/scons/engine/SCons/Variables/BoolVariable.py +0 -91
- data/ext/v8/upstream/scons/engine/SCons/Variables/EnumVariable.py +0 -107
- data/ext/v8/upstream/scons/engine/SCons/Variables/ListVariable.py +0 -139
- data/ext/v8/upstream/scons/engine/SCons/Variables/PackageVariable.py +0 -109
- data/ext/v8/upstream/scons/engine/SCons/Variables/PathVariable.py +0 -147
- data/ext/v8/upstream/scons/engine/SCons/Variables/__init__.py +0 -317
- data/ext/v8/upstream/scons/engine/SCons/Warnings.py +0 -228
- data/ext/v8/upstream/scons/engine/SCons/__init__.py +0 -49
- data/ext/v8/upstream/scons/engine/SCons/compat/__init__.py +0 -302
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_UserString.py +0 -98
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_hashlib.py +0 -91
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_itertools.py +0 -124
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_optparse.py +0 -1725
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets.py +0 -583
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets15.py +0 -176
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_shlex.py +0 -325
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_subprocess.py +0 -1296
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_textwrap.py +0 -382
- data/ext/v8/upstream/scons/engine/SCons/compat/builtins.py +0 -187
- data/ext/v8/upstream/scons/engine/SCons/cpp.py +0 -598
- data/ext/v8/upstream/scons/engine/SCons/dblite.py +0 -248
- data/ext/v8/upstream/scons/engine/SCons/exitfuncs.py +0 -77
- data/ext/v8/upstream/scons/os_spawnv_fix.diff +0 -83
- data/ext/v8/upstream/scons/scons-time.1 +0 -1017
- data/ext/v8/upstream/scons/scons.1 +0 -15179
- data/ext/v8/upstream/scons/sconsign.1 +0 -208
- data/ext/v8/upstream/scons/script/scons +0 -184
- data/ext/v8/upstream/scons/script/scons-time +0 -1529
- data/ext/v8/upstream/scons/script/scons.bat +0 -31
- data/ext/v8/upstream/scons/script/sconsign +0 -508
- data/ext/v8/upstream/scons/setup.cfg +0 -6
- data/ext/v8/upstream/scons/setup.py +0 -427
- data/ext/v8/v8.cpp +0 -89
- data/ext/v8/v8_cxt.cpp +0 -92
- data/ext/v8/v8_cxt.h +0 -20
- data/ext/v8/v8_func.cpp +0 -10
- data/ext/v8/v8_func.h +0 -11
- data/ext/v8/v8_msg.cpp +0 -54
- data/ext/v8/v8_msg.h +0 -18
- data/ext/v8/v8_obj.cpp +0 -52
- data/ext/v8/v8_obj.h +0 -13
- data/ext/v8/v8_ref.cpp +0 -26
- data/ext/v8/v8_ref.h +0 -31
- data/ext/v8/v8_script.cpp +0 -20
- data/ext/v8/v8_script.h +0 -8
- data/ext/v8/v8_standalone.cpp +0 -69
- data/ext/v8/v8_standalone.h +0 -31
- data/ext/v8/v8_str.cpp +0 -17
- data/ext/v8/v8_str.h +0 -9
- data/ext/v8/v8_template.cpp +0 -53
- data/ext/v8/v8_template.h +0 -13
- data/lib/v8/to.rb +0 -33
- data/lib/v8/v8.so +0 -0
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/ext/cxt_spec.rb +0 -25
- data/spec/ext/obj_spec.rb +0 -13
- data/spec/redjs/jsapi_spec.rb +0 -405
- data/spec/redjs/tap.rb +0 -8
- data/spec/redjs_helper.rb +0 -3
- data/spec/spec.opts +0 -1
- data/spec/v8/to_spec.rb +0 -15
- data/tasks/rspec.rake +0 -21
@@ -1,100 +0,0 @@
|
|
1
|
-
"""SCons.Tool.zip
|
2
|
-
|
3
|
-
Tool-specific initialization for zip.
|
4
|
-
|
5
|
-
There normally shouldn't be any need to import this module directly.
|
6
|
-
It will usually be imported through the generic SCons.Tool.Tool()
|
7
|
-
selection method.
|
8
|
-
|
9
|
-
"""
|
10
|
-
|
11
|
-
#
|
12
|
-
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
|
13
|
-
#
|
14
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
15
|
-
# a copy of this software and associated documentation files (the
|
16
|
-
# "Software"), to deal in the Software without restriction, including
|
17
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
18
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
19
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
20
|
-
# the following conditions:
|
21
|
-
#
|
22
|
-
# The above copyright notice and this permission notice shall be included
|
23
|
-
# in all copies or substantial portions of the Software.
|
24
|
-
#
|
25
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
26
|
-
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
27
|
-
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
28
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
29
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
30
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
31
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
32
|
-
#
|
33
|
-
|
34
|
-
__revision__ = "src/engine/SCons/Tool/zip.py 4629 2010/01/17 22:23:21 scons"
|
35
|
-
|
36
|
-
import os.path
|
37
|
-
|
38
|
-
import SCons.Builder
|
39
|
-
import SCons.Defaults
|
40
|
-
import SCons.Node.FS
|
41
|
-
import SCons.Util
|
42
|
-
|
43
|
-
try:
|
44
|
-
import zipfile
|
45
|
-
internal_zip = 1
|
46
|
-
except ImportError:
|
47
|
-
internal_zip = 0
|
48
|
-
|
49
|
-
if internal_zip:
|
50
|
-
zipcompression = zipfile.ZIP_DEFLATED
|
51
|
-
def zip(target, source, env):
|
52
|
-
def visit(arg, dirname, names):
|
53
|
-
for name in names:
|
54
|
-
path = os.path.join(dirname, name)
|
55
|
-
if os.path.isfile(path):
|
56
|
-
arg.write(path)
|
57
|
-
compression = env.get('ZIPCOMPRESSION', 0)
|
58
|
-
zf = zipfile.ZipFile(str(target[0]), 'w', compression)
|
59
|
-
for s in source:
|
60
|
-
if s.isdir():
|
61
|
-
os.path.walk(str(s), visit, zf)
|
62
|
-
else:
|
63
|
-
zf.write(str(s))
|
64
|
-
zf.close()
|
65
|
-
else:
|
66
|
-
zipcompression = 0
|
67
|
-
zip = "$ZIP $ZIPFLAGS ${TARGET.abspath} $SOURCES"
|
68
|
-
|
69
|
-
|
70
|
-
zipAction = SCons.Action.Action(zip, varlist=['ZIPCOMPRESSION'])
|
71
|
-
|
72
|
-
ZipBuilder = SCons.Builder.Builder(action = SCons.Action.Action('$ZIPCOM', '$ZIPCOMSTR'),
|
73
|
-
source_factory = SCons.Node.FS.Entry,
|
74
|
-
source_scanner = SCons.Defaults.DirScanner,
|
75
|
-
suffix = '$ZIPSUFFIX',
|
76
|
-
multi = 1)
|
77
|
-
|
78
|
-
|
79
|
-
def generate(env):
|
80
|
-
"""Add Builders and construction variables for zip to an Environment."""
|
81
|
-
try:
|
82
|
-
bld = env['BUILDERS']['Zip']
|
83
|
-
except KeyError:
|
84
|
-
bld = ZipBuilder
|
85
|
-
env['BUILDERS']['Zip'] = bld
|
86
|
-
|
87
|
-
env['ZIP'] = 'zip'
|
88
|
-
env['ZIPFLAGS'] = SCons.Util.CLVar('')
|
89
|
-
env['ZIPCOM'] = zipAction
|
90
|
-
env['ZIPCOMPRESSION'] = zipcompression
|
91
|
-
env['ZIPSUFFIX'] = '.zip'
|
92
|
-
|
93
|
-
def exists(env):
|
94
|
-
return internal_zip or env.Detect('zip')
|
95
|
-
|
96
|
-
# Local Variables:
|
97
|
-
# tab-width:4
|
98
|
-
# indent-tabs-mode:nil
|
99
|
-
# End:
|
100
|
-
# vim: set expandtab tabstop=4 shiftwidth=4:
|
@@ -1,1645 +0,0 @@
|
|
1
|
-
"""SCons.Util
|
2
|
-
|
3
|
-
Various utility functions go here.
|
4
|
-
|
5
|
-
"""
|
6
|
-
|
7
|
-
#
|
8
|
-
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
|
9
|
-
#
|
10
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
11
|
-
# a copy of this software and associated documentation files (the
|
12
|
-
# "Software"), to deal in the Software without restriction, including
|
13
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
14
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
15
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
16
|
-
# the following conditions:
|
17
|
-
#
|
18
|
-
# The above copyright notice and this permission notice shall be included
|
19
|
-
# in all copies or substantial portions of the Software.
|
20
|
-
#
|
21
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
22
|
-
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
23
|
-
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
24
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
25
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
26
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
27
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
28
|
-
#
|
29
|
-
|
30
|
-
__revision__ = "src/engine/SCons/Util.py 4629 2010/01/17 22:23:21 scons"
|
31
|
-
|
32
|
-
import copy
|
33
|
-
import os
|
34
|
-
import os.path
|
35
|
-
import re
|
36
|
-
import string
|
37
|
-
import sys
|
38
|
-
import types
|
39
|
-
|
40
|
-
from UserDict import UserDict
|
41
|
-
from UserList import UserList
|
42
|
-
from UserString import UserString
|
43
|
-
|
44
|
-
# Don't "from types import ..." these because we need to get at the
|
45
|
-
# types module later to look for UnicodeType.
|
46
|
-
DictType = types.DictType
|
47
|
-
InstanceType = types.InstanceType
|
48
|
-
ListType = types.ListType
|
49
|
-
StringType = types.StringType
|
50
|
-
TupleType = types.TupleType
|
51
|
-
|
52
|
-
def dictify(keys, values, result={}):
|
53
|
-
for k, v in zip(keys, values):
|
54
|
-
result[k] = v
|
55
|
-
return result
|
56
|
-
|
57
|
-
_altsep = os.altsep
|
58
|
-
if _altsep is None and sys.platform == 'win32':
|
59
|
-
# My ActivePython 2.0.1 doesn't set os.altsep! What gives?
|
60
|
-
_altsep = '/'
|
61
|
-
if _altsep:
|
62
|
-
def rightmost_separator(path, sep, _altsep=_altsep):
|
63
|
-
rfind = string.rfind
|
64
|
-
return max(rfind(path, sep), rfind(path, _altsep))
|
65
|
-
else:
|
66
|
-
rightmost_separator = string.rfind
|
67
|
-
|
68
|
-
# First two from the Python Cookbook, just for completeness.
|
69
|
-
# (Yeah, yeah, YAGNI...)
|
70
|
-
def containsAny(str, set):
|
71
|
-
"""Check whether sequence str contains ANY of the items in set."""
|
72
|
-
for c in set:
|
73
|
-
if c in str: return 1
|
74
|
-
return 0
|
75
|
-
|
76
|
-
def containsAll(str, set):
|
77
|
-
"""Check whether sequence str contains ALL of the items in set."""
|
78
|
-
for c in set:
|
79
|
-
if c not in str: return 0
|
80
|
-
return 1
|
81
|
-
|
82
|
-
def containsOnly(str, set):
|
83
|
-
"""Check whether sequence str contains ONLY items in set."""
|
84
|
-
for c in str:
|
85
|
-
if c not in set: return 0
|
86
|
-
return 1
|
87
|
-
|
88
|
-
def splitext(path):
|
89
|
-
"Same as os.path.splitext() but faster."
|
90
|
-
sep = rightmost_separator(path, os.sep)
|
91
|
-
dot = string.rfind(path, '.')
|
92
|
-
# An ext is only real if it has at least one non-digit char
|
93
|
-
if dot > sep and not containsOnly(path[dot:], "0123456789."):
|
94
|
-
return path[:dot],path[dot:]
|
95
|
-
else:
|
96
|
-
return path,""
|
97
|
-
|
98
|
-
def updrive(path):
|
99
|
-
"""
|
100
|
-
Make the drive letter (if any) upper case.
|
101
|
-
This is useful because Windows is inconsitent on the case
|
102
|
-
of the drive letter, which can cause inconsistencies when
|
103
|
-
calculating command signatures.
|
104
|
-
"""
|
105
|
-
drive, rest = os.path.splitdrive(path)
|
106
|
-
if drive:
|
107
|
-
path = string.upper(drive) + rest
|
108
|
-
return path
|
109
|
-
|
110
|
-
class NodeList(UserList):
|
111
|
-
"""This class is almost exactly like a regular list of Nodes
|
112
|
-
(actually it can hold any object), with one important difference.
|
113
|
-
If you try to get an attribute from this list, it will return that
|
114
|
-
attribute from every item in the list. For example:
|
115
|
-
|
116
|
-
>>> someList = NodeList([ ' foo ', ' bar ' ])
|
117
|
-
>>> someList.strip()
|
118
|
-
[ 'foo', 'bar' ]
|
119
|
-
"""
|
120
|
-
def __nonzero__(self):
|
121
|
-
return len(self.data) != 0
|
122
|
-
|
123
|
-
def __str__(self):
|
124
|
-
return string.join(map(str, self.data))
|
125
|
-
|
126
|
-
def __iter__(self):
|
127
|
-
return iter(self.data)
|
128
|
-
|
129
|
-
def __call__(self, *args, **kwargs):
|
130
|
-
result = map(lambda x, args=args, kwargs=kwargs: apply(x,
|
131
|
-
args,
|
132
|
-
kwargs),
|
133
|
-
self.data)
|
134
|
-
return self.__class__(result)
|
135
|
-
|
136
|
-
def __getattr__(self, name):
|
137
|
-
result = map(lambda x, n=name: getattr(x, n), self.data)
|
138
|
-
return self.__class__(result)
|
139
|
-
|
140
|
-
|
141
|
-
_get_env_var = re.compile(r'^\$([_a-zA-Z]\w*|{[_a-zA-Z]\w*})$')
|
142
|
-
|
143
|
-
def get_environment_var(varstr):
|
144
|
-
"""Given a string, first determine if it looks like a reference
|
145
|
-
to a single environment variable, like "$FOO" or "${FOO}".
|
146
|
-
If so, return that variable with no decorations ("FOO").
|
147
|
-
If not, return None."""
|
148
|
-
mo=_get_env_var.match(to_String(varstr))
|
149
|
-
if mo:
|
150
|
-
var = mo.group(1)
|
151
|
-
if var[0] == '{':
|
152
|
-
return var[1:-1]
|
153
|
-
else:
|
154
|
-
return var
|
155
|
-
else:
|
156
|
-
return None
|
157
|
-
|
158
|
-
class DisplayEngine:
|
159
|
-
def __init__(self):
|
160
|
-
self.__call__ = self.print_it
|
161
|
-
|
162
|
-
def print_it(self, text, append_newline=1):
|
163
|
-
if append_newline: text = text + '\n'
|
164
|
-
try:
|
165
|
-
sys.stdout.write(text)
|
166
|
-
except IOError:
|
167
|
-
# Stdout might be connected to a pipe that has been closed
|
168
|
-
# by now. The most likely reason for the pipe being closed
|
169
|
-
# is that the user has press ctrl-c. It this is the case,
|
170
|
-
# then SCons is currently shutdown. We therefore ignore
|
171
|
-
# IOError's here so that SCons can continue and shutdown
|
172
|
-
# properly so that the .sconsign is correctly written
|
173
|
-
# before SCons exits.
|
174
|
-
pass
|
175
|
-
|
176
|
-
def dont_print(self, text, append_newline=1):
|
177
|
-
pass
|
178
|
-
|
179
|
-
def set_mode(self, mode):
|
180
|
-
if mode:
|
181
|
-
self.__call__ = self.print_it
|
182
|
-
else:
|
183
|
-
self.__call__ = self.dont_print
|
184
|
-
|
185
|
-
def render_tree(root, child_func, prune=0, margin=[0], visited={}):
|
186
|
-
"""
|
187
|
-
Render a tree of nodes into an ASCII tree view.
|
188
|
-
root - the root node of the tree
|
189
|
-
child_func - the function called to get the children of a node
|
190
|
-
prune - don't visit the same node twice
|
191
|
-
margin - the format of the left margin to use for children of root.
|
192
|
-
1 results in a pipe, and 0 results in no pipe.
|
193
|
-
visited - a dictionary of visited nodes in the current branch if not prune,
|
194
|
-
or in the whole tree if prune.
|
195
|
-
"""
|
196
|
-
|
197
|
-
rname = str(root)
|
198
|
-
|
199
|
-
children = child_func(root)
|
200
|
-
retval = ""
|
201
|
-
for pipe in margin[:-1]:
|
202
|
-
if pipe:
|
203
|
-
retval = retval + "| "
|
204
|
-
else:
|
205
|
-
retval = retval + " "
|
206
|
-
|
207
|
-
if visited.has_key(rname):
|
208
|
-
return retval + "+-[" + rname + "]\n"
|
209
|
-
|
210
|
-
retval = retval + "+-" + rname + "\n"
|
211
|
-
if not prune:
|
212
|
-
visited = copy.copy(visited)
|
213
|
-
visited[rname] = 1
|
214
|
-
|
215
|
-
for i in range(len(children)):
|
216
|
-
margin.append(i<len(children)-1)
|
217
|
-
retval = retval + render_tree(children[i], child_func, prune, margin, visited
|
218
|
-
)
|
219
|
-
margin.pop()
|
220
|
-
|
221
|
-
return retval
|
222
|
-
|
223
|
-
IDX = lambda N: N and 1 or 0
|
224
|
-
|
225
|
-
def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited={}):
|
226
|
-
"""
|
227
|
-
Print a tree of nodes. This is like render_tree, except it prints
|
228
|
-
lines directly instead of creating a string representation in memory,
|
229
|
-
so that huge trees can be printed.
|
230
|
-
|
231
|
-
root - the root node of the tree
|
232
|
-
child_func - the function called to get the children of a node
|
233
|
-
prune - don't visit the same node twice
|
234
|
-
showtags - print status information to the left of each node line
|
235
|
-
margin - the format of the left margin to use for children of root.
|
236
|
-
1 results in a pipe, and 0 results in no pipe.
|
237
|
-
visited - a dictionary of visited nodes in the current branch if not prune,
|
238
|
-
or in the whole tree if prune.
|
239
|
-
"""
|
240
|
-
|
241
|
-
rname = str(root)
|
242
|
-
|
243
|
-
if showtags:
|
244
|
-
|
245
|
-
if showtags == 2:
|
246
|
-
print ' E = exists'
|
247
|
-
print ' R = exists in repository only'
|
248
|
-
print ' b = implicit builder'
|
249
|
-
print ' B = explicit builder'
|
250
|
-
print ' S = side effect'
|
251
|
-
print ' P = precious'
|
252
|
-
print ' A = always build'
|
253
|
-
print ' C = current'
|
254
|
-
print ' N = no clean'
|
255
|
-
print ' H = no cache'
|
256
|
-
print ''
|
257
|
-
|
258
|
-
tags = ['[']
|
259
|
-
tags.append(' E'[IDX(root.exists())])
|
260
|
-
tags.append(' R'[IDX(root.rexists() and not root.exists())])
|
261
|
-
tags.append(' BbB'[[0,1][IDX(root.has_explicit_builder())] +
|
262
|
-
[0,2][IDX(root.has_builder())]])
|
263
|
-
tags.append(' S'[IDX(root.side_effect)])
|
264
|
-
tags.append(' P'[IDX(root.precious)])
|
265
|
-
tags.append(' A'[IDX(root.always_build)])
|
266
|
-
tags.append(' C'[IDX(root.is_up_to_date())])
|
267
|
-
tags.append(' N'[IDX(root.noclean)])
|
268
|
-
tags.append(' H'[IDX(root.nocache)])
|
269
|
-
tags.append(']')
|
270
|
-
|
271
|
-
else:
|
272
|
-
tags = []
|
273
|
-
|
274
|
-
def MMM(m):
|
275
|
-
return [" ","| "][m]
|
276
|
-
margins = map(MMM, margin[:-1])
|
277
|
-
|
278
|
-
children = child_func(root)
|
279
|
-
|
280
|
-
if prune and visited.has_key(rname) and children:
|
281
|
-
print string.join(tags + margins + ['+-[', rname, ']'], '')
|
282
|
-
return
|
283
|
-
|
284
|
-
print string.join(tags + margins + ['+-', rname], '')
|
285
|
-
|
286
|
-
visited[rname] = 1
|
287
|
-
|
288
|
-
if children:
|
289
|
-
margin.append(1)
|
290
|
-
idx = IDX(showtags)
|
291
|
-
for C in children[:-1]:
|
292
|
-
print_tree(C, child_func, prune, idx, margin, visited)
|
293
|
-
margin[-1] = 0
|
294
|
-
print_tree(children[-1], child_func, prune, idx, margin, visited)
|
295
|
-
margin.pop()
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
# Functions for deciding if things are like various types, mainly to
|
300
|
-
# handle UserDict, UserList and UserString like their underlying types.
|
301
|
-
#
|
302
|
-
# Yes, all of this manual testing breaks polymorphism, and the real
|
303
|
-
# Pythonic way to do all of this would be to just try it and handle the
|
304
|
-
# exception, but handling the exception when it's not the right type is
|
305
|
-
# often too slow.
|
306
|
-
|
307
|
-
try:
|
308
|
-
class mystr(str):
|
309
|
-
pass
|
310
|
-
except TypeError:
|
311
|
-
# An older Python version without new-style classes.
|
312
|
-
#
|
313
|
-
# The actual implementations here have been selected after timings
|
314
|
-
# coded up in in bench/is_types.py (from the SCons source tree,
|
315
|
-
# see the scons-src distribution), mostly against Python 1.5.2.
|
316
|
-
# Key results from those timings:
|
317
|
-
#
|
318
|
-
# -- Storing the type of the object in a variable (t = type(obj))
|
319
|
-
# slows down the case where it's a native type and the first
|
320
|
-
# comparison will match, but nicely speeds up the case where
|
321
|
-
# it's a different native type. Since that's going to be
|
322
|
-
# common, it's a good tradeoff.
|
323
|
-
#
|
324
|
-
# -- The data show that calling isinstance() on an object that's
|
325
|
-
# a native type (dict, list or string) is expensive enough
|
326
|
-
# that checking up front for whether the object is of type
|
327
|
-
# InstanceType is a pretty big win, even though it does slow
|
328
|
-
# down the case where it really *is* an object instance a
|
329
|
-
# little bit.
|
330
|
-
def is_Dict(obj):
|
331
|
-
t = type(obj)
|
332
|
-
return t is DictType or \
|
333
|
-
(t is InstanceType and isinstance(obj, UserDict))
|
334
|
-
|
335
|
-
def is_List(obj):
|
336
|
-
t = type(obj)
|
337
|
-
return t is ListType \
|
338
|
-
or (t is InstanceType and isinstance(obj, UserList))
|
339
|
-
|
340
|
-
def is_Sequence(obj):
|
341
|
-
t = type(obj)
|
342
|
-
return t is ListType \
|
343
|
-
or t is TupleType \
|
344
|
-
or (t is InstanceType and isinstance(obj, UserList))
|
345
|
-
|
346
|
-
def is_Tuple(obj):
|
347
|
-
t = type(obj)
|
348
|
-
return t is TupleType
|
349
|
-
|
350
|
-
if hasattr(types, 'UnicodeType'):
|
351
|
-
def is_String(obj):
|
352
|
-
t = type(obj)
|
353
|
-
return t is StringType \
|
354
|
-
or t is UnicodeType \
|
355
|
-
or (t is InstanceType and isinstance(obj, UserString))
|
356
|
-
else:
|
357
|
-
def is_String(obj):
|
358
|
-
t = type(obj)
|
359
|
-
return t is StringType \
|
360
|
-
or (t is InstanceType and isinstance(obj, UserString))
|
361
|
-
|
362
|
-
def is_Scalar(obj):
|
363
|
-
return is_String(obj) or not is_Sequence(obj)
|
364
|
-
|
365
|
-
def flatten(obj, result=None):
|
366
|
-
"""Flatten a sequence to a non-nested list.
|
367
|
-
|
368
|
-
Flatten() converts either a single scalar or a nested sequence
|
369
|
-
to a non-nested list. Note that flatten() considers strings
|
370
|
-
to be scalars instead of sequences like Python would.
|
371
|
-
"""
|
372
|
-
if is_Scalar(obj):
|
373
|
-
return [obj]
|
374
|
-
if result is None:
|
375
|
-
result = []
|
376
|
-
for item in obj:
|
377
|
-
if is_Scalar(item):
|
378
|
-
result.append(item)
|
379
|
-
else:
|
380
|
-
flatten_sequence(item, result)
|
381
|
-
return result
|
382
|
-
|
383
|
-
def flatten_sequence(sequence, result=None):
|
384
|
-
"""Flatten a sequence to a non-nested list.
|
385
|
-
|
386
|
-
Same as flatten(), but it does not handle the single scalar
|
387
|
-
case. This is slightly more efficient when one knows that
|
388
|
-
the sequence to flatten can not be a scalar.
|
389
|
-
"""
|
390
|
-
if result is None:
|
391
|
-
result = []
|
392
|
-
for item in sequence:
|
393
|
-
if is_Scalar(item):
|
394
|
-
result.append(item)
|
395
|
-
else:
|
396
|
-
flatten_sequence(item, result)
|
397
|
-
return result
|
398
|
-
|
399
|
-
#
|
400
|
-
# Generic convert-to-string functions that abstract away whether or
|
401
|
-
# not the Python we're executing has Unicode support. The wrapper
|
402
|
-
# to_String_for_signature() will use a for_signature() method if the
|
403
|
-
# specified object has one.
|
404
|
-
#
|
405
|
-
if hasattr(types, 'UnicodeType'):
|
406
|
-
UnicodeType = types.UnicodeType
|
407
|
-
def to_String(s):
|
408
|
-
if isinstance(s, UserString):
|
409
|
-
t = type(s.data)
|
410
|
-
else:
|
411
|
-
t = type(s)
|
412
|
-
if t is UnicodeType:
|
413
|
-
return unicode(s)
|
414
|
-
else:
|
415
|
-
return str(s)
|
416
|
-
else:
|
417
|
-
to_String = str
|
418
|
-
|
419
|
-
def to_String_for_signature(obj):
|
420
|
-
try:
|
421
|
-
f = obj.for_signature
|
422
|
-
except AttributeError:
|
423
|
-
return to_String_for_subst(obj)
|
424
|
-
else:
|
425
|
-
return f()
|
426
|
-
|
427
|
-
def to_String_for_subst(s):
|
428
|
-
if is_Sequence( s ):
|
429
|
-
return string.join( map(to_String_for_subst, s) )
|
430
|
-
|
431
|
-
return to_String( s )
|
432
|
-
|
433
|
-
else:
|
434
|
-
# A modern Python version with new-style classes, so we can just use
|
435
|
-
# isinstance().
|
436
|
-
#
|
437
|
-
# We are using the following trick to speed-up these
|
438
|
-
# functions. Default arguments are used to take a snapshot of the
|
439
|
-
# the global functions and constants used by these functions. This
|
440
|
-
# transforms accesses to global variable into local variables
|
441
|
-
# accesses (i.e. LOAD_FAST instead of LOAD_GLOBAL).
|
442
|
-
|
443
|
-
DictTypes = (dict, UserDict)
|
444
|
-
ListTypes = (list, UserList)
|
445
|
-
SequenceTypes = (list, tuple, UserList)
|
446
|
-
|
447
|
-
# Empirically, Python versions with new-style classes all have
|
448
|
-
# unicode.
|
449
|
-
#
|
450
|
-
# Note that profiling data shows a speed-up when comparing
|
451
|
-
# explicitely with str and unicode instead of simply comparing
|
452
|
-
# with basestring. (at least on Python 2.5.1)
|
453
|
-
StringTypes = (str, unicode, UserString)
|
454
|
-
|
455
|
-
# Empirically, it is faster to check explicitely for str and
|
456
|
-
# unicode than for basestring.
|
457
|
-
BaseStringTypes = (str, unicode)
|
458
|
-
|
459
|
-
def is_Dict(obj, isinstance=isinstance, DictTypes=DictTypes):
|
460
|
-
return isinstance(obj, DictTypes)
|
461
|
-
|
462
|
-
def is_List(obj, isinstance=isinstance, ListTypes=ListTypes):
|
463
|
-
return isinstance(obj, ListTypes)
|
464
|
-
|
465
|
-
def is_Sequence(obj, isinstance=isinstance, SequenceTypes=SequenceTypes):
|
466
|
-
return isinstance(obj, SequenceTypes)
|
467
|
-
|
468
|
-
def is_Tuple(obj, isinstance=isinstance, tuple=tuple):
|
469
|
-
return isinstance(obj, tuple)
|
470
|
-
|
471
|
-
def is_String(obj, isinstance=isinstance, StringTypes=StringTypes):
|
472
|
-
return isinstance(obj, StringTypes)
|
473
|
-
|
474
|
-
def is_Scalar(obj, isinstance=isinstance, StringTypes=StringTypes, SequenceTypes=SequenceTypes):
|
475
|
-
# Profiling shows that there is an impressive speed-up of 2x
|
476
|
-
# when explicitely checking for strings instead of just not
|
477
|
-
# sequence when the argument (i.e. obj) is already a string.
|
478
|
-
# But, if obj is a not string than it is twice as fast to
|
479
|
-
# check only for 'not sequence'. The following code therefore
|
480
|
-
# assumes that the obj argument is a string must of the time.
|
481
|
-
return isinstance(obj, StringTypes) or not isinstance(obj, SequenceTypes)
|
482
|
-
|
483
|
-
def do_flatten(sequence, result, isinstance=isinstance,
|
484
|
-
StringTypes=StringTypes, SequenceTypes=SequenceTypes):
|
485
|
-
for item in sequence:
|
486
|
-
if isinstance(item, StringTypes) or not isinstance(item, SequenceTypes):
|
487
|
-
result.append(item)
|
488
|
-
else:
|
489
|
-
do_flatten(item, result)
|
490
|
-
|
491
|
-
def flatten(obj, isinstance=isinstance, StringTypes=StringTypes,
|
492
|
-
SequenceTypes=SequenceTypes, do_flatten=do_flatten):
|
493
|
-
"""Flatten a sequence to a non-nested list.
|
494
|
-
|
495
|
-
Flatten() converts either a single scalar or a nested sequence
|
496
|
-
to a non-nested list. Note that flatten() considers strings
|
497
|
-
to be scalars instead of sequences like Python would.
|
498
|
-
"""
|
499
|
-
if isinstance(obj, StringTypes) or not isinstance(obj, SequenceTypes):
|
500
|
-
return [obj]
|
501
|
-
result = []
|
502
|
-
for item in obj:
|
503
|
-
if isinstance(item, StringTypes) or not isinstance(item, SequenceTypes):
|
504
|
-
result.append(item)
|
505
|
-
else:
|
506
|
-
do_flatten(item, result)
|
507
|
-
return result
|
508
|
-
|
509
|
-
def flatten_sequence(sequence, isinstance=isinstance, StringTypes=StringTypes,
|
510
|
-
SequenceTypes=SequenceTypes, do_flatten=do_flatten):
|
511
|
-
"""Flatten a sequence to a non-nested list.
|
512
|
-
|
513
|
-
Same as flatten(), but it does not handle the single scalar
|
514
|
-
case. This is slightly more efficient when one knows that
|
515
|
-
the sequence to flatten can not be a scalar.
|
516
|
-
"""
|
517
|
-
result = []
|
518
|
-
for item in sequence:
|
519
|
-
if isinstance(item, StringTypes) or not isinstance(item, SequenceTypes):
|
520
|
-
result.append(item)
|
521
|
-
else:
|
522
|
-
do_flatten(item, result)
|
523
|
-
return result
|
524
|
-
|
525
|
-
|
526
|
-
#
|
527
|
-
# Generic convert-to-string functions that abstract away whether or
|
528
|
-
# not the Python we're executing has Unicode support. The wrapper
|
529
|
-
# to_String_for_signature() will use a for_signature() method if the
|
530
|
-
# specified object has one.
|
531
|
-
#
|
532
|
-
def to_String(s,
|
533
|
-
isinstance=isinstance, str=str,
|
534
|
-
UserString=UserString, BaseStringTypes=BaseStringTypes):
|
535
|
-
if isinstance(s,BaseStringTypes):
|
536
|
-
# Early out when already a string!
|
537
|
-
return s
|
538
|
-
elif isinstance(s, UserString):
|
539
|
-
# s.data can only be either a unicode or a regular
|
540
|
-
# string. Please see the UserString initializer.
|
541
|
-
return s.data
|
542
|
-
else:
|
543
|
-
return str(s)
|
544
|
-
|
545
|
-
def to_String_for_subst(s,
|
546
|
-
isinstance=isinstance, join=string.join, str=str, to_String=to_String,
|
547
|
-
BaseStringTypes=BaseStringTypes, SequenceTypes=SequenceTypes,
|
548
|
-
UserString=UserString):
|
549
|
-
|
550
|
-
# Note that the test cases are sorted by order of probability.
|
551
|
-
if isinstance(s, BaseStringTypes):
|
552
|
-
return s
|
553
|
-
elif isinstance(s, SequenceTypes):
|
554
|
-
l = []
|
555
|
-
for e in s:
|
556
|
-
l.append(to_String_for_subst(e))
|
557
|
-
return join( s )
|
558
|
-
elif isinstance(s, UserString):
|
559
|
-
# s.data can only be either a unicode or a regular
|
560
|
-
# string. Please see the UserString initializer.
|
561
|
-
return s.data
|
562
|
-
else:
|
563
|
-
return str(s)
|
564
|
-
|
565
|
-
def to_String_for_signature(obj, to_String_for_subst=to_String_for_subst,
|
566
|
-
AttributeError=AttributeError):
|
567
|
-
try:
|
568
|
-
f = obj.for_signature
|
569
|
-
except AttributeError:
|
570
|
-
return to_String_for_subst(obj)
|
571
|
-
else:
|
572
|
-
return f()
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
# The SCons "semi-deep" copy.
|
577
|
-
#
|
578
|
-
# This makes separate copies of lists (including UserList objects)
|
579
|
-
# dictionaries (including UserDict objects) and tuples, but just copies
|
580
|
-
# references to anything else it finds.
|
581
|
-
#
|
582
|
-
# A special case is any object that has a __semi_deepcopy__() method,
|
583
|
-
# which we invoke to create the copy, which is used by the BuilderDict
|
584
|
-
# class because of its extra initialization argument.
|
585
|
-
#
|
586
|
-
# The dispatch table approach used here is a direct rip-off from the
|
587
|
-
# normal Python copy module.
|
588
|
-
|
589
|
-
_semi_deepcopy_dispatch = d = {}
|
590
|
-
|
591
|
-
def _semi_deepcopy_dict(x):
|
592
|
-
copy = {}
|
593
|
-
for key, val in x.items():
|
594
|
-
# The regular Python copy.deepcopy() also deepcopies the key,
|
595
|
-
# as follows:
|
596
|
-
#
|
597
|
-
# copy[semi_deepcopy(key)] = semi_deepcopy(val)
|
598
|
-
#
|
599
|
-
# Doesn't seem like we need to, but we'll comment it just in case.
|
600
|
-
copy[key] = semi_deepcopy(val)
|
601
|
-
return copy
|
602
|
-
d[types.DictionaryType] = _semi_deepcopy_dict
|
603
|
-
|
604
|
-
def _semi_deepcopy_list(x):
|
605
|
-
return map(semi_deepcopy, x)
|
606
|
-
d[types.ListType] = _semi_deepcopy_list
|
607
|
-
|
608
|
-
def _semi_deepcopy_tuple(x):
|
609
|
-
return tuple(map(semi_deepcopy, x))
|
610
|
-
d[types.TupleType] = _semi_deepcopy_tuple
|
611
|
-
|
612
|
-
def _semi_deepcopy_inst(x):
|
613
|
-
if hasattr(x, '__semi_deepcopy__'):
|
614
|
-
return x.__semi_deepcopy__()
|
615
|
-
elif isinstance(x, UserDict):
|
616
|
-
return x.__class__(_semi_deepcopy_dict(x))
|
617
|
-
elif isinstance(x, UserList):
|
618
|
-
return x.__class__(_semi_deepcopy_list(x))
|
619
|
-
else:
|
620
|
-
return x
|
621
|
-
d[types.InstanceType] = _semi_deepcopy_inst
|
622
|
-
|
623
|
-
def semi_deepcopy(x):
|
624
|
-
copier = _semi_deepcopy_dispatch.get(type(x))
|
625
|
-
if copier:
|
626
|
-
return copier(x)
|
627
|
-
else:
|
628
|
-
return x
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
class Proxy:
|
633
|
-
"""A simple generic Proxy class, forwarding all calls to
|
634
|
-
subject. So, for the benefit of the python newbie, what does
|
635
|
-
this really mean? Well, it means that you can take an object, let's
|
636
|
-
call it 'objA', and wrap it in this Proxy class, with a statement
|
637
|
-
like this
|
638
|
-
|
639
|
-
proxyObj = Proxy(objA),
|
640
|
-
|
641
|
-
Then, if in the future, you do something like this
|
642
|
-
|
643
|
-
x = proxyObj.var1,
|
644
|
-
|
645
|
-
since Proxy does not have a 'var1' attribute (but presumably objA does),
|
646
|
-
the request actually is equivalent to saying
|
647
|
-
|
648
|
-
x = objA.var1
|
649
|
-
|
650
|
-
Inherit from this class to create a Proxy."""
|
651
|
-
|
652
|
-
def __init__(self, subject):
|
653
|
-
"""Wrap an object as a Proxy object"""
|
654
|
-
self.__subject = subject
|
655
|
-
|
656
|
-
def __getattr__(self, name):
|
657
|
-
"""Retrieve an attribute from the wrapped object. If the named
|
658
|
-
attribute doesn't exist, AttributeError is raised"""
|
659
|
-
return getattr(self.__subject, name)
|
660
|
-
|
661
|
-
def get(self):
|
662
|
-
"""Retrieve the entire wrapped object"""
|
663
|
-
return self.__subject
|
664
|
-
|
665
|
-
def __cmp__(self, other):
|
666
|
-
if issubclass(other.__class__, self.__subject.__class__):
|
667
|
-
return cmp(self.__subject, other)
|
668
|
-
return cmp(self.__dict__, other.__dict__)
|
669
|
-
|
670
|
-
# attempt to load the windows registry module:
|
671
|
-
can_read_reg = 0
|
672
|
-
try:
|
673
|
-
import _winreg
|
674
|
-
|
675
|
-
can_read_reg = 1
|
676
|
-
hkey_mod = _winreg
|
677
|
-
|
678
|
-
RegOpenKeyEx = _winreg.OpenKeyEx
|
679
|
-
RegEnumKey = _winreg.EnumKey
|
680
|
-
RegEnumValue = _winreg.EnumValue
|
681
|
-
RegQueryValueEx = _winreg.QueryValueEx
|
682
|
-
RegError = _winreg.error
|
683
|
-
|
684
|
-
except ImportError:
|
685
|
-
try:
|
686
|
-
import win32api
|
687
|
-
import win32con
|
688
|
-
can_read_reg = 1
|
689
|
-
hkey_mod = win32con
|
690
|
-
|
691
|
-
RegOpenKeyEx = win32api.RegOpenKeyEx
|
692
|
-
RegEnumKey = win32api.RegEnumKey
|
693
|
-
RegEnumValue = win32api.RegEnumValue
|
694
|
-
RegQueryValueEx = win32api.RegQueryValueEx
|
695
|
-
RegError = win32api.error
|
696
|
-
|
697
|
-
except ImportError:
|
698
|
-
class _NoError(Exception):
|
699
|
-
pass
|
700
|
-
RegError = _NoError
|
701
|
-
|
702
|
-
if can_read_reg:
|
703
|
-
HKEY_CLASSES_ROOT = hkey_mod.HKEY_CLASSES_ROOT
|
704
|
-
HKEY_LOCAL_MACHINE = hkey_mod.HKEY_LOCAL_MACHINE
|
705
|
-
HKEY_CURRENT_USER = hkey_mod.HKEY_CURRENT_USER
|
706
|
-
HKEY_USERS = hkey_mod.HKEY_USERS
|
707
|
-
|
708
|
-
def RegGetValue(root, key):
|
709
|
-
"""This utility function returns a value in the registry
|
710
|
-
without having to open the key first. Only available on
|
711
|
-
Windows platforms with a version of Python that can read the
|
712
|
-
registry. Returns the same thing as
|
713
|
-
SCons.Util.RegQueryValueEx, except you just specify the entire
|
714
|
-
path to the value, and don't have to bother opening the key
|
715
|
-
first. So:
|
716
|
-
|
717
|
-
Instead of:
|
718
|
-
k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
|
719
|
-
r'SOFTWARE\Microsoft\Windows\CurrentVersion')
|
720
|
-
out = SCons.Util.RegQueryValueEx(k,
|
721
|
-
'ProgramFilesDir')
|
722
|
-
|
723
|
-
You can write:
|
724
|
-
out = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE,
|
725
|
-
r'SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir')
|
726
|
-
"""
|
727
|
-
# I would use os.path.split here, but it's not a filesystem
|
728
|
-
# path...
|
729
|
-
p = key.rfind('\\') + 1
|
730
|
-
keyp = key[:p-1] # -1 to omit trailing slash
|
731
|
-
val = key[p:]
|
732
|
-
k = RegOpenKeyEx(root, keyp)
|
733
|
-
return RegQueryValueEx(k,val)
|
734
|
-
else:
|
735
|
-
try:
|
736
|
-
e = WindowsError
|
737
|
-
except NameError:
|
738
|
-
# Make sure we have a definition of WindowsError so we can
|
739
|
-
# run platform-independent tests of Windows functionality on
|
740
|
-
# platforms other than Windows. (WindowsError is, in fact, an
|
741
|
-
# OSError subclass on Windows.)
|
742
|
-
class WindowsError(OSError):
|
743
|
-
pass
|
744
|
-
import __builtin__
|
745
|
-
__builtin__.WindowsError = WindowsError
|
746
|
-
else:
|
747
|
-
del e
|
748
|
-
|
749
|
-
HKEY_CLASSES_ROOT = None
|
750
|
-
HKEY_LOCAL_MACHINE = None
|
751
|
-
HKEY_CURRENT_USER = None
|
752
|
-
HKEY_USERS = None
|
753
|
-
|
754
|
-
def RegGetValue(root, key):
|
755
|
-
raise WindowsError
|
756
|
-
|
757
|
-
def RegOpenKeyEx(root, key):
|
758
|
-
raise WindowsError
|
759
|
-
|
760
|
-
if sys.platform == 'win32':
|
761
|
-
|
762
|
-
def WhereIs(file, path=None, pathext=None, reject=[]):
|
763
|
-
if path is None:
|
764
|
-
try:
|
765
|
-
path = os.environ['PATH']
|
766
|
-
except KeyError:
|
767
|
-
return None
|
768
|
-
if is_String(path):
|
769
|
-
path = string.split(path, os.pathsep)
|
770
|
-
if pathext is None:
|
771
|
-
try:
|
772
|
-
pathext = os.environ['PATHEXT']
|
773
|
-
except KeyError:
|
774
|
-
pathext = '.COM;.EXE;.BAT;.CMD'
|
775
|
-
if is_String(pathext):
|
776
|
-
pathext = string.split(pathext, os.pathsep)
|
777
|
-
for ext in pathext:
|
778
|
-
if string.lower(ext) == string.lower(file[-len(ext):]):
|
779
|
-
pathext = ['']
|
780
|
-
break
|
781
|
-
if not is_List(reject) and not is_Tuple(reject):
|
782
|
-
reject = [reject]
|
783
|
-
for dir in path:
|
784
|
-
f = os.path.join(dir, file)
|
785
|
-
for ext in pathext:
|
786
|
-
fext = f + ext
|
787
|
-
if os.path.isfile(fext):
|
788
|
-
try:
|
789
|
-
reject.index(fext)
|
790
|
-
except ValueError:
|
791
|
-
return os.path.normpath(fext)
|
792
|
-
continue
|
793
|
-
return None
|
794
|
-
|
795
|
-
elif os.name == 'os2':
|
796
|
-
|
797
|
-
def WhereIs(file, path=None, pathext=None, reject=[]):
|
798
|
-
if path is None:
|
799
|
-
try:
|
800
|
-
path = os.environ['PATH']
|
801
|
-
except KeyError:
|
802
|
-
return None
|
803
|
-
if is_String(path):
|
804
|
-
path = string.split(path, os.pathsep)
|
805
|
-
if pathext is None:
|
806
|
-
pathext = ['.exe', '.cmd']
|
807
|
-
for ext in pathext:
|
808
|
-
if string.lower(ext) == string.lower(file[-len(ext):]):
|
809
|
-
pathext = ['']
|
810
|
-
break
|
811
|
-
if not is_List(reject) and not is_Tuple(reject):
|
812
|
-
reject = [reject]
|
813
|
-
for dir in path:
|
814
|
-
f = os.path.join(dir, file)
|
815
|
-
for ext in pathext:
|
816
|
-
fext = f + ext
|
817
|
-
if os.path.isfile(fext):
|
818
|
-
try:
|
819
|
-
reject.index(fext)
|
820
|
-
except ValueError:
|
821
|
-
return os.path.normpath(fext)
|
822
|
-
continue
|
823
|
-
return None
|
824
|
-
|
825
|
-
else:
|
826
|
-
|
827
|
-
def WhereIs(file, path=None, pathext=None, reject=[]):
|
828
|
-
import stat
|
829
|
-
if path is None:
|
830
|
-
try:
|
831
|
-
path = os.environ['PATH']
|
832
|
-
except KeyError:
|
833
|
-
return None
|
834
|
-
if is_String(path):
|
835
|
-
path = string.split(path, os.pathsep)
|
836
|
-
if not is_List(reject) and not is_Tuple(reject):
|
837
|
-
reject = [reject]
|
838
|
-
for d in path:
|
839
|
-
f = os.path.join(d, file)
|
840
|
-
if os.path.isfile(f):
|
841
|
-
try:
|
842
|
-
st = os.stat(f)
|
843
|
-
except OSError:
|
844
|
-
# os.stat() raises OSError, not IOError if the file
|
845
|
-
# doesn't exist, so in this case we let IOError get
|
846
|
-
# raised so as to not mask possibly serious disk or
|
847
|
-
# network issues.
|
848
|
-
continue
|
849
|
-
if stat.S_IMODE(st[stat.ST_MODE]) & 0111:
|
850
|
-
try:
|
851
|
-
reject.index(f)
|
852
|
-
except ValueError:
|
853
|
-
return os.path.normpath(f)
|
854
|
-
continue
|
855
|
-
return None
|
856
|
-
|
857
|
-
def PrependPath(oldpath, newpath, sep = os.pathsep,
|
858
|
-
delete_existing=1, canonicalize=None):
|
859
|
-
"""This prepends newpath elements to the given oldpath. Will only
|
860
|
-
add any particular path once (leaving the first one it encounters
|
861
|
-
and ignoring the rest, to preserve path order), and will
|
862
|
-
os.path.normpath and os.path.normcase all paths to help assure
|
863
|
-
this. This can also handle the case where the given old path
|
864
|
-
variable is a list instead of a string, in which case a list will
|
865
|
-
be returned instead of a string.
|
866
|
-
|
867
|
-
Example:
|
868
|
-
Old Path: "/foo/bar:/foo"
|
869
|
-
New Path: "/biz/boom:/foo"
|
870
|
-
Result: "/biz/boom:/foo:/foo/bar"
|
871
|
-
|
872
|
-
If delete_existing is 0, then adding a path that exists will
|
873
|
-
not move it to the beginning; it will stay where it is in the
|
874
|
-
list.
|
875
|
-
|
876
|
-
If canonicalize is not None, it is applied to each element of
|
877
|
-
newpath before use.
|
878
|
-
"""
|
879
|
-
|
880
|
-
orig = oldpath
|
881
|
-
is_list = 1
|
882
|
-
paths = orig
|
883
|
-
if not is_List(orig) and not is_Tuple(orig):
|
884
|
-
paths = string.split(paths, sep)
|
885
|
-
is_list = 0
|
886
|
-
|
887
|
-
if is_String(newpath):
|
888
|
-
newpaths = string.split(newpath, sep)
|
889
|
-
elif not is_List(newpath) and not is_Tuple(newpath):
|
890
|
-
newpaths = [ newpath ] # might be a Dir
|
891
|
-
else:
|
892
|
-
newpaths = newpath
|
893
|
-
|
894
|
-
if canonicalize:
|
895
|
-
newpaths=map(canonicalize, newpaths)
|
896
|
-
|
897
|
-
if not delete_existing:
|
898
|
-
# First uniquify the old paths, making sure to
|
899
|
-
# preserve the first instance (in Unix/Linux,
|
900
|
-
# the first one wins), and remembering them in normpaths.
|
901
|
-
# Then insert the new paths at the head of the list
|
902
|
-
# if they're not already in the normpaths list.
|
903
|
-
result = []
|
904
|
-
normpaths = []
|
905
|
-
for path in paths:
|
906
|
-
if not path:
|
907
|
-
continue
|
908
|
-
normpath = os.path.normpath(os.path.normcase(path))
|
909
|
-
if normpath not in normpaths:
|
910
|
-
result.append(path)
|
911
|
-
normpaths.append(normpath)
|
912
|
-
newpaths.reverse() # since we're inserting at the head
|
913
|
-
for path in newpaths:
|
914
|
-
if not path:
|
915
|
-
continue
|
916
|
-
normpath = os.path.normpath(os.path.normcase(path))
|
917
|
-
if normpath not in normpaths:
|
918
|
-
result.insert(0, path)
|
919
|
-
normpaths.append(normpath)
|
920
|
-
paths = result
|
921
|
-
|
922
|
-
else:
|
923
|
-
newpaths = newpaths + paths # prepend new paths
|
924
|
-
|
925
|
-
normpaths = []
|
926
|
-
paths = []
|
927
|
-
# now we add them only if they are unique
|
928
|
-
for path in newpaths:
|
929
|
-
normpath = os.path.normpath(os.path.normcase(path))
|
930
|
-
if path and not normpath in normpaths:
|
931
|
-
paths.append(path)
|
932
|
-
normpaths.append(normpath)
|
933
|
-
|
934
|
-
if is_list:
|
935
|
-
return paths
|
936
|
-
else:
|
937
|
-
return string.join(paths, sep)
|
938
|
-
|
939
|
-
def AppendPath(oldpath, newpath, sep = os.pathsep,
|
940
|
-
delete_existing=1, canonicalize=None):
|
941
|
-
"""This appends new path elements to the given old path. Will
|
942
|
-
only add any particular path once (leaving the last one it
|
943
|
-
encounters and ignoring the rest, to preserve path order), and
|
944
|
-
will os.path.normpath and os.path.normcase all paths to help
|
945
|
-
assure this. This can also handle the case where the given old
|
946
|
-
path variable is a list instead of a string, in which case a list
|
947
|
-
will be returned instead of a string.
|
948
|
-
|
949
|
-
Example:
|
950
|
-
Old Path: "/foo/bar:/foo"
|
951
|
-
New Path: "/biz/boom:/foo"
|
952
|
-
Result: "/foo/bar:/biz/boom:/foo"
|
953
|
-
|
954
|
-
If delete_existing is 0, then adding a path that exists
|
955
|
-
will not move it to the end; it will stay where it is in the list.
|
956
|
-
|
957
|
-
If canonicalize is not None, it is applied to each element of
|
958
|
-
newpath before use.
|
959
|
-
"""
|
960
|
-
|
961
|
-
orig = oldpath
|
962
|
-
is_list = 1
|
963
|
-
paths = orig
|
964
|
-
if not is_List(orig) and not is_Tuple(orig):
|
965
|
-
paths = string.split(paths, sep)
|
966
|
-
is_list = 0
|
967
|
-
|
968
|
-
if is_String(newpath):
|
969
|
-
newpaths = string.split(newpath, sep)
|
970
|
-
elif not is_List(newpath) and not is_Tuple(newpath):
|
971
|
-
newpaths = [ newpath ] # might be a Dir
|
972
|
-
else:
|
973
|
-
newpaths = newpath
|
974
|
-
|
975
|
-
if canonicalize:
|
976
|
-
newpaths=map(canonicalize, newpaths)
|
977
|
-
|
978
|
-
if not delete_existing:
|
979
|
-
# add old paths to result, then
|
980
|
-
# add new paths if not already present
|
981
|
-
# (I thought about using a dict for normpaths for speed,
|
982
|
-
# but it's not clear hashing the strings would be faster
|
983
|
-
# than linear searching these typically short lists.)
|
984
|
-
result = []
|
985
|
-
normpaths = []
|
986
|
-
for path in paths:
|
987
|
-
if not path:
|
988
|
-
continue
|
989
|
-
result.append(path)
|
990
|
-
normpaths.append(os.path.normpath(os.path.normcase(path)))
|
991
|
-
for path in newpaths:
|
992
|
-
if not path:
|
993
|
-
continue
|
994
|
-
normpath = os.path.normpath(os.path.normcase(path))
|
995
|
-
if normpath not in normpaths:
|
996
|
-
result.append(path)
|
997
|
-
normpaths.append(normpath)
|
998
|
-
paths = result
|
999
|
-
else:
|
1000
|
-
# start w/ new paths, add old ones if not present,
|
1001
|
-
# then reverse.
|
1002
|
-
newpaths = paths + newpaths # append new paths
|
1003
|
-
newpaths.reverse()
|
1004
|
-
|
1005
|
-
normpaths = []
|
1006
|
-
paths = []
|
1007
|
-
# now we add them only if they are unique
|
1008
|
-
for path in newpaths:
|
1009
|
-
normpath = os.path.normpath(os.path.normcase(path))
|
1010
|
-
if path and not normpath in normpaths:
|
1011
|
-
paths.append(path)
|
1012
|
-
normpaths.append(normpath)
|
1013
|
-
paths.reverse()
|
1014
|
-
|
1015
|
-
if is_list:
|
1016
|
-
return paths
|
1017
|
-
else:
|
1018
|
-
return string.join(paths, sep)
|
1019
|
-
|
1020
|
-
if sys.platform == 'cygwin':
|
1021
|
-
def get_native_path(path):
|
1022
|
-
"""Transforms an absolute path into a native path for the system. In
|
1023
|
-
Cygwin, this converts from a Cygwin path to a Windows one."""
|
1024
|
-
return string.replace(os.popen('cygpath -w ' + path).read(), '\n', '')
|
1025
|
-
else:
|
1026
|
-
def get_native_path(path):
|
1027
|
-
"""Transforms an absolute path into a native path for the system.
|
1028
|
-
Non-Cygwin version, just leave the path alone."""
|
1029
|
-
return path
|
1030
|
-
|
1031
|
-
display = DisplayEngine()
|
1032
|
-
|
1033
|
-
def Split(arg):
|
1034
|
-
if is_List(arg) or is_Tuple(arg):
|
1035
|
-
return arg
|
1036
|
-
elif is_String(arg):
|
1037
|
-
return string.split(arg)
|
1038
|
-
else:
|
1039
|
-
return [arg]
|
1040
|
-
|
1041
|
-
class CLVar(UserList):
|
1042
|
-
"""A class for command-line construction variables.
|
1043
|
-
|
1044
|
-
This is a list that uses Split() to split an initial string along
|
1045
|
-
white-space arguments, and similarly to split any strings that get
|
1046
|
-
added. This allows us to Do the Right Thing with Append() and
|
1047
|
-
Prepend() (as well as straight Python foo = env['VAR'] + 'arg1
|
1048
|
-
arg2') regardless of whether a user adds a list or a string to a
|
1049
|
-
command-line construction variable.
|
1050
|
-
"""
|
1051
|
-
def __init__(self, seq = []):
|
1052
|
-
UserList.__init__(self, Split(seq))
|
1053
|
-
def __add__(self, other):
|
1054
|
-
return UserList.__add__(self, CLVar(other))
|
1055
|
-
def __radd__(self, other):
|
1056
|
-
return UserList.__radd__(self, CLVar(other))
|
1057
|
-
def __coerce__(self, other):
|
1058
|
-
return (self, CLVar(other))
|
1059
|
-
def __str__(self):
|
1060
|
-
return string.join(self.data)
|
1061
|
-
|
1062
|
-
# A dictionary that preserves the order in which items are added.
|
1063
|
-
# Submitted by David Benjamin to ActiveState's Python Cookbook web site:
|
1064
|
-
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747
|
1065
|
-
# Including fixes/enhancements from the follow-on discussions.
|
1066
|
-
class OrderedDict(UserDict):
|
1067
|
-
def __init__(self, dict = None):
|
1068
|
-
self._keys = []
|
1069
|
-
UserDict.__init__(self, dict)
|
1070
|
-
|
1071
|
-
def __delitem__(self, key):
|
1072
|
-
UserDict.__delitem__(self, key)
|
1073
|
-
self._keys.remove(key)
|
1074
|
-
|
1075
|
-
def __setitem__(self, key, item):
|
1076
|
-
UserDict.__setitem__(self, key, item)
|
1077
|
-
if key not in self._keys: self._keys.append(key)
|
1078
|
-
|
1079
|
-
def clear(self):
|
1080
|
-
UserDict.clear(self)
|
1081
|
-
self._keys = []
|
1082
|
-
|
1083
|
-
def copy(self):
|
1084
|
-
dict = OrderedDict()
|
1085
|
-
dict.update(self)
|
1086
|
-
return dict
|
1087
|
-
|
1088
|
-
def items(self):
|
1089
|
-
return zip(self._keys, self.values())
|
1090
|
-
|
1091
|
-
def keys(self):
|
1092
|
-
return self._keys[:]
|
1093
|
-
|
1094
|
-
def popitem(self):
|
1095
|
-
try:
|
1096
|
-
key = self._keys[-1]
|
1097
|
-
except IndexError:
|
1098
|
-
raise KeyError('dictionary is empty')
|
1099
|
-
|
1100
|
-
val = self[key]
|
1101
|
-
del self[key]
|
1102
|
-
|
1103
|
-
return (key, val)
|
1104
|
-
|
1105
|
-
def setdefault(self, key, failobj = None):
|
1106
|
-
UserDict.setdefault(self, key, failobj)
|
1107
|
-
if key not in self._keys: self._keys.append(key)
|
1108
|
-
|
1109
|
-
def update(self, dict):
|
1110
|
-
for (key, val) in dict.items():
|
1111
|
-
self.__setitem__(key, val)
|
1112
|
-
|
1113
|
-
def values(self):
|
1114
|
-
return map(self.get, self._keys)
|
1115
|
-
|
1116
|
-
class Selector(OrderedDict):
|
1117
|
-
"""A callable ordered dictionary that maps file suffixes to
|
1118
|
-
dictionary values. We preserve the order in which items are added
|
1119
|
-
so that get_suffix() calls always return the first suffix added."""
|
1120
|
-
def __call__(self, env, source, ext=None):
|
1121
|
-
if ext is None:
|
1122
|
-
try:
|
1123
|
-
ext = source[0].suffix
|
1124
|
-
except IndexError:
|
1125
|
-
ext = ""
|
1126
|
-
try:
|
1127
|
-
return self[ext]
|
1128
|
-
except KeyError:
|
1129
|
-
# Try to perform Environment substitution on the keys of
|
1130
|
-
# the dictionary before giving up.
|
1131
|
-
s_dict = {}
|
1132
|
-
for (k,v) in self.items():
|
1133
|
-
if k is not None:
|
1134
|
-
s_k = env.subst(k)
|
1135
|
-
if s_dict.has_key(s_k):
|
1136
|
-
# We only raise an error when variables point
|
1137
|
-
# to the same suffix. If one suffix is literal
|
1138
|
-
# and a variable suffix contains this literal,
|
1139
|
-
# the literal wins and we don't raise an error.
|
1140
|
-
raise KeyError, (s_dict[s_k][0], k, s_k)
|
1141
|
-
s_dict[s_k] = (k,v)
|
1142
|
-
try:
|
1143
|
-
return s_dict[ext][1]
|
1144
|
-
except KeyError:
|
1145
|
-
try:
|
1146
|
-
return self[None]
|
1147
|
-
except KeyError:
|
1148
|
-
return None
|
1149
|
-
|
1150
|
-
|
1151
|
-
if sys.platform == 'cygwin':
|
1152
|
-
# On Cygwin, os.path.normcase() lies, so just report back the
|
1153
|
-
# fact that the underlying Windows OS is case-insensitive.
|
1154
|
-
def case_sensitive_suffixes(s1, s2):
|
1155
|
-
return 0
|
1156
|
-
else:
|
1157
|
-
def case_sensitive_suffixes(s1, s2):
|
1158
|
-
return (os.path.normcase(s1) != os.path.normcase(s2))
|
1159
|
-
|
1160
|
-
def adjustixes(fname, pre, suf, ensure_suffix=False):
|
1161
|
-
if pre:
|
1162
|
-
path, fn = os.path.split(os.path.normpath(fname))
|
1163
|
-
if fn[:len(pre)] != pre:
|
1164
|
-
fname = os.path.join(path, pre + fn)
|
1165
|
-
# Only append a suffix if the suffix we're going to add isn't already
|
1166
|
-
# there, and if either we've been asked to ensure the specific suffix
|
1167
|
-
# is present or there's no suffix on it at all.
|
1168
|
-
if suf and fname[-len(suf):] != suf and \
|
1169
|
-
(ensure_suffix or not splitext(fname)[1]):
|
1170
|
-
fname = fname + suf
|
1171
|
-
return fname
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
# From Tim Peters,
|
1176
|
-
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
|
1177
|
-
# ASPN: Python Cookbook: Remove duplicates from a sequence
|
1178
|
-
# (Also in the printed Python Cookbook.)
|
1179
|
-
|
1180
|
-
def unique(s):
|
1181
|
-
"""Return a list of the elements in s, but without duplicates.
|
1182
|
-
|
1183
|
-
For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3],
|
1184
|
-
unique("abcabc") some permutation of ["a", "b", "c"], and
|
1185
|
-
unique(([1, 2], [2, 3], [1, 2])) some permutation of
|
1186
|
-
[[2, 3], [1, 2]].
|
1187
|
-
|
1188
|
-
For best speed, all sequence elements should be hashable. Then
|
1189
|
-
unique() will usually work in linear time.
|
1190
|
-
|
1191
|
-
If not possible, the sequence elements should enjoy a total
|
1192
|
-
ordering, and if list(s).sort() doesn't raise TypeError it's
|
1193
|
-
assumed that they do enjoy a total ordering. Then unique() will
|
1194
|
-
usually work in O(N*log2(N)) time.
|
1195
|
-
|
1196
|
-
If that's not possible either, the sequence elements must support
|
1197
|
-
equality-testing. Then unique() will usually work in quadratic
|
1198
|
-
time.
|
1199
|
-
"""
|
1200
|
-
|
1201
|
-
n = len(s)
|
1202
|
-
if n == 0:
|
1203
|
-
return []
|
1204
|
-
|
1205
|
-
# Try using a dict first, as that's the fastest and will usually
|
1206
|
-
# work. If it doesn't work, it will usually fail quickly, so it
|
1207
|
-
# usually doesn't cost much to *try* it. It requires that all the
|
1208
|
-
# sequence elements be hashable, and support equality comparison.
|
1209
|
-
u = {}
|
1210
|
-
try:
|
1211
|
-
for x in s:
|
1212
|
-
u[x] = 1
|
1213
|
-
except TypeError:
|
1214
|
-
pass # move on to the next method
|
1215
|
-
else:
|
1216
|
-
return u.keys()
|
1217
|
-
del u
|
1218
|
-
|
1219
|
-
# We can't hash all the elements. Second fastest is to sort,
|
1220
|
-
# which brings the equal elements together; then duplicates are
|
1221
|
-
# easy to weed out in a single pass.
|
1222
|
-
# NOTE: Python's list.sort() was designed to be efficient in the
|
1223
|
-
# presence of many duplicate elements. This isn't true of all
|
1224
|
-
# sort functions in all languages or libraries, so this approach
|
1225
|
-
# is more effective in Python than it may be elsewhere.
|
1226
|
-
try:
|
1227
|
-
t = list(s)
|
1228
|
-
t.sort()
|
1229
|
-
except TypeError:
|
1230
|
-
pass # move on to the next method
|
1231
|
-
else:
|
1232
|
-
assert n > 0
|
1233
|
-
last = t[0]
|
1234
|
-
lasti = i = 1
|
1235
|
-
while i < n:
|
1236
|
-
if t[i] != last:
|
1237
|
-
t[lasti] = last = t[i]
|
1238
|
-
lasti = lasti + 1
|
1239
|
-
i = i + 1
|
1240
|
-
return t[:lasti]
|
1241
|
-
del t
|
1242
|
-
|
1243
|
-
# Brute force is all that's left.
|
1244
|
-
u = []
|
1245
|
-
for x in s:
|
1246
|
-
if x not in u:
|
1247
|
-
u.append(x)
|
1248
|
-
return u
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
# From Alex Martelli,
|
1253
|
-
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
|
1254
|
-
# ASPN: Python Cookbook: Remove duplicates from a sequence
|
1255
|
-
# First comment, dated 2001/10/13.
|
1256
|
-
# (Also in the printed Python Cookbook.)
|
1257
|
-
|
1258
|
-
def uniquer(seq, idfun=None):
|
1259
|
-
if idfun is None:
|
1260
|
-
def idfun(x): return x
|
1261
|
-
seen = {}
|
1262
|
-
result = []
|
1263
|
-
for item in seq:
|
1264
|
-
marker = idfun(item)
|
1265
|
-
# in old Python versions:
|
1266
|
-
# if seen.has_key(marker)
|
1267
|
-
# but in new ones:
|
1268
|
-
if marker in seen: continue
|
1269
|
-
seen[marker] = 1
|
1270
|
-
result.append(item)
|
1271
|
-
return result
|
1272
|
-
|
1273
|
-
# A more efficient implementation of Alex's uniquer(), this avoids the
|
1274
|
-
# idfun() argument and function-call overhead by assuming that all
|
1275
|
-
# items in the sequence are hashable.
|
1276
|
-
|
1277
|
-
def uniquer_hashables(seq):
|
1278
|
-
seen = {}
|
1279
|
-
result = []
|
1280
|
-
for item in seq:
|
1281
|
-
#if not item in seen:
|
1282
|
-
if not seen.has_key(item):
|
1283
|
-
seen[item] = 1
|
1284
|
-
result.append(item)
|
1285
|
-
return result
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
# Much of the logic here was originally based on recipe 4.9 from the
|
1290
|
-
# Python CookBook, but we had to dumb it way down for Python 1.5.2.
|
1291
|
-
class LogicalLines:
|
1292
|
-
|
1293
|
-
def __init__(self, fileobj):
|
1294
|
-
self.fileobj = fileobj
|
1295
|
-
|
1296
|
-
def readline(self):
|
1297
|
-
result = []
|
1298
|
-
while 1:
|
1299
|
-
line = self.fileobj.readline()
|
1300
|
-
if not line:
|
1301
|
-
break
|
1302
|
-
if line[-2:] == '\\\n':
|
1303
|
-
result.append(line[:-2])
|
1304
|
-
else:
|
1305
|
-
result.append(line)
|
1306
|
-
break
|
1307
|
-
return string.join(result, '')
|
1308
|
-
|
1309
|
-
def readlines(self):
|
1310
|
-
result = []
|
1311
|
-
while 1:
|
1312
|
-
line = self.readline()
|
1313
|
-
if not line:
|
1314
|
-
break
|
1315
|
-
result.append(line)
|
1316
|
-
return result
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
class UniqueList(UserList):
|
1321
|
-
def __init__(self, seq = []):
|
1322
|
-
UserList.__init__(self, seq)
|
1323
|
-
self.unique = True
|
1324
|
-
def __make_unique(self):
|
1325
|
-
if not self.unique:
|
1326
|
-
self.data = uniquer_hashables(self.data)
|
1327
|
-
self.unique = True
|
1328
|
-
def __lt__(self, other):
|
1329
|
-
self.__make_unique()
|
1330
|
-
return UserList.__lt__(self, other)
|
1331
|
-
def __le__(self, other):
|
1332
|
-
self.__make_unique()
|
1333
|
-
return UserList.__le__(self, other)
|
1334
|
-
def __eq__(self, other):
|
1335
|
-
self.__make_unique()
|
1336
|
-
return UserList.__eq__(self, other)
|
1337
|
-
def __ne__(self, other):
|
1338
|
-
self.__make_unique()
|
1339
|
-
return UserList.__ne__(self, other)
|
1340
|
-
def __gt__(self, other):
|
1341
|
-
self.__make_unique()
|
1342
|
-
return UserList.__gt__(self, other)
|
1343
|
-
def __ge__(self, other):
|
1344
|
-
self.__make_unique()
|
1345
|
-
return UserList.__ge__(self, other)
|
1346
|
-
def __cmp__(self, other):
|
1347
|
-
self.__make_unique()
|
1348
|
-
return UserList.__cmp__(self, other)
|
1349
|
-
def __len__(self):
|
1350
|
-
self.__make_unique()
|
1351
|
-
return UserList.__len__(self)
|
1352
|
-
def __getitem__(self, i):
|
1353
|
-
self.__make_unique()
|
1354
|
-
return UserList.__getitem__(self, i)
|
1355
|
-
def __setitem__(self, i, item):
|
1356
|
-
UserList.__setitem__(self, i, item)
|
1357
|
-
self.unique = False
|
1358
|
-
def __getslice__(self, i, j):
|
1359
|
-
self.__make_unique()
|
1360
|
-
return UserList.__getslice__(self, i, j)
|
1361
|
-
def __setslice__(self, i, j, other):
|
1362
|
-
UserList.__setslice__(self, i, j, other)
|
1363
|
-
self.unique = False
|
1364
|
-
def __add__(self, other):
|
1365
|
-
result = UserList.__add__(self, other)
|
1366
|
-
result.unique = False
|
1367
|
-
return result
|
1368
|
-
def __radd__(self, other):
|
1369
|
-
result = UserList.__radd__(self, other)
|
1370
|
-
result.unique = False
|
1371
|
-
return result
|
1372
|
-
def __iadd__(self, other):
|
1373
|
-
result = UserList.__iadd__(self, other)
|
1374
|
-
result.unique = False
|
1375
|
-
return result
|
1376
|
-
def __mul__(self, other):
|
1377
|
-
result = UserList.__mul__(self, other)
|
1378
|
-
result.unique = False
|
1379
|
-
return result
|
1380
|
-
def __rmul__(self, other):
|
1381
|
-
result = UserList.__rmul__(self, other)
|
1382
|
-
result.unique = False
|
1383
|
-
return result
|
1384
|
-
def __imul__(self, other):
|
1385
|
-
result = UserList.__imul__(self, other)
|
1386
|
-
result.unique = False
|
1387
|
-
return result
|
1388
|
-
def append(self, item):
|
1389
|
-
UserList.append(self, item)
|
1390
|
-
self.unique = False
|
1391
|
-
def insert(self, i):
|
1392
|
-
UserList.insert(self, i)
|
1393
|
-
self.unique = False
|
1394
|
-
def count(self, item):
|
1395
|
-
self.__make_unique()
|
1396
|
-
return UserList.count(self, item)
|
1397
|
-
def index(self, item):
|
1398
|
-
self.__make_unique()
|
1399
|
-
return UserList.index(self, item)
|
1400
|
-
def reverse(self):
|
1401
|
-
self.__make_unique()
|
1402
|
-
UserList.reverse(self)
|
1403
|
-
def sort(self, *args, **kwds):
|
1404
|
-
self.__make_unique()
|
1405
|
-
#return UserList.sort(self, *args, **kwds)
|
1406
|
-
return apply(UserList.sort, (self,)+args, kwds)
|
1407
|
-
def extend(self, other):
|
1408
|
-
UserList.extend(self, other)
|
1409
|
-
self.unique = False
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
class Unbuffered:
|
1414
|
-
"""
|
1415
|
-
A proxy class that wraps a file object, flushing after every write,
|
1416
|
-
and delegating everything else to the wrapped object.
|
1417
|
-
"""
|
1418
|
-
def __init__(self, file):
|
1419
|
-
self.file = file
|
1420
|
-
def write(self, arg):
|
1421
|
-
try:
|
1422
|
-
self.file.write(arg)
|
1423
|
-
self.file.flush()
|
1424
|
-
except IOError:
|
1425
|
-
# Stdout might be connected to a pipe that has been closed
|
1426
|
-
# by now. The most likely reason for the pipe being closed
|
1427
|
-
# is that the user has press ctrl-c. It this is the case,
|
1428
|
-
# then SCons is currently shutdown. We therefore ignore
|
1429
|
-
# IOError's here so that SCons can continue and shutdown
|
1430
|
-
# properly so that the .sconsign is correctly written
|
1431
|
-
# before SCons exits.
|
1432
|
-
pass
|
1433
|
-
def __getattr__(self, attr):
|
1434
|
-
return getattr(self.file, attr)
|
1435
|
-
|
1436
|
-
def make_path_relative(path):
|
1437
|
-
""" makes an absolute path name to a relative pathname.
|
1438
|
-
"""
|
1439
|
-
if os.path.isabs(path):
|
1440
|
-
drive_s,path = os.path.splitdrive(path)
|
1441
|
-
|
1442
|
-
import re
|
1443
|
-
if not drive_s:
|
1444
|
-
path=re.compile("/*(.*)").findall(path)[0]
|
1445
|
-
else:
|
1446
|
-
path=path[1:]
|
1447
|
-
|
1448
|
-
assert( not os.path.isabs( path ) ), path
|
1449
|
-
return path
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
# The original idea for AddMethod() and RenameFunction() come from the
|
1454
|
-
# following post to the ActiveState Python Cookbook:
|
1455
|
-
#
|
1456
|
-
# ASPN: Python Cookbook : Install bound methods in an instance
|
1457
|
-
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/223613
|
1458
|
-
#
|
1459
|
-
# That code was a little fragile, though, so the following changes
|
1460
|
-
# have been wrung on it:
|
1461
|
-
#
|
1462
|
-
# * Switched the installmethod() "object" and "function" arguments,
|
1463
|
-
# so the order reflects that the left-hand side is the thing being
|
1464
|
-
# "assigned to" and the right-hand side is the value being assigned.
|
1465
|
-
#
|
1466
|
-
# * Changed explicit type-checking to the "try: klass = object.__class__"
|
1467
|
-
# block in installmethod() below so that it still works with the
|
1468
|
-
# old-style classes that SCons uses.
|
1469
|
-
#
|
1470
|
-
# * Replaced the by-hand creation of methods and functions with use of
|
1471
|
-
# the "new" module, as alluded to in Alex Martelli's response to the
|
1472
|
-
# following Cookbook post:
|
1473
|
-
#
|
1474
|
-
# ASPN: Python Cookbook : Dynamically added methods to a class
|
1475
|
-
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81732
|
1476
|
-
|
1477
|
-
def AddMethod(object, function, name = None):
|
1478
|
-
"""
|
1479
|
-
Adds either a bound method to an instance or an unbound method to
|
1480
|
-
a class. If name is ommited the name of the specified function
|
1481
|
-
is used by default.
|
1482
|
-
Example:
|
1483
|
-
a = A()
|
1484
|
-
def f(self, x, y):
|
1485
|
-
self.z = x + y
|
1486
|
-
AddMethod(f, A, "add")
|
1487
|
-
a.add(2, 4)
|
1488
|
-
print a.z
|
1489
|
-
AddMethod(lambda self, i: self.l[i], a, "listIndex")
|
1490
|
-
print a.listIndex(5)
|
1491
|
-
"""
|
1492
|
-
import new
|
1493
|
-
|
1494
|
-
if name is None:
|
1495
|
-
name = function.func_name
|
1496
|
-
else:
|
1497
|
-
function = RenameFunction(function, name)
|
1498
|
-
|
1499
|
-
try:
|
1500
|
-
klass = object.__class__
|
1501
|
-
except AttributeError:
|
1502
|
-
# "object" is really a class, so it gets an unbound method.
|
1503
|
-
object.__dict__[name] = new.instancemethod(function, None, object)
|
1504
|
-
else:
|
1505
|
-
# "object" is really an instance, so it gets a bound method.
|
1506
|
-
object.__dict__[name] = new.instancemethod(function, object, klass)
|
1507
|
-
|
1508
|
-
def RenameFunction(function, name):
|
1509
|
-
"""
|
1510
|
-
Returns a function identical to the specified function, but with
|
1511
|
-
the specified name.
|
1512
|
-
"""
|
1513
|
-
import new
|
1514
|
-
|
1515
|
-
# Compatibility for Python 1.5 and 2.1. Can be removed in favor of
|
1516
|
-
# passing function.func_defaults directly to new.function() once
|
1517
|
-
# we base on Python 2.2 or later.
|
1518
|
-
func_defaults = function.func_defaults
|
1519
|
-
if func_defaults is None:
|
1520
|
-
func_defaults = ()
|
1521
|
-
|
1522
|
-
return new.function(function.func_code,
|
1523
|
-
function.func_globals,
|
1524
|
-
name,
|
1525
|
-
func_defaults)
|
1526
|
-
|
1527
|
-
|
1528
|
-
md5 = False
|
1529
|
-
def MD5signature(s):
|
1530
|
-
return str(s)
|
1531
|
-
|
1532
|
-
def MD5filesignature(fname, chunksize=65536):
|
1533
|
-
f = open(fname, "rb")
|
1534
|
-
result = f.read()
|
1535
|
-
f.close()
|
1536
|
-
return result
|
1537
|
-
|
1538
|
-
try:
|
1539
|
-
import hashlib
|
1540
|
-
except ImportError:
|
1541
|
-
pass
|
1542
|
-
else:
|
1543
|
-
if hasattr(hashlib, 'md5'):
|
1544
|
-
md5 = True
|
1545
|
-
def MD5signature(s):
|
1546
|
-
m = hashlib.md5()
|
1547
|
-
m.update(str(s))
|
1548
|
-
return m.hexdigest()
|
1549
|
-
|
1550
|
-
def MD5filesignature(fname, chunksize=65536):
|
1551
|
-
m = hashlib.md5()
|
1552
|
-
f = open(fname, "rb")
|
1553
|
-
while 1:
|
1554
|
-
blck = f.read(chunksize)
|
1555
|
-
if not blck:
|
1556
|
-
break
|
1557
|
-
m.update(str(blck))
|
1558
|
-
f.close()
|
1559
|
-
return m.hexdigest()
|
1560
|
-
|
1561
|
-
def MD5collect(signatures):
|
1562
|
-
"""
|
1563
|
-
Collects a list of signatures into an aggregate signature.
|
1564
|
-
|
1565
|
-
signatures - a list of signatures
|
1566
|
-
returns - the aggregate signature
|
1567
|
-
"""
|
1568
|
-
if len(signatures) == 1:
|
1569
|
-
return signatures[0]
|
1570
|
-
else:
|
1571
|
-
return MD5signature(string.join(signatures, ', '))
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
# Wrap the intern() function so it doesn't throw exceptions if ineligible
|
1576
|
-
# arguments are passed. The intern() function was moved into the sys module in
|
1577
|
-
# Python 3.
|
1578
|
-
try:
|
1579
|
-
intern
|
1580
|
-
except NameError:
|
1581
|
-
from sys import intern
|
1582
|
-
|
1583
|
-
def silent_intern(x):
|
1584
|
-
"""
|
1585
|
-
Perform intern() on the passed argument and return the result.
|
1586
|
-
If the input is ineligible (e.g. a unicode string) the original argument is
|
1587
|
-
returned and no exception is thrown.
|
1588
|
-
"""
|
1589
|
-
try:
|
1590
|
-
return intern(x)
|
1591
|
-
except TypeError:
|
1592
|
-
return x
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
# From Dinu C. Gherman,
|
1597
|
-
# Python Cookbook, second edition, recipe 6.17, p. 277.
|
1598
|
-
# Also:
|
1599
|
-
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68205
|
1600
|
-
# ASPN: Python Cookbook: Null Object Design Pattern
|
1601
|
-
|
1602
|
-
# TODO(1.5):
|
1603
|
-
#class Null(object):
|
1604
|
-
class Null:
|
1605
|
-
""" Null objects always and reliably "do nothing." """
|
1606
|
-
def __new__(cls, *args, **kwargs):
|
1607
|
-
if not '_inst' in vars(cls):
|
1608
|
-
#cls._inst = type.__new__(cls, *args, **kwargs)
|
1609
|
-
cls._inst = apply(type.__new__, (cls,) + args, kwargs)
|
1610
|
-
return cls._inst
|
1611
|
-
def __init__(self, *args, **kwargs):
|
1612
|
-
pass
|
1613
|
-
def __call__(self, *args, **kwargs):
|
1614
|
-
return self
|
1615
|
-
def __repr__(self):
|
1616
|
-
return "Null(0x%08X)" % id(self)
|
1617
|
-
def __nonzero__(self):
|
1618
|
-
return False
|
1619
|
-
def __getattr__(self, name):
|
1620
|
-
return self
|
1621
|
-
def __setattr__(self, name, value):
|
1622
|
-
return self
|
1623
|
-
def __delattr__(self, name):
|
1624
|
-
return self
|
1625
|
-
|
1626
|
-
class NullSeq(Null):
|
1627
|
-
def __len__(self):
|
1628
|
-
return 0
|
1629
|
-
def __iter__(self):
|
1630
|
-
return iter(())
|
1631
|
-
def __getitem__(self, i):
|
1632
|
-
return self
|
1633
|
-
def __delitem__(self, i):
|
1634
|
-
return self
|
1635
|
-
def __setitem__(self, i, v):
|
1636
|
-
return self
|
1637
|
-
|
1638
|
-
|
1639
|
-
del __revision__
|
1640
|
-
|
1641
|
-
# Local Variables:
|
1642
|
-
# tab-width:4
|
1643
|
-
# indent-tabs-mode:nil
|
1644
|
-
# End:
|
1645
|
-
# vim: set expandtab tabstop=4 shiftwidth=4:
|