DScan.add_skey('.x') => env.Append(DSUFFIXES = ['.x'])
FortranScan.add_skey('.x') => env.Append(FORTRANSUFFIXES = ['.x'])
+ - The internal "node_factory" keyword argument has been removed;
+ the seperate and more flexible "target_factory" and "source_factory"
+ keywords should be used instead.
+
- The behavior of the env.Append() and env.Prepend() methods has
changed when appending a string value to a UserList, or vice versa.
They now behave like normal Python addition of a string to
prefix = '',
suffix = '',
src_suffix = '',
- node_factory = SCons.Node.FS.default_fs.File,
- target_factory = None,
- source_factory = None,
+ target_factory = SCons.Node.FS.default_fs.File,
+ source_factory = SCons.Node.FS.default_fs.File,
scanner = None,
emitter = None,
multi = 0,
self.set_src_suffix(src_suffix)
- self.target_factory = target_factory or node_factory
- self.source_factory = source_factory or node_factory
+ self.target_factory = target_factory
+ self.source_factory = source_factory
self.scanner = scanner
self.emitter = emitter
prefix = '',
suffix = '',
src_suffix = '',
- node_factory = SCons.Node.FS.default_fs.File,
- target_factory = None,
- source_factory = None,
+ target_factory = SCons.Node.FS.default_fs.File,
+ source_factory = SCons.Node.FS.default_fs.File,
scanner=None,
emitter=None):
if __debug__: logInstanceCreation(self)
BuilderBase.__init__(self, action, prefix, suffix, src_suffix,
- node_factory, target_factory, source_factory,
+ target_factory, source_factory,
scanner, emitter)
if not SCons.Util.is_List(src_builder):
src_builder = [ src_builder ]
"""Test calling a builder to establish source dependencies
"""
env = Environment()
- builder = SCons.Builder.Builder(action="foo", node_factory=MyNode)
+ builder = SCons.Builder.Builder(action="foo",
+ target_factory=MyNode,
+ source_factory=MyNode)
n1 = MyNode("n1");
n2 = MyNode("n2");
assert flag, "UserError should be thrown if a source node can't create a target."
builder = SCons.Builder.Builder(action="foo",
- node_factory=MyNode,
+ target_factory=MyNode,
+ source_factory=MyNode,
prefix='p-',
suffix='.s')
target = builder(env, source='n21')
assert b1 != b3
assert b2 != b3
- def test_node_factory(self):
- """Test a Builder that creates nodes of a specified class
- """
- class Foo:
- pass
- def FooFactory(target):
- global Foo
- return Foo(target)
- builder = SCons.Builder.Builder(node_factory = FooFactory)
- assert builder.target_factory is FooFactory
- assert builder.source_factory is FooFactory
-
def test_target_factory(self):
"""Test a Builder that creates target nodes of a specified class
"""
env = Environment()
builder = SCons.Builder.Builder(action='foo',
emitter=emit,
- node_factory=MyNode)
+ target_factory=MyNode,
+ source_factory=MyNode)
tgt = builder(env, target='foo2', source='bar')
assert str(tgt) == 'foo2', str(tgt)
assert str(tgt.sources[0]) == 'bar', str(tgt.sources[0])
env2=Environment(FOO=emit)
builder2=SCons.Builder.Builder(action='foo',
emitter="$FOO",
- node_factory=MyNode)
+ target_factory=MyNode,
+ source_factory=MyNode)
tgt = builder2(env2, target='foo5', source='bar')
assert str(tgt) == 'foo5', str(tgt)
builder2a=SCons.Builder.Builder(action='foo',
emitter="$FOO",
- node_factory=MyNode)
+ target_factory=MyNode,
+ source_factory=MyNode)
assert builder2 == builder2a, repr(builder2.__dict__) + "\n" + repr(builder2a.__dict__)
# Test that, if an emitter sets a builder on the passed-in
builder3=SCons.Builder.Builder(action='foo',
emitter=emit3,
- node_factory=MyNode)
+ target_factory=MyNode,
+ source_factory=MyNode)
tgt = builder3(env, target=node, source='bar')
assert tgt is new_node, tgt
assert tgt.builder is builder3, tgt.builder
builder4 = SCons.Builder.Builder(action='foo',
emitter={'.4a':emit4a,
'.4b':emit4b},
- node_factory=MyNode)
+ target_factory=MyNode,
+ source_factory=MyNode)
tgt = builder4(env, source='aaa.4a')
assert str(tgt) == 'emit4a-aaa', str(tgt)
tgt = builder4(env, source='bbb.4b')