From 3af1c66939a678d8b66db604bf9850bf735267e7 Mon Sep 17 00:00:00 2001 From: Ola x Nilsson Date: Mon, 21 Oct 2019 12:30:28 +0200 Subject: lib/oe/packagedata: Use with to control file handle lifetime (From OE-Core rev: 28b3635b7f40b627a9d6294a78589c78f0c682c8) Signed-off-by: Ola x Nilsson Signed-off-by: Richard Purdie --- meta/lib/oe/packagedata.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'meta/lib/oe') 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): 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) -- cgit v1.2.3-54-g00ecf