summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt6
-rw-r--r--src/RELEASE.txt18
-rw-r--r--src/engine/SCons/Action.py13
-rw-r--r--src/engine/SCons/ActionTests.py8
-rw-r--r--src/engine/SCons/BuilderTests.py12
-rw-r--r--src/engine/SCons/Environment.py10
-rw-r--r--src/engine/SCons/EnvironmentTests.py4
7 files changed, 45 insertions, 26 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 46177bd..70ba009 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -10,6 +10,12 @@
RELEASE 0.06 -
+ From Charles Crain:
+
+ - Fix command generators to expand construction variables.
+
+ - Make FunctionAction arguments be Nodes, not strings.
+
From Stephen Kennedy:
- Performance: Use a dictionary, not a list, for a Node's parents.
diff --git a/src/RELEASE.txt b/src/RELEASE.txt
index 60aca86..733a2ef 100644
--- a/src/RELEASE.txt
+++ b/src/RELEASE.txt
@@ -20,11 +20,25 @@ more effectively, please sign up for the scons-users mailing list at:
-RELEASE 0.05 - Thu, 21 Feb 2002 16:50:03 -0600
+RELEASE 0.06 -
- This is the fifth alpha release of SCons. Please consult the
+ This is the sixth alpha release of SCons. Please consult the
CHANGES.txt file for a list of specific changes since last release.
+ Please note the following important changes since the previous
+ release:
+
+ - Python functions as Builder actions now take Node objects, not
+ strings, as arguments. The string representation of a Node
+ object is the file name, so you should change your function
+ actions to use the str() built-in function to fetch the file
+ name:
+
+ def build_it(target = None, source = None, env = None):
+ print "Building %s from %s" % (str(target), str(source))
+ open(str(target), 'w').write(open(str(source), 'r').read())
+ return 0
+
Owing to an extensive test suite, the SCons team believes that this
release is of sufficient quality that you can use it for real work,
despite the "alpha" label.
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py
index 26595d6..503fe15 100644
--- a/src/engine/SCons/Action.py
+++ b/src/engine/SCons/Action.py
@@ -383,13 +383,12 @@ class FunctionAction(ActionBase):
# if print_actions:
# XXX: WHAT SHOULD WE PRINT HERE?
if execute_actions:
- if kw.has_key('target'):
- if SCons.Util.is_List(kw['target']):
- kw['target'] = map(str, kw['target'])
- else:
- kw['target'] = str(kw['target'])
- if kw.has_key('source'):
- kw['source'] = map(str, kw['source'])
+ if kw.has_key('target') and not \
+ SCons.Util.is_List(kw['target']):
+ kw['target'] = [ kw['target'] ]
+ if kw.has_key('source') and not \
+ SCons.Util.is_List(kw['source']):
+ kw['source'] = [ kw['source'] ]
return apply(self.function, (), kw)
def get_contents(self, **kw):
diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py
index 592fa82..8b417a8 100644
--- a/src/engine/SCons/ActionTests.py
+++ b/src/engine/SCons/ActionTests.py
@@ -203,12 +203,16 @@ class FunctionActionTestCase(unittest.TestCase):
"""Test executing a function Action
"""
self.inc = 0
- def f(s):
+ def f(s, target, source):
s.inc = s.inc + 1
+ s.target = target
+ s.source=source
return 0
a = SCons.Action.FunctionAction(f)
- a.execute(s = self)
+ a.execute(s = self, target=1, source=2)
assert self.inc == 1, self.inc
+ assert self.source == [2], self.source
+ assert self.target == [1], self.target
def test_get_contents(self):
"""Test fetching the contents of a function Action
diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py
index fc530ab..ab63317 100644
--- a/src/engine/SCons/BuilderTests.py
+++ b/src/engine/SCons/BuilderTests.py
@@ -513,12 +513,10 @@ class BuilderTestCase(unittest.TestCase):
def function2(tlist = [outfile, outfile2], **kw):
global count
count = count + 1
- if not type(kw['target']) is type([]):
- kw['target'] = [ kw['target'] ]
for t in kw['target']:
- open(t, 'w').write("function2\n")
+ open(str(t), 'w').write("function2\n")
for t in tlist:
- if not t in kw['target']:
+ if not t in map(str, kw['target']):
open(t, 'w').write("function2\n")
return 1
@@ -543,12 +541,10 @@ class BuilderTestCase(unittest.TestCase):
def function3(tlist = [sub1_out, sub2_out], **kw):
global count
count = count + 1
- if not type(kw['target']) is type([]):
- kw['target'] = [ kw['target'] ]
for t in kw['target']:
- open(t, 'w').write("function3\n")
+ open(str(t), 'w').write("function3\n")
for t in tlist:
- if not t in kw['target']:
+ if not t in map(str, kw['target']):
open(t, 'w').write("function3\n")
return 1
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index 49249f3..d90e029 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -45,22 +45,22 @@ import shutil
def installFunc(env, target, source):
try:
- os.unlink(target)
+ map(lambda t: os.unlink(str(t)), target)
except OSError:
pass
try:
- SCons.Node.FS.file_link(source[0], target)
+ SCons.Node.FS.file_link(str(source[0]), str(target[0]))
print 'Install file: "%s" as "%s"' % \
- (source[0], target)
+ (source[0], target[0])
return 0
except IOError, e:
sys.stderr.write('Unable to install "%s" as "%s"\n%s\n' % \
- (source[0], target, str(e)))
+ (source[0], target[0], str(e)))
return -1
except OSError, e:
sys.stderr.write('Unable to install "%s" as "%s"\n%s\n' % \
- (source[0], target, str(e)))
+ (source[0], target[0], str(e)))
return -1
InstallBuilder = SCons.Builder.Builder(name='Install',
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 40945a1..4917c83 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -295,8 +295,8 @@ class EnvironmentTestCase(unittest.TestCase):
assert 'foo2.in' in map(lambda x: x.path, t.sources)
def testFunc(env, target, source):
- assert target == 'foo.out'
- assert 'foo1.in' in source and 'foo2.in' in source, source
+ assert str(target[0]) == 'foo.out'
+ assert 'foo1.in' in map(str, source) and 'foo2.in' in map(str, source), map(str, source)
return 0
t = env.Command(target='foo.out', source=['foo1.in','foo2.in'],
action=testFunc)