3 The MD5 signature package for the SCons software construction
8 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
13 def current(obj, sig):
14 """Return whether a given object is up-to-date with the
17 return obj.get_signature() == sig
20 """Return a signature as a string of hex characters.
22 # NOTE: This routine is a method in the Python 2.0 interface
23 # of the native md5 module, but we want SCons to operate all
24 # the way back to at least Python 1.5.2, which doesn't have it.
29 r = r + h[(i >> 4) & 0xF] + h[i & 0xF]
32 def collect(signatures):
34 Collect a list of signatures into an aggregate signature.
36 signatures - a list of signatures
37 returns - the aggregate signature
39 if len(signatures) == 1:
42 contents = string.join(signatures, ', ')
43 return hexdigest(md5.new(contents).digest())
46 """Generate a signature for an object
48 return hexdigest(md5.new(obj.get_contents()).digest())
50 def to_string(signature):
51 """Convert a signature to a string"""
54 def from_string(string):
55 """Convert a string to a signature"""