[oe-commits] Marcin Juszkiewicz : patch.bbclass: use hashlib with Python 2. 5+ - removes DeprecationWarning
GIT User account
git at amethyst.openembedded.net
Tue May 12 16:41:16 UTC 2009
Module: openembedded.git
Branch: org.openembedded.dev
Commit: 71997fc5fe0928bf8907791d8ff79c6b50acd207
URL: http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=71997fc5fe0928bf8907791d8ff79c6b50acd207
Author: Marcin Juszkiewicz <marcin at juszkiewicz.com.pl>
Date: Tue May 12 18:30:18 2009 +0200
patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning
---
classes/patch.bbclass | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/classes/patch.bbclass b/classes/patch.bbclass
index 075e826..8d2bde0 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:
More information about the Openembedded-commits
mailing list