mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning
This commit is contained in:
committed by
Marcin Juszkiewicz
parent
d2c268aec8
commit
31bdfe582e
@@ -7,10 +7,18 @@ def patch_init(d):
|
|||||||
import os, sys
|
import os, sys
|
||||||
|
|
||||||
def md5sum(fname):
|
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')
|
f = file(fname, 'rb')
|
||||||
m = md5.new()
|
|
||||||
while True:
|
while True:
|
||||||
d = f.read(8096)
|
d = f.read(8096)
|
||||||
if not d:
|
if not d:
|
||||||
|
|||||||
Reference in New Issue
Block a user