* [PATCH] meson.bbclass: Close the log file after reading
@ 2020-05-08 14:07 anton.eliasson
0 siblings, 0 replies; only message in thread
From: anton.eliasson @ 2020-05-08 14:07 UTC (permalink / raw)
To: openembedded-core; +Cc: Anton Eliasson
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>
---
meta/classes/meson.bbclass | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index 06034e8b47..e9628033c6 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))
}
--
2.11.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-05-08 14:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 14:07 [PATCH] meson.bbclass: Close the log file after reading anton.eliasson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.