ba6d752894949d3c1e7485f126ce219e77023ec5
[samba.git] / third_party / waf / wafadmin / 3rdparty / paranoid.py
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # ita 2010
4
5 import Logs, Utils, Build, Task
6
7 def say(txt):
8         Logs.warn("^o^: %s" % txt)
9
10 try:
11         ret = Utils.cmd_output('which cowsay 2> /dev/null').strip()
12 except Exception, e:
13         pass
14 else:
15         def say(txt):
16                 f = Utils.cmd_output([ret, txt])
17                 Utils.pprint('PINK', f)
18
19 say('you make the errors, we detect them')
20
21 def check_task_classes(self):
22         for x in Task.TaskBase.classes:
23                 if isinstance(x, Task.Task):
24                         if not getattr(cls, 'ext_in', None) or getattr(cls, 'before', None):
25                                 say('class %s has no precedence constraints (ext_in/before)')
26                         if not getattr(cls, 'ext_out', None) or getattr(cls, 'after', None):
27                                 say('class %s has no precedence constraints (ext_out/after)')
28
29 comp = Build.BuildContext.compile
30 def compile(self):
31         if not getattr(self, 'magic', None):
32                 check_task_classes(self)
33         return comp(self)
34 Build.BuildContext.compile = compile