summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-05-16 11:09:27 (GMT)
committerSteven Knight <knight@baldmt.com>2003-05-16 11:09:27 (GMT)
commit487877ee4058bf8586c3a44b44202d161ec2441f (patch)
tree5dc7d3bcddf8c0d3221a073fc016492d768f286b
parentbc2756c1cb3a48d9fdcbd6d85c43fc3276fc7e96 (diff)
downloadSCons-487877ee4058bf8586c3a44b44202d161ec2441f.zip
SCons-487877ee4058bf8586c3a44b44202d161ec2441f.tar.gz
SCons-487877ee4058bf8586c3a44b44202d161ec2441f.tar.bz2
Have the Tool() method add the tool name to the construction variable. (David Snopek)
-rw-r--r--doc/man/scons.119
-rw-r--r--src/CHANGES.txt3
-rw-r--r--src/engine/SCons/Tool/ToolTests.py3
-rw-r--r--src/engine/SCons/Tool/__init__.py6
4 files changed, 30 insertions, 1 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1
index 99ddfa0..ec28669 100644
--- a/doc/man/scons.1
+++ b/doc/man/scons.1
@@ -2944,6 +2944,10 @@ The command line used to call the TeX formatter and typesetter.
.IP TEXFLAGS
General options passed to the TeX formatter and typesetter.
+.IP TOOLS
+A list of the names of the Tool specifications
+that are part of this construction environment.
+
.IP WIN32_INSERT_DEF
When this is set to true,
a library build of a WIN32 shared library (.dll file)
@@ -4170,6 +4174,21 @@ tools keyword of the Environment() method.
env = Environment(tools = [ Tool('msvc') ])
.EE
+The object may be called with a construction
+environment as an argument,
+in which case the object will be
+add the necessary variables
+to the construction environment
+and the name of the tool will be added to the
+.B $TOOLS
+construction variable.
+
+.ES
+env = Environment()
+t = Tool('msvc')
+t(env) # adds 'msvc' to the TOOLS variable
+.EE
+
.TP
.RI Value( value )
Returns a Node object representing the specified Python value. Value
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 3ae491f..6c84af6 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -123,6 +123,9 @@ RELEASE 0.14 - XXX
- Contribute the "Autoscons" code for Autoconf-like checking for
the existence of libraries, header files and the like.
+ - Have the Tool() function add the tool name to the $TOOLS
+ construction variable.
+
From Greg Spencer:
- Support the C preprocessor #import statement.
diff --git a/src/engine/SCons/Tool/ToolTests.py b/src/engine/SCons/Tool/ToolTests.py
index c53ada3..cd809df 100644
--- a/src/engine/SCons/Tool/ToolTests.py
+++ b/src/engine/SCons/Tool/ToolTests.py
@@ -39,6 +39,8 @@ class ToolTestCase(unittest.TestCase):
if not SCons.Util.is_List(progs):
progs = [ progs ]
return progs[0]
+ def Append(self, **kw):
+ self.dict.update(kw)
def __getitem__(self, key):
return self.dict[key]
def __setitem__(self, key, val):
@@ -52,6 +54,7 @@ class ToolTestCase(unittest.TestCase):
assert (env['CXX'] == 'c++' or env['CXX'] == 'g++'), env['CXX']
assert env['CXXFLAGS'] == '$CCFLAGS', env['CXXFLAGS']
assert env['INCPREFIX'] == '-I', env['INCPREFIX']
+ assert env['TOOLS'] == ['g++'], env['TOOLS']
try:
SCons.Tool.Tool()
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index 908101e..7cf9b29 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -48,6 +48,10 @@ class ToolSpec:
def __init__(self, name):
self.name = name
+ def __call__(self, env, *args, **kw):
+ env.Append(TOOLS = [ self.name ])
+ apply(self.generate, ( env, ) + args, kw)
+
def __str__(self):
return self.name
@@ -66,7 +70,7 @@ def Tool(name):
if file:
file.close()
spec = ToolSpec(name)
- spec.__call__ = sys.modules[full_name].generate
+ spec.generate = sys.modules[full_name].generate
spec.exists = sys.modules[full_name].exists
return spec