diff options
Diffstat (limited to 'bin/scons-doc.py')
-rw-r--r-- | bin/scons-doc.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/bin/scons-doc.py b/bin/scons-doc.py index 03c66fa..f7a3a23 100644 --- a/bin/scons-doc.py +++ b/bin/scons-doc.py @@ -204,7 +204,7 @@ Sep = { orig = SCons.Node.FS.EntryProxy class MyEntryProxy(orig): def __str__(self): - return string.replace(str(self._Proxy__subject), os.sep, Sep) + return str(self._Proxy__subject).replace(os.sep, Sep) SCons.Node.FS.EntryProxy = MyEntryProxy # Slip our own RDirs() method into the Node.FS.File class so that the @@ -213,8 +213,7 @@ SCons.Node.FS.EntryProxy = MyEntryProxy # running on to what's appropriate for the example system. orig_RDirs = SCons.Node.FS.File.RDirs def my_RDirs(self, pathlist, orig_RDirs=orig_RDirs): - return map(lambda x: string.replace(str(x), os.sep, Sep), - orig_RDirs(self, pathlist)) + return [str(x).replace(os.sep, Sep) for x in orig_RDirs(self, pathlist)] SCons.Node.FS.File.RDirs = my_RDirs class Curry: @@ -235,8 +234,8 @@ class Curry: def Str(target, source, env, cmd=""): result = [] for cmd in env.subst_list(cmd, target=target, source=source): - result.append(string.join(map(str, cmd))) - return string.join(result, '\\n') + result.append(' '.join(map(str, cmd))) + return '\\n'.join(result) class ToolSurrogate: def __init__(self, tool, variable, func, varlist): @@ -379,7 +378,7 @@ ToolList = { } toollist = ToolList[platform] -filter_tools = string.split('%(tools)s') +filter_tools = '%(tools)s'.split() if filter_tools: toollist = [x for x in toollist if x[0] in filter_tools] @@ -564,6 +563,12 @@ class MySGML(sgmllib.SGMLParser): # Here is where the heavy lifting begins. The following methods # handle the begin-end tags of our SCons examples. + def for_display(self, contents): + contents = contents.replace('__ROOT__', '') + contents = contents.replace('<', '<') + contents = contents.replace('>', '>') + return contents + def start_scons_example(self, attrs): t = [t for t in attrs if t[0] == 'name'] if t: @@ -589,9 +594,7 @@ class MySGML(sgmllib.SGMLParser): i = len(f.data) - 1 while f.data[i] == ' ': i = i - 1 - output = f.data[:i+1].replace('__ROOT__', '') - output = output.replace('<', '<') - output = output.replace('>', '>') + output = self.for_display(f.data[:i+1]) self.outfp.write(output) if e.data and e.data[0] == '\n': e.data = e.data[1:] @@ -773,8 +776,7 @@ class MySGML(sgmllib.SGMLParser): content = engine_re.sub(r' File "bootstrap/src/engine/SCons/', content) content = file_re.sub(r'\1 <module>', content) content = nodelist_re.sub(r"\1 'NodeList' object \2", content) - content = content.replace('<', '<') - content = content.replace('>', '>') + content = self.for_display(content) self.outfp.write(p + content + '\n') if o.data[0] == '\n': @@ -811,7 +813,7 @@ class MySGML(sgmllib.SGMLParser): def end_sconstruct(self): f = self.f self.outfp.write('<programlisting>') - output = f.data.replace('__ROOT__', '') + output = self.for_display(f.data) self.outfp.write(output + '</programlisting>') delattr(self, 'f') self.afunclist = self.afunclist[:-1] |