Blame third_party/waf/waflib/extras/build_file_tracker.py
|
rpm-build |
95f51c |
#! /usr/bin/env python
|
|
rpm-build |
95f51c |
# encoding: utf-8
|
|
rpm-build |
95f51c |
# Thomas Nagy, 2015
|
|
rpm-build |
95f51c |
|
|
rpm-build |
95f51c |
"""
|
|
rpm-build |
95f51c |
Force files to depend on the timestamps of those located in the build directory. You may
|
|
rpm-build |
95f51c |
want to use this to force partial rebuilds, see playground/track_output_files/ for a working example.
|
|
rpm-build |
95f51c |
|
|
rpm-build |
95f51c |
Note that there is a variety of ways to implement this, one may want use timestamps on source files too for example,
|
|
rpm-build |
95f51c |
or one may want to hash the files in the source directory only under certain conditions (md5_tstamp tool)
|
|
rpm-build |
95f51c |
or to hash the file in the build directory with its timestamp
|
|
rpm-build |
95f51c |
"""
|
|
rpm-build |
95f51c |
|
|
rpm-build |
95f51c |
import os
|
|
rpm-build |
95f51c |
from waflib import Node, Utils
|
|
rpm-build |
95f51c |
|
|
rpm-build |
95f51c |
def get_bld_sig(self):
|
|
rpm-build |
95f51c |
if not self.is_bld() or self.ctx.bldnode is self.ctx.srcnode:
|
|
rpm-build |
95f51c |
return Utils.h_file(self.abspath())
|
|
rpm-build |
95f51c |
|
|
rpm-build |
95f51c |
try:
|
|
rpm-build |
95f51c |
# add the creation time to the signature
|
|
rpm-build |
95f51c |
return self.sig + str(os.stat(self.abspath()).st_mtime)
|
|
rpm-build |
95f51c |
except AttributeError:
|
|
rpm-build |
95f51c |
return None
|
|
rpm-build |
95f51c |
|
|
rpm-build |
95f51c |
Node.Node.get_bld_sig = get_bld_sig
|
|
rpm-build |
95f51c |
|