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:26:14 +0100 |
commit | 28b3635b7f40b627a9d6294a78589c78f0c682c8 (patch) | |
tree | 75998fd90a7290306007bd562e65054af20afde2 /meta/lib/oe | |
parent | b6e7fee68d018e5f148a7a02cf110bc210022a72 (diff) | |
download | openembedded-core-contrib-28b3635b7f40b627a9d6294a78589c78f0c682c8.tar.gz |
lib/oe/packagedata: 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/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 cbde380b034..a82085a7920 100644 --- a/meta/lib/oe/packagedata.py +++ b/meta/lib/oe/packagedata.py @@ -17,9 +17,8 @@ def read_pkgdatafile(fn): if os.access(fn, os.R_OK): import re - f = open(fn, 'r') - lines = f.readlines() - f.close() + with open(fn, 'r') as f: + lines = f.readlines() r = re.compile("([^:]+):\s*(.*)") for l in lines: m = r.match(l) |