aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Eliasson <anton.eliasson@axis.com>2020-05-08 16:07:04 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-05-12 15:19:56 +0100
commit4fe8bb4e3f15a3f4e153605d57096c565c5fac21 (patch)
treeeaa8dec0d330ece46dae7d4650bd6ad90c8d221a
parent73b75f5ff6c0b5333898fa340f4d9e2e5111fdef (diff)
downloadopenembedded-core-contrib-4fe8bb4e3f15a3f4e153605d57096c565c5fac21.tar.gz
openembedded-core-contrib-4fe8bb4e3f15a3f4e153605d57096c565c5fac21.tar.bz2
openembedded-core-contrib-4fe8bb4e3f15a3f4e153605d57096c565c5fac21.zip
meson.bbclass: Close the log file after reading
This fixes warnings like: WARNING: package-name-0.0.1-r0 do_configure: <string>:164: ResourceWarning: unclosed file <_io.TextIOWrapper name='/source_directory/build/tmp/work/arch/package-name/0.0.1-r0/package-name-0.0.1//meson-logs/meson-log.txt' mode='r' encoding='UTF-8'> Signed-off-by: Anton Eliasson <anton.eliasson@axis.com> Reviewed-by: Ola x Nilsson <ola.x.nilsson@axis.com> Signed-off-by: Anton Eliasson <anton.eliasson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/meson.bbclass3
1 files changed, 2 insertions, 1 deletions
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index 06034e8b473..e9628033c68 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -164,7 +164,8 @@ meson_do_configure_prepend_class-native() {
python meson_do_qa_configure() {
import re
warn_re = re.compile(r"^WARNING: Cross property (.+) is using default value (.+)$", re.MULTILINE)
- log = open(d.expand("${B}/meson-logs/meson-log.txt")).read()
+ with open(d.expand("${B}/meson-logs/meson-log.txt")) as logfile:
+ log = logfile.read()
for (prop, value) in warn_re.findall(log):
bb.warn("Meson cross property %s used without explicit assignment, defaulting to %s" % (prop, value))
}