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:30:36 +0100 |
commit | e6deec21d6d1381ea328311fe1fa5ee05344696e (patch) | |
tree | b6bd0474af2925e2e869a72a2c16bbd423822935 /meta/classes/libc-package.bbclass | |
parent | 4bc072c7fb48995d996546230eb034f232243376 (diff) | |
download | poky-e6deec21d6d1381ea328311fe1fa5ee05344696e.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.
(From OE-Core rev: 35c65b7336c52c19810e3e9e87a36a8636ac4120)
Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/libc-package.bbclass')
-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 () { | |||
346 | 346 | ||
347 | if use_bin == "compile": | 347 | if use_bin == "compile": |
348 | makefile = oe.path.join(d.getVar("WORKDIR"), "locale-tree", "Makefile") | 348 | makefile = oe.path.join(d.getVar("WORKDIR"), "locale-tree", "Makefile") |
349 | m = open(makefile, "w") | 349 | with open(makefile, "w") as m: |
350 | m.write("all: %s\n\n" % " ".join(commands.keys())) | 350 | m.write("all: %s\n\n" % " ".join(commands.keys())) |
351 | total = len(commands) | 351 | total = len(commands) |
352 | for i, cmd in enumerate(commands): | 352 | for i, (maketarget, makerecipe) in enumerate(commands.items()): |
353 | m.write(cmd + ":\n") | 353 | m.write(maketarget + ":\n") |
354 | m.write("\t@echo 'Progress %d/%d'\n" % (i, total)) | 354 | m.write("\t@echo 'Progress %d/%d'\n" % (i, total)) |
355 | m.write("\t" + commands[cmd] + "\n\n") | 355 | m.write("\t" + makerecipe + "\n\n") |
356 | m.close() | ||
357 | d.setVar("EXTRA_OEMAKE", "-C %s ${PARALLEL_MAKE}" % (os.path.dirname(makefile))) | 356 | d.setVar("EXTRA_OEMAKE", "-C %s ${PARALLEL_MAKE}" % (os.path.dirname(makefile))) |
358 | d.setVarFlag("oe_runmake", "progress", "outof:Progress\s(\d+)/(\d+)") | 357 | d.setVarFlag("oe_runmake", "progress", "outof:Progress\s(\d+)/(\d+)") |
359 | bb.note("Executing binary locale generation makefile") | 358 | bb.note("Executing binary locale generation makefile") |