diff options
author | Steven Knight <knight@baldmt.com> | 2002-01-02 00:01:06 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-01-02 00:01:06 (GMT) |
commit | a63609706a54d139003eb14f34a88389ebbe58cc (patch) | |
tree | 85d56ee36ed901c5c6d97da9db31062c836fbb2a | |
parent | da4be3de794582467d2e41e49600e45b704a0452 (diff) | |
download | SCons-a63609706a54d139003eb14f34a88389ebbe58cc.zip SCons-a63609706a54d139003eb14f34a88389ebbe58cc.tar.gz SCons-a63609706a54d139003eb14f34a88389ebbe58cc.tar.bz2 |
Append suffixes to white-space separated source files that don't have suffixes.
-rw-r--r-- | src/CHANGES.txt | 4 | ||||
-rw-r--r-- | src/engine/SCons/Builder.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/BuilderTests.py | 34 |
3 files changed, 39 insertions, 1 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index a524e5f..dfcf395 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -15,6 +15,10 @@ RELEASE 0.03 - - Search both /usr/lib and /usr/local/lib for scons directories by adding them both to sys.path, with whichever is in sys.prefix first. + - Fix interpreting strings of multiple white-space separated file names + as separate file names, allowing prefixes and suffixes to be appended + to each individually. + From Anthony Roach: - Add a "duplicate" keyword argument to BuildDir() that can be set diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index 2f93723..eceb66a 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -172,6 +172,8 @@ class BuilderBase: def __call__(self, env, target = None, source = None): def adjustixes(files, pre, suf): ret = [] + if type(files) is types.StringType or isinstance(files, UserString): + files = string.split(files) if not type(files) is type([]): files = [files] for f in files: diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py index ad13dd7..9f2183f 100644 --- a/src/engine/SCons/BuilderTests.py +++ b/src/engine/SCons/BuilderTests.py @@ -91,7 +91,8 @@ class BuilderTestCase(unittest.TestCase): self.env = env def add_source(self, source): self.sources.extend(source) - builder = SCons.Builder.Builder(action = "foo") + builder = SCons.Builder.Builder(action = "foo", node_factory = Node) + n1 = Node("n1"); n2 = Node("n2"); builder(env, target = n1, source = n2) @@ -100,6 +101,21 @@ class BuilderTestCase(unittest.TestCase): assert n1.sources == [n2] assert n2.env == env + target = builder(env, target = 'n3', source = 'n4') + assert target.name == 'n3' + assert target.sources[0].name == 'n4' + + targets = builder(env, target = 'n4 n5', source = ['n6 n7']) + assert targets[0].name == 'n4' + assert targets[0].sources[0].name == 'n6 n7' + assert targets[1].name == 'n5' + assert targets[1].sources[0].name == 'n6 n7' + + target = builder(env, target = ['n8 n9'], source = 'n10 n11') + assert target.name == 'n8 n9' + assert target.sources[0].name == 'n10' + assert target.sources[1].name == 'n11' + def test_action(self): """Test Builder creation @@ -360,6 +376,11 @@ class BuilderTestCase(unittest.TestCase): tgt = builder(env, target = 'tgt1', source = 'src1') assert tgt.path == 'libtgt1', \ "Target has unexpected name: %s" % tgt.path + tgts = builder(env, target = 'tgt2a tgt2b', source = 'src2') + assert tgts[0].path == 'libtgt2a', \ + "Target has unexpected name: %s" % tgts[0].path + assert tgts[1].path == 'libtgt2b', \ + "Target has unexpected name: %s" % tgts[1].path def test_src_suffix(self): """Test Builder creation with a specified source file suffix @@ -374,6 +395,11 @@ class BuilderTestCase(unittest.TestCase): tgt = builder(env, target = 'tgt2', source = 'src2') assert tgt.sources[0].path == 'src2.c', \ "Source has unexpected name: %s" % tgt.sources[0].path + tgt = builder(env, target = 'tgt3', source = 'src3a src3b') + assert tgt.sources[0].path == 'src3a.c', \ + "Sources[0] has unexpected name: %s" % tgt.sources[0].path + assert tgt.sources[1].path == 'src3b.c', \ + "Sources[1] has unexpected name: %s" % tgt.sources[1].path def test_suffix(self): """Test Builder creation with a specified target suffix @@ -388,6 +414,12 @@ class BuilderTestCase(unittest.TestCase): tgt = builder(env, target = 'tgt3', source = 'src3') assert tgt.path == 'tgt3.o', \ "Target has unexpected name: %s" % tgt[0].path + tgts = builder(env, target = 'tgt4a tgt4b', source = 'src4') + assert tgts[0].path == 'tgt4a.o', \ + "Target has unexpected name: %s" % tgts[0].path + tgts = builder(env, target = 'tgt4a tgt4b', source = 'src4') + assert tgts[1].path == 'tgt4b.o', \ + "Target has unexpected name: %s" % tgts[1].path def test_MultiStepBuilder(self): """Testing MultiStepBuilder class.""" |