for t in tlist:
t.builder_set(self)
t.env_set(env)
- t.derived = 1
t.add_source(slist)
if len(tlist) == 1:
def __init__(self, name):
self.name = name
self.sources = []
- self.derived = 0
+ self.builder = None
def __str__(self):
return self.name
def builder_set(self, builder):
assert n1.env == env
assert n1.builder == builder
assert n1.sources == [n2]
- assert n1.derived == 1
def test_action(self):
"""Test Builder creation
env = Environment()
t = env.Command(target='foo.out', source=['foo1.in', 'foo2.in'],
action='buildfoo $target $source')
- assert t.derived
+ assert t.builder
assert t.builder.action.__class__.__name__ == 'CommandAction'
assert t.builder.action.command == 'buildfoo $target $source'
assert 'foo1.in' in map(lambda x: x.path, t.sources)
def __init__(self):
self.sources = []
self.depends = []
- self.derived = 0
+ self.builder = None
self.env = None
self.state = None
def build(self):
- if not hasattr(self, "builder"):
+ if not self.builder:
return None
sources_str = string.join(map(lambda x: str(x), self.sources))
stat = self.builder.execute(env = self.env.Dictionary(),
class DummyFile:
"""A class that simulates a file for testing purposes"""
- def __init__(self, path, contents, timestamp, derived):
+ def __init__(self, path, contents, timestamp, builder):
self.path = path
self.contents = contents
self.timestamp = timestamp
- self.derived = derived
+ self.builder = builder
def modify(self, contents, timestamp):
self.contents = contents
def __init__(self, file):
self.file = file
self.path = file.path
- self.derived = file.derived
+ self.builder = file.builder
self.depends = []
def get_contents(self):
if node.has_signature():
sig = node.get_signature()
- elif node.derived:
+ elif node.builder:
signatures = {}
self.collect(node, signatures)
signatures = filter(lambda x: not x is None, signatures.values())
newtime = node.get_timestamp()
- if not node.derived and newtime == oldtime:
+ if not node.builder and newtime == oldtime:
newsig = oldsig
else:
newsig = self.signature(node)
class CleanTask(SCons.Taskmaster.Task):
"""An SCons clean task."""
def execute(self):
- if hasattr(self.target, "builder"):
+ if self.target.builder:
os.unlink(self.target.path)
print "Removed " + self.target.path