summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <marcin@juszkiewicz.com.pl>2009-05-12 18:30:18 +0200
committerMarcin Juszkiewicz <hrw@openembedded.org>2009-05-12 18:35:10 +0200
commit71997fc5fe0928bf8907791d8ff79c6b50acd207 (patch)
treed409eff673b026443d08e5507ba62a6f6e286b3f
parentb5f722ac2fc7438c987ef0a621aa671987397c8e (diff)
patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning
-rw-r--r--classes/patch.bbclass12
1 files changed, 10 insertions, 2 deletions
diff --git a/classes/patch.bbclass b/classes/patch.bbclass
index 075e826523..8d2bde0c4f 100644
--- a/classes/patch.bbclass
+++ b/classes/patch.bbclass
@@ -13,14 +13,22 @@ def patch_init(d):
return "Error: %s not found." % self.path
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()
try:
f = file(fname, 'rb')
except IOError:
raise NotFoundError(fname)
- m = md5.new()
while True:
d = f.read(8096)
if not d: