1#! /usr/bin/env python
2# encoding: utf-8
3# Thomas Nagy, 2015
4
5"""
6Force files to depend on the timestamps of those located in the build directory. You may
7want to use this to force partial rebuilds, see playground/track_output_files/ for a working example.
8
9Note that there is a variety of ways to implement this, one may want use timestamps on source files too for example,
10or one may want to hash the files in the source directory only under certain conditions (md5_tstamp tool)
11or to hash the file in the build directory with its timestamp
12"""
13
14import os
15from waflib import Node, Utils
16
17def 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
27Node.Node.get_bld_sig = get_bld_sig
28
29