summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <marcin@juszkiewicz.com.pl>2009-05-12 18:30:18 +0200
committerMarcin Juszkiewicz <marcin@buglabs.net>2009-07-28 15:01:56 +0200
commit31bdfe582e894a78e63d05dcfbde85d01d34ddb5 (patch)
tree2e21d9241c8dc6dc4d95cc34db5c374ec6ba1d5a
parentd2c268aec84caa3034a4e6e177938afc4fe01f98 (diff)
downloadpoky-31bdfe582e894a78e63d05dcfbde85d01d34ddb5.tar.gz
poky-31bdfe582e894a78e63d05dcfbde85d01d34ddb5.tar.bz2
poky-31bdfe582e894a78e63d05dcfbde85d01d34ddb5.zip
patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning
-rw-r--r--meta/classes/patch.bbclass12
1 files changed, 10 insertions, 2 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 5263089916..a92d26c030 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -7,10 +7,18 @@ def patch_init(d):
import os, sys
def md5sum(fname):
- import md5, sys
+ import sys
+
+ # when we move to Python 2.5 as minimal supported
+ # we can kill that try/except as hashlib is 2.5+
+ try:
+ import hashlib
+ m = hashlib.md5()
+ except ImportError:
+ import md5
+ m = md5.new()
f = file(fname, 'rb')
- m = md5.new()
while True:
d = f.read(8096)
if not d: