diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/SConsDoc.py | 16 | ||||
-rw-r--r-- | bin/import-test.py | 2 | ||||
-rw-r--r-- | bin/linecount.py | 2 | ||||
-rw-r--r-- | bin/restore.sh | 22 | ||||
-rw-r--r-- | bin/scons-proc.py | 58 |
5 files changed, 66 insertions, 34 deletions
diff --git a/bin/SConsDoc.py b/bin/SConsDoc.py index cd78195..3f64a25 100644 --- a/bin/SConsDoc.py +++ b/bin/SConsDoc.py @@ -134,10 +134,9 @@ class Builder(Item): pass class Function(Item): - def __init__(self, name, global_signature, env_signature): + def __init__(self, name): super(Function, self).__init__(name) - self.global_signature = global_signature - self.env_signature = env_signature + self.arguments = [] class Tool(Item): def __init__(self, name): @@ -160,10 +159,11 @@ class Chunk: self.body.append(data) class Arguments: - def __init__(self, body=None): + def __init__(self, signature, body=None): if not body: body = [] self.body = body + self.signature = signature def __str__(self): s = ''.join(self.body).strip() result = [] @@ -299,9 +299,7 @@ class SConsDocHandler(xml.sax.handler.ContentHandler, try: function = self.functions[name] except KeyError: - function = Function(name, - attrs.get('global', "1"), - attrs.get('env', "1")) + function = Function(name) self.functions[name] = function self.begin_xxx(function) def end_scons_function(self): @@ -330,8 +328,8 @@ class SConsDocHandler(xml.sax.handler.ContentHandler, self.end_xxx() def start_arguments(self, attrs): - arguments = Arguments() - self.current_object.arguments = arguments + arguments = Arguments(attrs.get('signature', "both")) + self.current_object.arguments.append(arguments) self.begin_xxx(arguments) self.begin_collecting(arguments) def end_arguments(self): diff --git a/bin/import-test.py b/bin/import-test.py index e0731d0..18f7428 100644 --- a/bin/import-test.py +++ b/bin/import-test.py @@ -25,7 +25,7 @@ # """ triple-quotes will need to have their contents edited by hand. # -__revision__ = "bin/import-test.py 4691 2010/03/06 16:22:36 bdbaddog" +__revision__ = "bin/import-test.py 4720 2010/03/24 03:14:11 jars" import os.path import sys diff --git a/bin/linecount.py b/bin/linecount.py index c087963..23ac7c9 100644 --- a/bin/linecount.py +++ b/bin/linecount.py @@ -23,7 +23,7 @@ # interesting one for most purposes. # -__revision__ = "bin/linecount.py 4691 2010/03/06 16:22:36 bdbaddog" +__revision__ = "bin/linecount.py 4720 2010/03/24 03:14:11 jars" import os.path import string diff --git a/bin/restore.sh b/bin/restore.sh index 98ad1ed..8dce2d3 100644 --- a/bin/restore.sh +++ b/bin/restore.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh # -# Simple hack script to restore __revision__, __COPYRIGHT_, 1.2.0.d20100306 +# Simple hack script to restore __revision__, __COPYRIGHT_, 1.3.0 # and other similar variables to what gets checked in to source. This # comes in handy when people send in diffs based on the released source. # @@ -24,7 +24,7 @@ for i in `find $DIRS -name '*.py'`; do ed $i <<EOF g/Copyright (c) 2001.*SCons Foundation/s//Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation/p w -/^__revision__ = /s/= .*/= "bin/restore.sh 4691 2010/03/06 16:22:36 bdbaddog"/p +/^__revision__ = /s/= .*/= "bin/restore.sh 4720 2010/03/24 03:14:11 jars"/p w q EOF @@ -35,7 +35,7 @@ for i in `find $DIRS -name 'scons.bat'`; do ed $i <<EOF g/Copyright (c) 2001.*SCons Foundation/s//Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation/p w -/^@REM src\/script\/scons.bat/s/@REM .* knight/@REM bin/restore.sh 4691 2010/03/06 16:22:36 bdbaddog/p +/^@REM src\/script\/scons.bat/s/@REM .* knight/@REM bin/restore.sh 4720 2010/03/24 03:14:11 jars/p w q EOF @@ -44,15 +44,15 @@ done for i in `find $DIRS -name '__init__.py' -o -name 'scons.py' -o -name 'sconsign.py'`; do header $i ed $i <<EOF -/^__version__ = /s/= .*/= "1.2.0.d20100306"/p +/^__version__ = /s/= .*/= "1.3.0"/p w -/^__build__ = /s/= .*/= "r4691"/p +/^__build__ = /s/= .*/= "r4720"/p w -/^__buildsys__ = /s/= .*/= "mvdog"/p +/^__buildsys__ = /s/= .*/= "jars-desktop"/p w -/^__date__ = /s/= .*/= "2010/03/06 16:22:36"/p +/^__date__ = /s/= .*/= "2010/03/24 03:14:11"/p w -/^__developer__ = /s/= .*/= "bdbaddog"/p +/^__developer__ = /s/= .*/= "jars"/p w q EOF @@ -61,7 +61,7 @@ done for i in `find $DIRS -name 'setup.py'`; do header $i ed $i <<EOF -/^ *version = /s/= .*/= "1.2.0.d20100306",/p +/^ *version = /s/= .*/= "1.3.0",/p w q EOF @@ -72,9 +72,9 @@ for i in `find $DIRS -name '*.txt'`; do ed $i <<EOF g/Copyright (c) 2001.*SCons Foundation/s//Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation/p w -/# [^ ]* 0.96.[CD][0-9]* [0-9\/]* [0-9:]* knight$/s/.*/# bin/restore.sh 4691 2010/03/06 16:22:36 bdbaddog/p +/# [^ ]* 0.96.[CD][0-9]* [0-9\/]* [0-9:]* knight$/s/.*/# bin/restore.sh 4720 2010/03/24 03:14:11 jars/p w -/Version [0-9][0-9]*\.[0-9][0-9]*/s//Version 1.2.0.d20100306/p +/Version [0-9][0-9]*\.[0-9][0-9]*/s//Version 1.3.0/p w q EOF diff --git a/bin/scons-proc.py b/bin/scons-proc.py index 41ff09a..15f22b7 100644 --- a/bin/scons-proc.py +++ b/bin/scons-proc.py @@ -96,6 +96,9 @@ for f in args: content = open(f).read() if content: content = content.replace('&', '&') + # Strip newlines after comments so they don't turn into + # spurious paragraph separators. + content = content.replace('-->\n', '-->') input = xml_preamble + content + xml_postamble try: saxparser.parse(StringIO.StringIO(input)) @@ -178,6 +181,12 @@ class SCons_XML_to_XML(SCons_XML): f.write('<!ENTITY %s%s "<%s>%s</%s>">\n' % (v.prefix, v.idfunc(), v.tag, v.entityfunc(), v.tag)) + if self.env_signatures: + f.write('\n') + for v in self.values: + f.write('<!ENTITY %senv-%s "<%s>env.%s</%s>">\n' % + (v.prefix, v.idfunc(), + v.tag, v.entityfunc(), v.tag)) f.write('\n') f.write(Warning) f.write('\n') @@ -188,6 +197,13 @@ class SCons_XML_to_XML(SCons_XML): (v.prefix, v.idfunc(), v.prefix, v.idfunc(), v.tag, v.entityfunc(), v.tag)) + if self.env_signatures: + f.write('\n') + for v in self.values: + f.write('<!ENTITY %slink-env-%s \'<link linkend="%s%s"><%s>env.%s</%s></link>\'>\n' % + (v.prefix, v.idfunc(), + v.prefix, v.idfunc(), + v.tag, v.entityfunc(), v.tag)) f.write('\n') f.write(Warning) @@ -211,6 +227,11 @@ class SCons_XML_to_man(SCons_XML): body = string.replace(body, '</para>\n', '') body = string.replace(body, '<variablelist>\n', '.RS 10\n') + # Handling <varlistentry> needs to be rationalized and made + # consistent. Right now, the <term> values map to arbitrary, + # ad-hoc idioms in the current man page. + body = re.compile(r'<varlistentry>\n<term><literal>([^<]*)</literal></term>\n<listitem>\n').sub(r'.TP 6\n.B \1\n', body) + body = re.compile(r'<varlistentry>\n<term><parameter>([^<]*)</parameter></term>\n<listitem>\n').sub(r'.IP \1\n', body) body = re.compile(r'<varlistentry>\n<term>([^<]*)</term>\n<listitem>\n').sub(r'.HP 6\n.B \1\n', body) body = string.replace(body, '</listitem>\n', '') body = string.replace(body, '</varlistentry>\n', '') @@ -218,14 +239,16 @@ class SCons_XML_to_man(SCons_XML): body = re.sub(r'\.EE\n\n+(?!\.IP)', '.EE\n.IP\n', body) body = string.replace(body, '\n.IP\n\'\\"', '\n\n\'\\"') - body = re.sub('&(scons|SConstruct|SConscript|jar);', r'\\fB\1\\fP', body) + body = re.sub('&(scons|SConstruct|SConscript|jar|Make|lambda);', r'\\fB\1\\fP', body) + body = re.sub('&(TARGET|TARGETS|SOURCE|SOURCES);', r'\\fB$\1\\fP', body) body = string.replace(body, '&Dir;', r'\fBDir\fP') body = string.replace(body, '⌖', r'\fItarget\fP') body = string.replace(body, '&source;', r'\fIsource\fP') body = re.sub('&b(-link)?-([^;]*);', r'\\fB\2\\fP()', body) body = re.sub('&cv(-link)?-([^;]*);', r'$\2', body) + body = re.sub('&f(-link)?-env-([^;]*);', r'\\fBenv.\2\\fP()', body) body = re.sub('&f(-link)?-([^;]*);', r'\\fB\2\\fP()', body) - body = re.sub(r'<(command|envar|filename|function|literal|option)>([^<]*)</\1>', + body = re.sub(r'<(application|command|envar|filename|function|literal|option)>([^<]*)</\1>', r'\\fB\2\\fP', body) body = re.sub(r'<(classname|emphasis|varname)>([^<]*)</\1>', r'\\fI\2\\fP', body) @@ -233,6 +256,8 @@ class SCons_XML_to_man(SCons_XML): body = re.compile(r'^\\f([BI])(.*)\\fP\s*$', re.M).sub(r'.\1 \2', body) body = re.compile(r'^\\f([BI])(.*)\\fP(\S+)$', re.M).sub(r'.\1R \2 \3', body) body = re.compile(r'^(\S+)\\f([BI])(.*)\\fP$', re.M).sub(r'.R\2 \1 \3', body) + body = re.compile(r'^(\S+)\\f([BI])(.*)\\fP([^\s\\]+)$', re.M).sub(r'.R\2 \1 \3 \4', body) + body = re.compile(r'^(\.R[BI].*[\S])\s+$;', re.M).sub(r'\1', body) body = string.replace(body, '<', '<') body = string.replace(body, '>', '>') body = re.sub(r'\\([^f])', r'\\\\\1', body) @@ -291,14 +316,19 @@ class Function(Proxy): return ['\n', "'\\" + '"'*69 + '\n'] def initial_chunks(self): try: - x = self.arguments + arguments = self.arguments except AttributeError: - x = '()' + arguments = ['()'] result = [] - if self.global_signature != "0": - result.append('.TP\n.RI %s%s\n' % (self.name, x)) - if self.env_signature != "0": - result.append('.TP\n.IR env .%s%s\n' % (self.name, x)) + for arg in arguments: + try: + signature = arg.signature + except AttributeError: + signature = "both" + if signature in ('both', 'global'): + result.append('.TP\n.RI %s%s\n' % (self.name, arg)) + if signature in ('both', 'env'): + result.append('.TP\n.IR env .%s%s\n' % (self.name, arg)) return result class Tool(Proxy): @@ -340,19 +370,23 @@ else: sys.exit(1) if buildersfiles: - g = processor_class([ Builder(b) for b in sorted(h.builders.values()) ]) + g = processor_class([ Builder(b) for b in sorted(h.builders.values()) ], + env_signatures=True) g.write(buildersfiles) if functionsfiles: - g = processor_class([ Function(b) for b in sorted(h.functions.values()) ]) + g = processor_class([ Function(b) for b in sorted(h.functions.values()) ], + env_signatures=True) g.write(functionsfiles) if toolsfiles: - g = processor_class([ Tool(t) for t in sorted(h.tools.values()) ]) + g = processor_class([ Tool(t) for t in sorted(h.tools.values()) ], + env_signatures=False) g.write(toolsfiles) if variablesfiles: - g = processor_class([ Variable(v) for v in sorted(h.cvars.values()) ]) + g = processor_class([ Variable(v) for v in sorted(h.cvars.values()) ], + env_signatures=False) g.write(variablesfiles) # Local Variables: |