summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-10-01 04:01:09 (GMT)
committerSteven Knight <knight@baldmt.com>2001-10-01 04:01:09 (GMT)
commit97446895b5e0d92057123a962f45856009ff6bb9 (patch)
tree7d3bc4f0cf06888788b9c97839fcf7aee258cff3 /src/script
parent5029b0d71e078e84d0513987860fdea1b72e40cc (diff)
downloadSCons-97446895b5e0d92057123a962f45856009ff6bb9.zip
SCons-97446895b5e0d92057123a962f45856009ff6bb9.tar.gz
SCons-97446895b5e0d92057123a962f45856009ff6bb9.tar.bz2
Pass in the signature Calculator to the Taskmaster.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/scons.py45
1 files changed, 12 insertions, 33 deletions
diff --git a/src/script/scons.py b/src/script/scons.py
index 85f869c..fbb7341 100644
--- a/src/script/scons.py
+++ b/src/script/scons.py
@@ -39,18 +39,21 @@ class Task:
class Taskmaster:
"XXX: this is here only until the build engine is implemented"
- def __init__(self, targets):
+ def __init__(self, targets, calc):
self.targets = targets
+ self.calc = calc
self.num_iterated = 0
def next_task(self):
- if self.num_iterated == len(self.targets):
- return None
- else:
- current = self.num_iterated
+ while self.num_iterated < len(self.targets):
+ t = self.targets[self.num_iterated]
self.num_iterated = self.num_iterated + 1
- return Task(self.targets[current])
+ if self.calc.current(t):
+ print 'scons: "%s" is up to date.' % t
+ else:
+ return Task(t)
+ return None
def is_blocked(self):
return 0
@@ -583,34 +586,10 @@ def main():
if not targets:
targets = default_targets
- # XXX Right now, this next block prints all "up to date" messages
- # first, and then goes through and builds the other nodes:
- #
- # $ scons aaa bbb ccc ddd
- # scons: "aaa" is up to date.
- # scons: "ccc" is up to date.
- # cc -o bbb bbb.c
- # cc -o ddd ddd.c
- #
- # When we get the real Task and Taskmaster classes, this should
- # be changed to interact with the engine to deal with targets in
- # the same order as specified:
- #
- # $ scons aaa bbb ccc ddd
- # scons: "aaa" is up to date.
- # cc -o bbb bbb.c
- # scons: "ccc" is up to date.
- # cc -o ddd ddd.c
- #
+ nodes = map(lambda x: SCons.Node.FS.default_fs.File(x), targets)
calc = SCons.Sig.Calculator(SCons.Sig.MD5)
- nodes = []
- for t in map(lambda x: SCons.Node.FS.default_fs.File(x), targets):
- if calc.current(t):
- print 'scons: "%s" is up to date.' % t.path
- else:
- nodes.append(t)
-
- taskmaster = Taskmaster(nodes)
+
+ taskmaster = Taskmaster(nodes, calc)
jobs = SCons.Job.Jobs(num_jobs, taskmaster)
jobs.start()