[Treepkg-commits] r417 - trunk/treepkg
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Aug 24 15:50:17 CEST 2010
Author: aheinecke
Date: 2010-08-24 15:50:17 +0200 (Tue, 24 Aug 2010)
New Revision: 417
Modified:
trunk/treepkg/util.py
Log:
Use the Hashlib module instead of MD5 if the python version is >=2.5
Modified: trunk/treepkg/util.py
===================================================================
--- trunk/treepkg/util.py 2010-08-24 10:45:31 UTC (rev 416)
+++ trunk/treepkg/util.py 2010-08-24 13:50:17 UTC (rev 417)
@@ -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:
More information about the Treepkg-commits
mailing list