wscript 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #! /usr/bin/env python
  2. def configure(conf):
  3. pass
  4. def build(bld):
  5. bld.process(name='foo', version='1.0')
  6. bld.process(name='bar', use='foo')
  7. ########################################################################
  8. # user api
  9. from waflib.Build import BuildContext
  10. def process(ctx, *k, **kw):
  11. kw['features'] = 'proc'
  12. return ctx(*k, **kw)
  13. BuildContext.process = process
  14. # create the tasks
  15. from waflib.TaskGen import feature
  16. @feature('proc')
  17. def create_a_few_tasks(self):
  18. fetch = self.create_task('process')
  19. fetch.outputs = [self.path.find_or_declare(self.name + '.fetch')]
  20. fetch.env.A = getattr(self, 'version', '') # rebuild if changes
  21. configure = self.create_task('process', fetch.outputs)
  22. configure.outputs = [self.path.find_or_declare(self.name + '.configure')]
  23. build = self.create_task('process', configure.outputs)
  24. build.outputs = [self.path.find_or_declare(self.name + '.build')]
  25. self.install = install = self.create_task('process', build.outputs)
  26. install.outputs = [self.path.find_or_declare(self.name + '.install')]
  27. if getattr(self, 'use', None):
  28. lst = self.to_list(self.use)
  29. for x in lst:
  30. tg = self.bld.get_tgen_by_name(x)
  31. fetch.inputs.extend(tg.install.outputs)
  32. # task classes
  33. from waflib.Task import Task
  34. class process(Task):
  35. vars = ['A', 'B'] # change env.A to trigger a rebuild...
  36. def run(self):
  37. # add your operations here
  38. self.outputs[0].write('all ok')