diff options
author | Steven Knight <knight@baldmt.com> | 2005-01-13 18:28:05 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-01-13 18:28:05 (GMT) |
commit | 0b6e3bec86b7cfe449c63094a08b8821fe17e843 (patch) | |
tree | 8f74c1bb75c09751e673438c0d2d5cad9bbb8607 /src/engine/SCons/Script/__init__.py | |
parent | 8221932fbb76c1c964db12fde7443a0510a4e7e5 (diff) | |
download | SCons-0b6e3bec86b7cfe449c63094a08b8821fe17e843.zip SCons-0b6e3bec86b7cfe449c63094a08b8821fe17e843.tar.gz SCons-0b6e3bec86b7cfe449c63094a08b8821fe17e843.tar.bz2 |
Fix --debug=memoizer so it actually prints some stats on Python 2.x.
Diffstat (limited to 'src/engine/SCons/Script/__init__.py')
-rw-r--r-- | src/engine/SCons/Script/__init__.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index d94fee2..7368c8c 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -39,9 +39,28 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import time start_time = time.time() +import os import string +import sys import UserList +# Special chicken-and-egg handling of the "--debug=memoizer" flags: +# SCons.Memoize contains a metaclass implementation that affects how +# the other classes are instantiated. The Memoizer handles optional +# counting of the hits and misses by using a different, parallel set of +# functions, so we don't slow down normal operation any more than we +# have to. But if we wait to enable the counting until we've parsed +# the command line options normally, it will be too late, because the +# Memoizer will have already analyzed the classes that it's Memoizing +# and bound the non-counting versions of the functions. So we have to +# use a special-case, up-front check for the "--debug=memoizer" flag +# and turn on Memoizer counting, if desired, before we import any of +# the other modules that use it. +sconsflags = string.split(os.environ.get('SCONSFLAGS', '')) +if "--debug=memoizer" in sys.argv + sconsflags: + import SCons.Memoize + SCons.Memoize.EnableCounting() + import SCons.Action import SCons.Builder import SCons.Environment |