1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

core: fix the dgst_from_string function for Python 2.4 compatibility. It can't

have worked and must have returned empty md5 hashes, and I assume that the
function isn't actually used anywhere.
This commit is contained in:
Dr. Peter Poeml 2009-06-05 11:29:11 +00:00
parent 9ef41fde95
commit 35be8342e3

View File

@ -2291,15 +2291,16 @@ def get_binary_file(apiurl, prj, repo, arch,
except: pass except: pass
def dgst_from_string(str): def dgst_from_string(str):
# Python 2.5 depracates the md5 modules
# Python 2.4 doesn't have hashlib yet
try: try:
import hashlib import hashlib
md5 = hashlib md5_hash = hashlib.md5()
except ImportError: except ImportError:
import md5 import md5
md5 = md5 md5_hash = md5.new()
s = md5.md5() md5_hash.update(str)
s.update(str) return md5_hash.hexdigest()
return s.hexdigest()
def dgst(file): def dgst(file):