diff options
author | Ola x Nilsson <ola.x.nilsson@axis.com> | 2019-10-21 12:30:27 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-10-23 16:26:14 +0100 |
commit | b6e7fee68d018e5f148a7a02cf110bc210022a72 (patch) | |
tree | 4b6de506a671323d62eb77c9b36a0853ccf7d1a8 /meta/lib/oe | |
parent | 890fbd77315474fbd582f8bbeb26925c6a42d8d4 (diff) | |
download | openembedded-core-contrib-b6e7fee68d018e5f148a7a02cf110bc210022a72.tar.gz |
oe.types.path: Use with to control file handle lifetime
Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/types.py | 4 |
1 files 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 - |