From dc84e02b5577e2fd3ffa8393970dbe0cd553c6d6 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Mon, 8 Mar 2010 16:56:14 +0000 Subject: [PATCH] Handle different signatures for global or env versions of functions by the signature specification from the tag to the tag. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4699 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- bin/SConsDoc.py | 16 +++++++--------- bin/scons-proc.py | 17 +++++++++++------ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/bin/SConsDoc.py b/bin/SConsDoc.py index cd78195a..3f64a258 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/scons-proc.py b/bin/scons-proc.py index 41ff09a5..a02ee6d2 100644 --- a/bin/scons-proc.py +++ b/bin/scons-proc.py @@ -291,14 +291,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): -- 2.26.2