mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 09:32:13 +02:00
oe.types.path: Use with to control file handle lifetime
(From OE-Core rev: b6e7fee68d018e5f148a7a02cf110bc210022a72) Signed-off-by: Ola x Nilsson <olani@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
864c8d67f2
commit
c4f2a115f7
@@ -154,7 +154,8 @@ def path(value, relativeto='', normalize='true', mustexist='false'):
|
||||
|
||||
if boolean(mustexist):
|
||||
try:
|
||||
open(value, 'r')
|
||||
with open(value, 'r'):
|
||||
pass
|
||||
except IOError as exc:
|
||||
if exc.errno == errno.ENOENT:
|
||||
raise ValueError("{0}: {1}".format(value, os.strerror(errno.ENOENT)))
|
||||
@@ -183,4 +184,3 @@ def qemu_use_kvm(kvm, target_arch):
|
||||
elif build_arch == target_arch:
|
||||
use_kvm = True
|
||||
return use_kvm
|
||||
|
||||
|
||||
Reference in New Issue
Block a user