diff options
author | Marcin Juszkiewicz <marcin@juszkiewicz.com.pl> | 2009-05-12 18:30:18 +0200 |
---|---|---|
committer | Marcin Juszkiewicz <marcin@buglabs.net> | 2009-07-28 15:01:56 +0200 |
commit | 31bdfe582e894a78e63d05dcfbde85d01d34ddb5 (patch) | |
tree | 2e21d9241c8dc6dc4d95cc34db5c374ec6ba1d5a | |
parent | d2c268aec84caa3034a4e6e177938afc4fe01f98 (diff) | |
download | poky-31bdfe582e894a78e63d05dcfbde85d01d34ddb5.tar.gz |
patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning
-rw-r--r-- | meta/classes/patch.bbclass | 12 |
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): | |||
7 | import os, sys | 7 | import os, sys |
8 | 8 | ||
9 | def md5sum(fname): | 9 | def md5sum(fname): |
10 | import md5, sys | 10 | import sys |
11 | |||
12 | # when we move to Python 2.5 as minimal supported | ||
13 | # we can kill that try/except as hashlib is 2.5+ | ||
14 | try: | ||
15 | import hashlib | ||
16 | m = hashlib.md5() | ||
17 | except ImportError: | ||
18 | import md5 | ||
19 | m = md5.new() | ||
11 | 20 | ||
12 | f = file(fname, 'rb') | 21 | f = file(fname, 'rb') |
13 | m = md5.new() | ||
14 | while True: | 22 | while True: |
15 | d = f.read(8096) | 23 | d = f.read(8096) |
16 | if not d: | 24 | if not d: |