summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Sig
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-05-17 20:45:44 (GMT)
committerSteven Knight <knight@baldmt.com>2003-05-17 20:45:44 (GMT)
commita4a6636bb15d7544abb5ee360aff6c7bb9ee21be (patch)
tree7949132a4d080294d4cfdfd59528d1f4fe03a106 /src/engine/SCons/Sig
parent178bb4ca29174ac1913693343f5d1eb1a3c18237 (diff)
downloadSCons-a4a6636bb15d7544abb5ee360aff6c7bb9ee21be.zip
SCons-a4a6636bb15d7544abb5ee360aff6c7bb9ee21be.tar.gz
SCons-a4a6636bb15d7544abb5ee360aff6c7bb9ee21be.tar.bz2
Eliminate redundant signature calculations, optimize out use of hasattr().
Diffstat (limited to 'src/engine/SCons/Sig')
-rw-r--r--src/engine/SCons/Sig/MD5.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/engine/SCons/Sig/MD5.py b/src/engine/SCons/Sig/MD5.py
index 5239dab..c50dbb7 100644
--- a/src/engine/SCons/Sig/MD5.py
+++ b/src/engine/SCons/Sig/MD5.py
@@ -78,9 +78,11 @@ def collect(signatures):
def signature(obj):
"""Generate a signature for an object
"""
- if not hasattr(obj, 'get_contents'):
+ try:
+ contents = str(obj.get_contents())
+ except AttributeError:
raise AttributeError, "unable to fetch contents of '%s'" % str(obj)
- return hexdigest(md5.new(str(obj.get_contents())).digest())
+ return hexdigest(md5.new(contents).digest())
def to_string(signature):
"""Convert a signature to a string"""