blob: 36e4230e9a4203c2e6bef60c5b784842550f086d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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
|