diff options
author | Marcin Juszkiewicz <marcin@juszkiewicz.com.pl> | 2009-05-12 08:25:13 +0000 |
---|---|---|
committer | Marcin Juszkiewicz <hrw@openembedded.org> | 2009-05-14 17:22:52 +0200 |
commit | a52a4633c2ddc11589ebc88d7839c68de599faf8 (patch) | |
tree | 794d22cd8cc4626879bd80dedb660e04e5af2f05 /classes | |
parent | 942330dd5ae159dc9b96d79ec3ec567201200518 (diff) | |
download | openembedded-a52a4633c2ddc11589ebc88d7839c68de599faf8.tar.gz |
patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning
Patch.bbclass change removes DeprecationWarnings too but has to keep
compatibility with Python 2.4 so I had to use try/except block because
hashlib is 2.5+
Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Acked-by: Koen Kooi <koen@openembedded.org>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'classes')
-rw-r--r-- | classes/patch.bbclass | 12 |
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: |