diff options
author | Ola x Nilsson <ola.x.nilsson@axis.com> | 2019-10-21 12:30:28 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-10-23 16:30:36 +0100 |
commit | 3af1c66939a678d8b66db604bf9850bf735267e7 (patch) | |
tree | 070fc66f2414138f6a0c4f9a567e36cc049b3589 /meta | |
parent | c4f2a115f72795e4c10870107485ca1266565bd0 (diff) | |
download | poky-3af1c66939a678d8b66db604bf9850bf735267e7.tar.gz |
lib/oe/packagedata: Use with to control file handle lifetime
(From OE-Core rev: 28b3635b7f40b627a9d6294a78589c78f0c682c8)
Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oe/packagedata.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py index cbde380b03..a82085a792 100644 --- a/meta/lib/oe/packagedata.py +++ b/meta/lib/oe/packagedata.py | |||
@@ -17,9 +17,8 @@ def read_pkgdatafile(fn): | |||
17 | 17 | ||
18 | if os.access(fn, os.R_OK): | 18 | if os.access(fn, os.R_OK): |
19 | import re | 19 | import re |
20 | f = open(fn, 'r') | 20 | with open(fn, 'r') as f: |
21 | lines = f.readlines() | 21 | lines = f.readlines() |
22 | f.close() | ||
23 | r = re.compile("([^:]+):\s*(.*)") | 22 | r = re.compile("([^:]+):\s*(.*)") |
24 | for l in lines: | 23 | for l in lines: |
25 | m = r.match(l) | 24 | m = r.match(l) |