# HG changeset patch # User Andre Heinecke # Date 1282657817 0 # Node ID b90bb9f2bb77cac3fc3d8bb1e3d3023cfd37cc5c # Parent e7e0ace683c69ae6fb199cc35f6786153882805b Use the Hashlib module instead of MD5 if the python version is >=2.5 diff -r e7e0ace683c6 -r b90bb9f2bb77 treepkg/util.py --- a/treepkg/util.py Tue Aug 24 10:45:31 2010 +0000 +++ b/treepkg/util.py Tue Aug 24 13:50:17 2010 +0000 @@ -14,9 +14,11 @@ import fnmatch import pwd import os.path -import warnings -warnings.simplefilter("ignore", category=DeprecationWarning) -import md5 +import sys +if sys.version_info < (2, 5): + import md5 +else: + import hashlib import run @@ -167,7 +169,10 @@ raise RuntimeError("Could not create md5sum. File not found: %s" % filename) f = file(filename, 'rb') - m = md5.new() + if sys.version_info < (2, 5): + m = md5.new() + else: + m = hashlib.md5() while True: d = f.read(8096) if not d: