hooks: travis-ci: Fix "ResourceWarning: unclosed file"
This patch gets rid of the warning messages like: uboot-test-hooks/py/travis-ci/travis_tftp.py:43: ResourceWarning: unclosed file <_io.BufferedReader name='.bm-work/qemu_arm/u-boot.bin'> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
committed by
Simon Glass
parent
d6d46d0a95
commit
f948cdf223
@@ -20,8 +20,11 @@ def file2env(file_name, addr=None):
|
||||
ret = {
|
||||
"fn": file_name,
|
||||
"size": os.path.getsize(file_full),
|
||||
"crc32": hex(binascii.crc32(open(file_full, 'rb').read()) & 0xffffffff)[2:],
|
||||
}
|
||||
|
||||
with open(file_full, 'rb') as fd:
|
||||
ret["crc32"] = hex(binascii.crc32(fd.read()) & 0xffffffff)[2:]
|
||||
|
||||
if addr is not None:
|
||||
ret['addr'] = addr
|
||||
|
||||
|
||||
Reference in New Issue
Block a user