summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-01-14 14:43:51 +0000
committerSteven Knight <knight@baldmt.com>2010-01-14 14:43:51 +0000
commit9f08842427047cb9b1ef0b2315804de2e935eed4 (patch)
tree4a0fbb5127febe34fea18fadf9597e4dcbbcdec0 /bin
parent54ac0ca4f908f33871700176afe00afa5ae000ec (diff)
downloadscons-9f08842427047cb9b1ef0b2315804de2e935eed4.tar.gz
Massage the output from examples for consistency with Python 2.6.
Diffstat (limited to 'bin')
-rw-r--r--bin/sconsoutput.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/sconsoutput.py b/bin/sconsoutput.py
index 2c6e4d5f..e2237c55 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&gt;', content)
+ content = address_re.sub(r' at 0x700000&gt;', content)
+ content = file_re.sub(r'\1 <module>', content)
+ content = nodelist_re.sub(r"\1 'NodeList' object \2", content)
content = string.replace(content, '<', '&lt;')
content = string.replace(content, '>', '&gt;')
sys.stdout.write(p + content + '\n')