From e6deec21d6d1381ea328311fe1fa5ee05344696e Mon Sep 17 00:00:00 2001 From: Ola x Nilsson Date: Mon, 21 Oct 2019 12:30:34 +0200 Subject: libc-package.bbclass: Use with to manage filehandle in do_spit_gconvs Tweak the write loop slightly to avoid dict lookups that can easily be done in the for loop. (From OE-Core rev: 35c65b7336c52c19810e3e9e87a36a8636ac4120) Signed-off-by: Ola x Nilsson Signed-off-by: Richard Purdie --- meta/classes/libc-package.bbclass | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'meta') diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass index a66e540884..de816bcec1 100644 --- a/meta/classes/libc-package.bbclass +++ b/meta/classes/libc-package.bbclass @@ -346,14 +346,13 @@ python package_do_split_gconvs () { if use_bin == "compile": makefile = oe.path.join(d.getVar("WORKDIR"), "locale-tree", "Makefile") - m = open(makefile, "w") - m.write("all: %s\n\n" % " ".join(commands.keys())) - total = len(commands) - for i, cmd in enumerate(commands): - m.write(cmd + ":\n") - m.write("\t@echo 'Progress %d/%d'\n" % (i, total)) - m.write("\t" + commands[cmd] + "\n\n") - m.close() + with open(makefile, "w") as m: + m.write("all: %s\n\n" % " ".join(commands.keys())) + total = len(commands) + for i, (maketarget, makerecipe) in enumerate(commands.items()): + m.write(maketarget + ":\n") + m.write("\t@echo 'Progress %d/%d'\n" % (i, total)) + m.write("\t" + makerecipe + "\n\n") d.setVar("EXTRA_OEMAKE", "-C %s ${PARALLEL_MAKE}" % (os.path.dirname(makefile))) d.setVarFlag("oe_runmake", "progress", "outof:Progress\s(\d+)/(\d+)") bb.note("Executing binary locale generation makefile") -- cgit v1.2.3-54-g00ecf