From: Thierry Parmentelat Date: Wed, 7 Jul 2010 09:33:17 +0000 (+0000) Subject: hashlib not avail. on python2.4/centos5 X-Git-Tag: BootManager-5.0-6~2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=752a625ee736a0c7199c2cc25655062c842e6661;hp=1649b72b761622698b57628c5e1973a1f8e52966;p=bootmanager.git hashlib not avail. on python2.4/centos5 --- 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