diff options
author | Steven Knight <knight@baldmt.com> | 2010-01-14 14:43:51 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2010-01-14 14:43:51 (GMT) |
commit | 12e6b068e0c40633b1445e13a75230c50b191428 (patch) | |
tree | 4a0fbb5127febe34fea18fadf9597e4dcbbcdec0 /bin | |
parent | 31615ed4df11661975191af901f33d54989f8a91 (diff) | |
download | SCons-12e6b068e0c40633b1445e13a75230c50b191428.zip SCons-12e6b068e0c40633b1445e13a75230c50b191428.tar.gz SCons-12e6b068e0c40633b1445e13a75230c50b191428.tar.bz2 |
Massage the output from examples for consistency with Python 2.6.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sconsoutput.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/sconsoutput.py b/bin/sconsoutput.py index 2c6e4d5..e2237c5 100644 --- a/bin/sconsoutput.py +++ b/bin/sconsoutput.py @@ -739,6 +739,21 @@ class MySGML(sgmllib.SGMLParser): sys.stdout.write('<screen>' + o.prefix[:i]) p = o.prefix[i:] + # Regular expressions for making the doc output consistent, + # regardless of reported addresses or Python version. + + # Massage addresses in object repr strings to a constant. + address_re = re.compile(r' at 0x[0-9a-fA-F]*\>') + + # Python 2.5 changed the stack trace when the module is read + # from standard input from read "... line 7, in ?" to + # "... line 7, in <module>". + file_re = re.compile(r'^( *File ".*", line \d+, in) \?$', re.M) + + # Python 2.6 made UserList a new-style class, which changes the + # AttributeError message generated by our NodeList subclass. + nodelist_re = re.compile(r'(AttributeError:) NodeList instance (has no attribute \S+)') + for c in o.commandlist: sys.stdout.write(p + Prompt[o.os]) d = string.replace(c.data, '__ROOT__', '') @@ -753,7 +768,9 @@ class MySGML(sgmllib.SGMLParser): elif lines: content = string.join(lines, '\n' + p) if content: - content = re.sub(' at 0x[0-9a-fA-F]*\>', ' at 0x700000>', content) + content = address_re.sub(r' at 0x700000>', content) + content = file_re.sub(r'\1 <module>', content) + content = nodelist_re.sub(r"\1 'NodeList' object \2", content) content = string.replace(content, '<', '<') content = string.replace(content, '>', '>') sys.stdout.write(p + content + '\n') |