summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-03-08 16:56:14 +0000
committerSteven Knight <knight@baldmt.com>2010-03-08 16:56:14 +0000
commit3973a0213e24c366351ba93534e788c8a466f150 (patch)
tree897920db7cde361e044b8ab788ecef0878f04694 /bin
parent49d1001e0b33497cbf4eac79c1246d0a62a9c130 (diff)
downloadscons-3973a0213e24c366351ba93534e788c8a466f150.tar.gz
Handle different signatures for global or env versions of functions
by the signature specification from the <scons_function> tag to the <arguments> tag.
Diffstat (limited to 'bin')
-rw-r--r--bin/SConsDoc.py16
-rw-r--r--bin/scons-proc.py17
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):