diff options
author | Mats Wichmann <mats@linux.com> | 2020-11-21 14:57:11 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2020-11-21 14:57:11 (GMT) |
commit | 7e3696fe2a249093d5d8f8de3fd575b8249aa506 (patch) | |
tree | 20c44fd90410f26d95b380f421e180fe6488cde1 /SCons/Debug.py | |
parent | d9068338b083e61f6f1339657f5ed671712ee520 (diff) | |
download | SCons-7e3696fe2a249093d5d8f8de3fd575b8249aa506.zip SCons-7e3696fe2a249093d5d8f8de3fd575b8249aa506.tar.gz SCons-7e3696fe2a249093d5d8f8de3fd575b8249aa506.tar.bz2 |
Fix Trace function
The (internal) Trace function had been left in an inconsistent
state by an earlier change, with a variable name mismatch. Fixed.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'SCons/Debug.py')
-rw-r--r-- | SCons/Debug.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/SCons/Debug.py b/SCons/Debug.py index 2310cb7..f4b802e 100644 --- a/SCons/Debug.py +++ b/SCons/Debug.py @@ -196,17 +196,17 @@ TimeStampDefault = False StartTime = time.time() PreviousTime = StartTime -def Trace(msg, filename=None, mode='w', tstamp=False): +def Trace(msg, tracefile=None, mode='w', tstamp=False): """Write a trace message. Write messages when debugging which do not interfere with stdout. Useful in tests, which monitor stdout and would break with unexpected output. Trace messages can go to the console (which is - opened as a file), or to a disk file; the file argument persists + opened as a file), or to a disk file; the tracefile argument persists across calls unless overridden. Args: - filename: file to write trace message to. If omitted, + tracefile: file to write trace message to. If omitted, write to the previous trace file (default: console). mode: file open mode (default: 'w') tstamp: write relative timestamps with trace. Outputs time since @@ -220,23 +220,23 @@ def Trace(msg, filename=None, mode='w', tstamp=False): def trace_cleanup(traceFP): traceFP.close() - if file is None: - file = TraceDefault + if tracefile is None: + tracefile = TraceDefault else: - TraceDefault = file + TraceDefault = tracefile if not tstamp: tstamp = TimeStampDefault else: TimeStampDefault = tstamp try: - fp = TraceFP[file] + fp = TraceFP[tracefile] except KeyError: try: - fp = TraceFP[file] = open(file, mode) + fp = TraceFP[tracefile] = open(tracefile, mode) atexit.register(trace_cleanup, fp) except TypeError: # Assume we were passed an open file pointer. - fp = file + fp = tracefile if tstamp: now = time.time() fp.write('%8.4f %8.4f: ' % (now - StartTime, now - PreviousTime)) |