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:30:36 +0100 |
commit | c4f2a115f72795e4c10870107485ca1266565bd0 (patch) | |
tree | 82ecf0b74cbf301a6e7a73b42bc09294856ea91f | |
parent | 864c8d67f2e5f0c0d474f37a9855fc83225038d4 (diff) | |
download | poky-c4f2a115f72795e4c10870107485ca1266565bd0.tar.gz |
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>
-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'): | |||
154 | 154 | ||
155 | if boolean(mustexist): | 155 | if boolean(mustexist): |
156 | try: | 156 | try: |
157 | open(value, 'r') | 157 | with open(value, 'r'): |
158 | pass | ||
158 | except IOError as exc: | 159 | except IOError as exc: |
159 | if exc.errno == errno.ENOENT: | 160 | if exc.errno == errno.ENOENT: |
160 | raise ValueError("{0}: {1}".format(value, os.strerror(errno.ENOENT))) | 161 | raise ValueError("{0}: {1}".format(value, os.strerror(errno.ENOENT))) |
@@ -183,4 +184,3 @@ def qemu_use_kvm(kvm, target_arch): | |||
183 | elif build_arch == target_arch: | 184 | elif build_arch == target_arch: |
184 | use_kvm = True | 185 | use_kvm = True |
185 | return use_kvm | 186 | return use_kvm |
186 | |||