[OE-core] [PATCH 2/9] oe.types.path: Use with to control file handle lifetime
Ola x Nilsson
ola.x.nilsson at axis.com
Mon Oct 21 10:30:27 UTC 2019
Signed-off-by: Ola x Nilsson <olani at axis.com>
---
meta/lib/oe/types.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py
index 77ee7ee541..bbbabafbf6 100644
--- a/meta/lib/oe/types.py
+++ b/meta/lib/oe/types.py
@@ -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
-
--
2.11.0
More information about the Openembedded-core
mailing list