3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
9 Re-calculate md5 hashes of files only when the file times or the file
12 The hashes can also reflect either the file contents (STRONGEST=True) or the
13 file time and file size.
15 The performance benefits of this module are usually insignificant.
19 from waflib import Utils, Build, Node
23 Build.SAVED_ATTRS.append('hashes_md5_tstamp')
25 filename = self.abspath()
26 st = os.stat(filename)
28 cache = self.ctx.hashes_md5_tstamp
29 if filename in cache and cache[filename][0] == st.st_mtime:
30 return cache[filename][1]
33 ret = Utils.h_file(filename)
35 if stat.S_ISDIR(st[stat.ST_MODE]):
36 raise IOError('Not a file')
37 ret = Utils.md5(str((st.st_mtime, st.st_size)).encode()).digest()
39 cache[filename] = (st.st_mtime, ret)
41 h_file.__doc__ = Node.Node.h_file.__doc__
42 Node.Node.h_file = h_file