Skip to content

Instantly share code, notes, and snippets.

@mirajshah
Created March 21, 2017 05:45
Show Gist options
  • Save mirajshah/2eb4bffe2c0363d67d1ab5af071af4e0 to your computer and use it in GitHub Desktop.
Save mirajshah/2eb4bffe2c0363d67d1ab5af071af4e0 to your computer and use it in GitHub Desktop.
SCons MD5 Decider function to additionally check if targets have changed
def modified_md5_decider(dependency, target, prev_ni):
"""SCons MD5 Decider function that checks if targets have changed"""
# Use default checking for changes in the source file
source_changed = dependency.changed_content(target, prev_ni)
if source_changed:
return source_changed
else:
target_changed = False
# If target node does not implement get_csig(), do not try to determine
# whether to rebuild. (csig = content signature)
try:
target_info = target.get_stored_info()
if target_info.ninfo.csig != target.get_csig():
target_changed = True
except AttributeError:
pass
return target_changed
# Set the SCons Decider function
Decider(modified_md5_decider)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment