jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
987B

  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2015
  4. """
  5. Force files to depend on the timestamps of those located in the build directory. You may
  6. want to use this to force partial rebuilds, see playground/track_output_files/ for a working example.
  7. Note that there is a variety of ways to implement this, one may want use timestamps on source files too for example,
  8. or one may want to hash the files in the source directory only under certain conditions (md5_tstamp tool)
  9. or to hash the file in the build directory with its timestamp (similar to 'update_outputs')
  10. """
  11. import os
  12. from waflib import Node, Utils
  13. def get_bld_sig(self):
  14. try:
  15. return self.cache_sig
  16. except AttributeError:
  17. pass
  18. if not self.is_bld() or self.ctx.bldnode is self.ctx.srcnode:
  19. self.sig = Utils.h_file(self.abspath())
  20. self.cache_sig = ret = self.sig
  21. else:
  22. # add the
  23. self.cache_sig = ret = self.sig + str(os.stat(self.abspath()).st_mtime)
  24. return ret
  25. Node.Node.get_bld_sig = get_bld_sig