This commit is contained in:
Thomas Nagy 2016-05-21 12:01:48 +02:00
parent c2646d2380
commit ab9609c0d8
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
2 changed files with 3 additions and 12 deletions

View File

@ -793,6 +793,7 @@ class Node(object):
return self.parent.bldpath()
def h_file(self):
"Wrapper for Utils.h_file"
return Utils.h_file(self.abspath())
def get_bld_sig(self):

View File

@ -231,18 +231,8 @@ def writef(fname, data, m='w', encoding='ISO8859-1'):
def h_file(fname):
"""
Compute a hash value for a file by using md5. This method may be replaced by
a faster version if necessary. The following uses the file size and the timestamp value.
The performance change can be 0.858s to 0.642s on no-op builds::
import stat
from waflib import Utils
def h_file(fname):
st = os.stat(fname)
if stat.S_ISDIR(st[stat.ST_MODE]): raise OSError('not a file')
s = "%s%s%s" % (st.st_mtime, st.st_size, fname)
return Utils.md5(s.encode()).digest()
Utils.h_file = h_file
Compute a hash value for a file by using md5. Use the md5_tstamp
extension to get faster build hashes if necessary.
:type fname: string
:param fname: path to the file to hash