diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-06-02 13:12:47 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-03 13:13:28 +0100 |
commit | 07c97db27288cf806900b13e55fe37e4bf22e889 (patch) | |
tree | bf116c101f365c8dc438b72aa9499feabea2ef66 | |
parent | 1132970f0e1a9e9a2135549b8512f58af80aa5c4 (diff) | |
download | poky-07c97db27288cf806900b13e55fe37e4bf22e889.tar.gz |
scripts: python3: convert iterables to lists
Converted return value of items() keys() and values() to
lists when dictionary is modified in the loop and when
the result is added to the list.
(From OE-Core rev: 874a269eb1d70060c2f3b3f8b70800e2aea789f4)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/bitbake-whatchanged | 6 | ||||
-rwxr-xr-x | scripts/combo-layer | 2 | ||||
-rw-r--r-- | scripts/lib/devtool/build.py | 2 | ||||
-rw-r--r-- | scripts/lib/devtool/standard.py | 4 | ||||
-rw-r--r-- | scripts/lib/recipetool/create_buildsys.py | 2 | ||||
-rw-r--r-- | scripts/lib/recipetool/create_buildsys_python.py | 6 | ||||
-rwxr-xr-x | scripts/oe-pkgdata-util | 2 |
7 files changed, 12 insertions, 12 deletions
diff --git a/scripts/bitbake-whatchanged b/scripts/bitbake-whatchanged index a20adb2841..b05aead9a1 100755 --- a/scripts/bitbake-whatchanged +++ b/scripts/bitbake-whatchanged | |||
@@ -120,7 +120,7 @@ def print_added(d_new = None, d_old = None): | |||
120 | Print the newly added tasks | 120 | Print the newly added tasks |
121 | """ | 121 | """ |
122 | added = {} | 122 | added = {} |
123 | for k in d_new.keys(): | 123 | for k in list(d_new.keys()): |
124 | if k not in d_old: | 124 | if k not in d_old: |
125 | # Add the new one to added dict, and remove it from | 125 | # Add the new one to added dict, and remove it from |
126 | # d_new, so the remaining ones are the changed ones | 126 | # d_new, so the remaining ones are the changed ones |
@@ -155,7 +155,7 @@ def print_vrchanged(d_new = None, d_old = None, vr = None): | |||
155 | """ | 155 | """ |
156 | pvchanged = {} | 156 | pvchanged = {} |
157 | counter = 0 | 157 | counter = 0 |
158 | for k in d_new.keys(): | 158 | for k in list(d_new.keys()): |
159 | if d_new.get(k).get(vr) != d_old.get(k).get(vr): | 159 | if d_new.get(k).get(vr) != d_old.get(k).get(vr): |
160 | counter += 1 | 160 | counter += 1 |
161 | pn, task = split_pntask(k) | 161 | pn, task = split_pntask(k) |
@@ -279,7 +279,7 @@ Note: | |||
279 | 279 | ||
280 | # Remove the same one from both stamps. | 280 | # Remove the same one from both stamps. |
281 | cnt_unchanged = 0 | 281 | cnt_unchanged = 0 |
282 | for k in new_dict.keys(): | 282 | for k in list(new_dict.keys()): |
283 | if k in old_dict: | 283 | if k in old_dict: |
284 | cnt_unchanged += 1 | 284 | cnt_unchanged += 1 |
285 | del(new_dict[k]) | 285 | del(new_dict[k]) |
diff --git a/scripts/combo-layer b/scripts/combo-layer index 234d9e447b..7c41f92744 100755 --- a/scripts/combo-layer +++ b/scripts/combo-layer | |||
@@ -1186,7 +1186,7 @@ def update_with_history(conf, components, revisions, repos): | |||
1186 | msg = conf_commit_msg(conf, components) | 1186 | msg = conf_commit_msg(conf, components) |
1187 | new_tree = runcmd("git write-tree", **wargs).strip() | 1187 | new_tree = runcmd("git write-tree", **wargs).strip() |
1188 | new_rev = runcmd("git commit-tree".split() + | 1188 | new_rev = runcmd("git commit-tree".split() + |
1189 | add_p([head] + additional_heads.keys()) + | 1189 | add_p([head] + list(additional_heads.keys())) + |
1190 | ["-m", msg, new_tree], | 1190 | ["-m", msg, new_tree], |
1191 | **wargs).strip() | 1191 | **wargs).strip() |
1192 | # And done! This is the first time we change the HEAD in the actual work tree. | 1192 | # And done! This is the first time we change the HEAD in the actual work tree. |
diff --git a/scripts/lib/devtool/build.py b/scripts/lib/devtool/build.py index 48f6fe1be5..6be549dd59 100644 --- a/scripts/lib/devtool/build.py +++ b/scripts/lib/devtool/build.py | |||
@@ -27,7 +27,7 @@ logger = logging.getLogger('devtool') | |||
27 | 27 | ||
28 | 28 | ||
29 | def _set_file_values(fn, values): | 29 | def _set_file_values(fn, values): |
30 | remaining = values.keys() | 30 | remaining = list(values.keys()) |
31 | 31 | ||
32 | def varfunc(varname, origvalue, op, newlines): | 32 | def varfunc(varname, origvalue, op, newlines): |
33 | newvalue = values.get(varname, origvalue) | 33 | newvalue = values.get(varname, origvalue) |
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 08153c6edc..a2516d66ac 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -998,7 +998,7 @@ def _export_local_files(srctree, rd, destdir): | |||
998 | bb.process.run(['git', 'checkout', tree, '--', '.'], cwd=srctree, | 998 | bb.process.run(['git', 'checkout', tree, '--', '.'], cwd=srctree, |
999 | env=dict(os.environ, GIT_WORK_TREE=destdir, | 999 | env=dict(os.environ, GIT_WORK_TREE=destdir, |
1000 | GIT_INDEX_FILE=tmp_index)) | 1000 | GIT_INDEX_FILE=tmp_index)) |
1001 | new_set = _git_ls_tree(srctree, tree, True).keys() | 1001 | new_set = list(_git_ls_tree(srctree, tree, True).keys()) |
1002 | elif os.path.isdir(local_files_dir): | 1002 | elif os.path.isdir(local_files_dir): |
1003 | # If not tracked by Git, just copy from working copy | 1003 | # If not tracked by Git, just copy from working copy |
1004 | new_set = _ls_tree(os.path.join(srctree, 'oe-local-files')) | 1004 | new_set = _ls_tree(os.path.join(srctree, 'oe-local-files')) |
@@ -1309,7 +1309,7 @@ def reset(args, config, basepath, workspace): | |||
1309 | raise DevtoolError("Recipe must be specified, or specify -a/--all to " | 1309 | raise DevtoolError("Recipe must be specified, or specify -a/--all to " |
1310 | "reset all recipes") | 1310 | "reset all recipes") |
1311 | if args.all: | 1311 | if args.all: |
1312 | recipes = workspace.keys() | 1312 | recipes = list(workspace.keys()) |
1313 | else: | 1313 | else: |
1314 | recipes = [args.recipename] | 1314 | recipes = [args.recipename] |
1315 | 1315 | ||
diff --git a/scripts/lib/recipetool/create_buildsys.py b/scripts/lib/recipetool/create_buildsys.py index de3d9aed6f..78ae4bcdec 100644 --- a/scripts/lib/recipetool/create_buildsys.py +++ b/scripts/lib/recipetool/create_buildsys.py | |||
@@ -682,7 +682,7 @@ class AutotoolsRecipeHandler(RecipeHandler): | |||
682 | process_macro(in_keyword, partial) | 682 | process_macro(in_keyword, partial) |
683 | 683 | ||
684 | if extravalues: | 684 | if extravalues: |
685 | for k,v in extravalues.items(): | 685 | for k,v in list(extravalues.items()): |
686 | if v: | 686 | if v: |
687 | if v.startswith('$') or v.startswith('@') or v.startswith('%'): | 687 | if v.startswith('$') or v.startswith('@') or v.startswith('%'): |
688 | del extravalues[k] | 688 | del extravalues[k] |
diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py index 55cce0e942..aff13cf1d2 100644 --- a/scripts/lib/recipetool/create_buildsys_python.py +++ b/scripts/lib/recipetool/create_buildsys_python.py | |||
@@ -361,7 +361,7 @@ class PythonRecipeHandler(RecipeHandler): | |||
361 | 361 | ||
362 | # Naive mapping of setup() arguments to PKG-INFO field names | 362 | # Naive mapping of setup() arguments to PKG-INFO field names |
363 | for d in [info, non_literals]: | 363 | for d in [info, non_literals]: |
364 | for key, value in d.items(): | 364 | for key, value in list(d.items()): |
365 | new_key = _map(key) | 365 | new_key = _map(key) |
366 | if new_key != key: | 366 | if new_key != key: |
367 | del d[key] | 367 | del d[key] |
@@ -443,7 +443,7 @@ class PythonRecipeHandler(RecipeHandler): | |||
443 | elif new_value != value: | 443 | elif new_value != value: |
444 | info[variable] = new_value | 444 | info[variable] = new_value |
445 | elif hasattr(value, 'items'): | 445 | elif hasattr(value, 'items'): |
446 | for dkey, dvalue in value.items(): | 446 | for dkey, dvalue in list(value.items()): |
447 | new_list = [] | 447 | new_list = [] |
448 | for pos, a_value in enumerate(dvalue): | 448 | for pos, a_value in enumerate(dvalue): |
449 | new_value = replace_value(search, replace, a_value) | 449 | new_value = replace_value(search, replace, a_value) |
@@ -608,7 +608,7 @@ def gather_setup_info(fileobj): | |||
608 | visitor.visit(parsed) | 608 | visitor.visit(parsed) |
609 | 609 | ||
610 | non_literals, extensions = {}, [] | 610 | non_literals, extensions = {}, [] |
611 | for key, value in visitor.keywords.items(): | 611 | for key, value in list(visitor.keywords.items()): |
612 | if key == 'ext_modules': | 612 | if key == 'ext_modules': |
613 | if isinstance(value, list): | 613 | if isinstance(value, list): |
614 | for ext in value: | 614 | for ext in value: |
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util index b39d9b566c..b16ecc9e74 100755 --- a/scripts/oe-pkgdata-util +++ b/scripts/oe-pkgdata-util | |||
@@ -240,7 +240,7 @@ def lookup_pkg(args): | |||
240 | sys.exit(1) | 240 | sys.exit(1) |
241 | 241 | ||
242 | if args.reverse: | 242 | if args.reverse: |
243 | items = mappings.values() | 243 | items = list(mappings.values()) |
244 | else: | 244 | else: |
245 | items = [] | 245 | items = [] |
246 | for pkg in pkgs: | 246 | for pkg in pkgs: |