From 752a625ee736a0c7199c2cc25655062c842e6661 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 7 Jul 2010 09:33:17 +0000 Subject: [PATCH] hashlib not avail. on python2.4/centos5 --- source/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/utils.py b/source/utils.py index 6cd286a..0ee2008 100644 --- a/source/utils.py +++ b/source/utils.py @@ -16,7 +16,6 @@ import socket import fcntl import string import exceptions -import hashlib from Exceptions import * @@ -255,7 +254,12 @@ def check_file_hash(filename, hash_filename): def sha1_file(filename): """Calculate sha1 hash of file.""" try: - m = hashlib.sha1() + try: + import hashlib + m = hashlib.sha1() + except: + import sha + m=sha.new() f = file(filename, 'rb') while True: # 256 KB seems ideal for speed/memory tradeoff -- 2.43.0