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:30:36 +0100 |
commit | 4bc072c7fb48995d996546230eb034f232243376 (patch) | |
tree | ea39163ada0d6af20131f1fa94a929ade02ca8b4 /meta/classes/devtool-source.bbclass | |
parent | 95dca0ec5a89a6b4277abb7100dbeacede1cc4e3 (diff) | |
download | poky-4bc072c7fb48995d996546230eb034f232243376.tar.gz |
devtool-source.bbclass: Use with to manage file handle lifetime
Replace copy-and-if with a filtering list comprehension.
(From OE-Core rev: eb763856be8da854d37c7d4b8e8d645ab1d3fa06)
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() { | |||
97 | local_files = oe.recipeutils.get_recipe_local_files(d) | 97 | local_files = oe.recipeutils.get_recipe_local_files(d) |
98 | 98 | ||
99 | if is_kernel_yocto: | 99 | if is_kernel_yocto: |
100 | for key in local_files.copy(): | 100 | for key in [f for f in local_files if f.endswith('scc')]: |
101 | if key.endswith('scc'): | 101 | with open(local_files[key], 'r') as sccfile: |
102 | sccfile = open(local_files[key], 'r') | ||
103 | for l in sccfile: | 102 | for l in sccfile: |
104 | line = l.split() | 103 | line = l.split() |
105 | if line and line[0] in ('kconf', 'patch'): | 104 | if line and line[0] in ('kconf', 'patch'): |
106 | cfg = os.path.join(os.path.dirname(local_files[key]), line[-1]) | 105 | cfg = os.path.join(os.path.dirname(local_files[key]), line[-1]) |
107 | if not cfg in local_files.values(): | 106 | if cfg not in local_files.values(): |
108 | local_files[line[-1]] = cfg | 107 | local_files[line[-1]] = cfg |
109 | shutil.copy2(cfg, workdir) | 108 | shutil.copy2(cfg, workdir) |
110 | sccfile.close() | ||
111 | 109 | ||
112 | # Ignore local files with subdir={BP} | 110 | # Ignore local files with subdir={BP} |
113 | srcabspath = os.path.abspath(srcsubdir) | 111 | srcabspath = os.path.abspath(srcsubdir) |