diff options
author | Steven Knight <knight@baldmt.com> | 2001-09-17 04:57:00 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2001-09-17 04:57:00 (GMT) |
commit | 3c81bb2bd0e009c0ee81570e17b0f87ad8d034ab (patch) | |
tree | 1a08c189644909cdadc489cce0eaa487e2c6f578 /src/engine/SCons/Sig/MD5.py | |
parent | e2faf9c21bc7712fcdc547b7df0f12a6b2177601 (diff) | |
download | SCons-3c81bb2bd0e009c0ee81570e17b0f87ad8d034ab.zip SCons-3c81bb2bd0e009c0ee81570e17b0f87ad8d034ab.tar.gz SCons-3c81bb2bd0e009c0ee81570e17b0f87ad8d034ab.tar.bz2 |
Run setup.py on the unpacked .tar.gz for testing.
Diffstat (limited to 'src/engine/SCons/Sig/MD5.py')
-rw-r--r-- | src/engine/SCons/Sig/MD5.py | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/engine/SCons/Sig/MD5.py b/src/engine/SCons/Sig/MD5.py new file mode 100644 index 0000000..9d461d9 --- /dev/null +++ b/src/engine/SCons/Sig/MD5.py @@ -0,0 +1,70 @@ +"""SCons.Sig.MD5 + +The MD5 signature package for the SCons software construction +utility. + +""" + +__revision__ = "Sig/MD5.py __REVISION__ __DATE__ __DEVELOPER__" + +import md5 +import string + + + +def hexdigest(s): + """Return a signature as a string of hex characters. + """ + # NOTE: This routine is a method in the Python 2.0 interface + # of the native md5 module, but we want SCons to operate all + # the way back to at least Python 1.5.2, which doesn't have it. + h = string.hexdigits + r = '' + for c in s: + i = ord(c) + r = r + h[(i >> 4) & 0xF] + h[i & 0xF] + return r + + + +def _init(): + pass # XXX + +def _end(): + pass # XXX + +def current(obj, sig): + """Return whether a given object is up-to-date with the + specified signature. + """ + return obj.signature() == sig + +def set(): + pass # XXX + +def invalidate(): + pass # XXX + +def collect(*objects): + """Collect signatures from a list of objects, returning the + aggregate signature of the list. + """ + if len(objects) == 1: + sig = objects[0].signature() + else: + contents = string.join(map(lambda o: o.signature(), objects), ', ') + sig = signature(contents) +# if debug: +# pass + return sig + +def signature(contents): + """Generate a signature for a byte string. + """ + return hexdigest(md5.new(contents).digest()) + +def cmdsig(): + pass # XXX + +def srcsig(): + pass # XXX |