git://git.onelab.eu
/
bootmanager.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hashlib not avail. on python2.4/centos5
[bootmanager.git]
/
source
/
utils.py
diff --git
a/source/utils.py
b/source/utils.py
index
6cd286a
..
0ee2008
100644
(file)
--- a/
source/utils.py
+++ b/
source/utils.py
@@
-16,7
+16,6
@@
import socket
import fcntl
import string
import exceptions
import fcntl
import string
import exceptions
-import hashlib
from Exceptions import *
from Exceptions import *
@@
-255,7
+254,12
@@
def check_file_hash(filename, hash_filename):
def sha1_file(filename):
"""Calculate sha1 hash of file."""
try:
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
f = file(filename, 'rb')
while True:
# 256 KB seems ideal for speed/memory tradeoff