diff options
author | Ola x Nilsson <ola.x.nilsson@axis.com> | 2019-10-21 12:30:33 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-10-23 16:26:14 +0100 |
commit | eb763856be8da854d37c7d4b8e8d645ab1d3fa06 (patch) | |
tree | 2df543b662e046d464f794fa0e2a1d565f3e3df3 /meta/classes/devtool-source.bbclass | |
parent | e90978056c4b49e138b3d422939bf995829ec3b0 (diff) | |
download | openembedded-core-contrib-eb763856be8da854d37c7d4b8e8d645ab1d3fa06.tar.gz |
devtool-source.bbclass: Use with to manage file handle lifetime
Replace copy-and-if with a filtering list comprehension.
Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/devtool-source.bbclass')
-rw-r--r-- | meta/classes/devtool-source.bbclass | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/meta/classes/devtool-source.bbclass b/meta/classes/devtool-source.bbclass index a8110006fb..280d6009f3 100644 --- a/meta/classes/devtool-source.bbclass +++ b/meta/classes/devtool-source.bbclass @@ -97,17 +97,15 @@ python devtool_post_unpack() { local_files = oe.recipeutils.get_recipe_local_files(d) if is_kernel_yocto: - for key in local_files.copy(): - if key.endswith('scc'): - sccfile = open(local_files[key], 'r') + for key in [f for f in local_files if f.endswith('scc')]: + with open(local_files[key], 'r') as sccfile: for l in sccfile: line = l.split() if line and line[0] in ('kconf', 'patch'): cfg = os.path.join(os.path.dirname(local_files[key]), line[-1]) - if not cfg in local_files.values(): + if cfg not in local_files.values(): local_files[line[-1]] = cfg shutil.copy2(cfg, workdir) - sccfile.close() # Ignore local files with subdir={BP} srcabspath = os.path.abspath(srcsubdir) |