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