diff options
author | Steven Knight <knight@baldmt.com> | 2001-11-28 04:47:15 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2001-11-28 04:47:15 (GMT) |
commit | 6b1cb3d8c409854bbeaa06e61fc70435950f8d39 (patch) | |
tree | 51b9c3a9351672b9a6b553d4503c4a668b95459d /src/engine/SCons/Taskmaster.py | |
parent | ad78319ad3ede8f7065f9c945a3585cad04c3731 (diff) | |
download | SCons-6b1cb3d8c409854bbeaa06e61fc70435950f8d39.zip SCons-6b1cb3d8c409854bbeaa06e61fc70435950f8d39.tar.gz SCons-6b1cb3d8c409854bbeaa06e61fc70435950f8d39.tar.bz2 |
Detect dependency cycles
Diffstat (limited to 'src/engine/SCons/Taskmaster.py')
-rw-r--r-- | src/engine/SCons/Taskmaster.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index e7dcfc0..1fb200c 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -33,8 +33,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Node - - +import string +import SCons.Errors +import copy class Task: """Default SCons build engine task. @@ -140,10 +141,20 @@ class Taskmaster: """ def __init__(self, targets=[], tasker=Task, calc=Calc()): + def out_of_date(node): return filter(lambda x: x.get_state() != SCons.Node.up_to_date, node.children()) - self.walkers = map(lambda x, f=out_of_date: SCons.Node.Walker(x, f), + + def cycle_error(node, stack): + if node.builder: + nodes = stack + [node] + nodes.reverse() + desc = "Dependency cycle: " + string.join(map(str, nodes), " -> ") + raise SCons.Errors.UserError, desc + + #XXX In Python 2.2 we can get rid of f1 and f2: + self.walkers = map(lambda x, f1=out_of_date, f2=cycle_error: SCons.Node.Walker(x, f1, f2), targets) self.tasker = tasker self.calc = calc |