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