diff options
author | Ola x Nilsson <ola.x.nilsson@axis.com> | 2019-10-21 12:30:34 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-10-23 16:26:14 +0100 |
commit | 35c65b7336c52c19810e3e9e87a36a8636ac4120 (patch) | |
tree | ffe55af7c960373015a668dd0c033a02e1be1562 | |
parent | eb763856be8da854d37c7d4b8e8d645ab1d3fa06 (diff) | |
download | openembedded-core-contrib-35c65b7336c52c19810e3e9e87a36a8636ac4120.tar.gz |
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.
Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/libc-package.bbclass | 15 |
1 files changed, 7 insertions, 8 deletions
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") |