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>
This commit is contained in:
Ed Bartosh 2016-06-02 13:12:47 +03:00 committed by Richard Purdie
parent 1132970f0e
commit 07c97db272
7 changed files with 12 additions and 12 deletions

View File

@ -120,7 +120,7 @@ def print_added(d_new = None, d_old = None):
Print the newly added tasks
"""
added = {}
for k in d_new.keys():
for k in list(d_new.keys()):
if k not in d_old:
# Add the new one to added dict, and remove it from
# 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):
"""
pvchanged = {}
counter = 0
for k in d_new.keys():
for k in list(d_new.keys()):
if d_new.get(k).get(vr) != d_old.get(k).get(vr):
counter += 1
pn, task = split_pntask(k)
@ -279,7 +279,7 @@ Note:
# Remove the same one from both stamps.
cnt_unchanged = 0
for k in new_dict.keys():
for k in list(new_dict.keys()):
if k in old_dict:
cnt_unchanged += 1
del(new_dict[k])

View File

@ -1186,7 +1186,7 @@ def update_with_history(conf, components, revisions, repos):
msg = conf_commit_msg(conf, components)
new_tree = runcmd("git write-tree", **wargs).strip()
new_rev = runcmd("git commit-tree".split() +
add_p([head] + additional_heads.keys()) +
add_p([head] + list(additional_heads.keys())) +
["-m", msg, new_tree],
**wargs).strip()
# And done! This is the first time we change the HEAD in the actual work tree.

View File

@ -27,7 +27,7 @@ logger = logging.getLogger('devtool')
def _set_file_values(fn, values):
remaining = values.keys()
remaining = list(values.keys())
def varfunc(varname, origvalue, op, newlines):
newvalue = values.get(varname, origvalue)

View File

@ -998,7 +998,7 @@ def _export_local_files(srctree, rd, destdir):
bb.process.run(['git', 'checkout', tree, '--', '.'], cwd=srctree,
env=dict(os.environ, GIT_WORK_TREE=destdir,
GIT_INDEX_FILE=tmp_index))
new_set = _git_ls_tree(srctree, tree, True).keys()
new_set = list(_git_ls_tree(srctree, tree, True).keys())
elif os.path.isdir(local_files_dir):
# If not tracked by Git, just copy from working copy
new_set = _ls_tree(os.path.join(srctree, 'oe-local-files'))
@ -1309,7 +1309,7 @@ def reset(args, config, basepath, workspace):
raise DevtoolError("Recipe must be specified, or specify -a/--all to "
"reset all recipes")
if args.all:
recipes = workspace.keys()
recipes = list(workspace.keys())
else:
recipes = [args.recipename]

View File

@ -682,7 +682,7 @@ class AutotoolsRecipeHandler(RecipeHandler):
process_macro(in_keyword, partial)
if extravalues:
for k,v in extravalues.items():
for k,v in list(extravalues.items()):
if v:
if v.startswith('$') or v.startswith('@') or v.startswith('%'):
del extravalues[k]

View File

@ -361,7 +361,7 @@ class PythonRecipeHandler(RecipeHandler):
# Naive mapping of setup() arguments to PKG-INFO field names
for d in [info, non_literals]:
for key, value in d.items():
for key, value in list(d.items()):
new_key = _map(key)
if new_key != key:
del d[key]
@ -443,7 +443,7 @@ class PythonRecipeHandler(RecipeHandler):
elif new_value != value:
info[variable] = new_value
elif hasattr(value, 'items'):
for dkey, dvalue in value.items():
for dkey, dvalue in list(value.items()):
new_list = []
for pos, a_value in enumerate(dvalue):
new_value = replace_value(search, replace, a_value)
@ -608,7 +608,7 @@ def gather_setup_info(fileobj):
visitor.visit(parsed)
non_literals, extensions = {}, []
for key, value in visitor.keywords.items():
for key, value in list(visitor.keywords.items()):
if key == 'ext_modules':
if isinstance(value, list):
for ext in value:

View File

@ -240,7 +240,7 @@ def lookup_pkg(args):
sys.exit(1)
if args.reverse:
items = mappings.values()
items = list(mappings.values())
else:
items = []
for pkg in pkgs: