patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning

This commit is contained in:
Marcin Juszkiewicz 2009-05-12 18:30:18 +02:00 committed by Marcin Juszkiewicz
parent d2c268aec8
commit 31bdfe582e

View File

@ -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: