From 874a269eb1d70060c2f3b3f8b70800e2aea789f4 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Thu, 2 Jun 2016 13:12:47 +0300 Subject: 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. Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- scripts/lib/devtool/build.py | 2 +- scripts/lib/devtool/standard.py | 4 ++-- scripts/lib/recipetool/create_buildsys.py | 2 +- scripts/lib/recipetool/create_buildsys_python.py | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'scripts/lib') 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') def _set_file_values(fn, values): - remaining = values.keys() + remaining = list(values.keys()) def varfunc(varname, origvalue, op, newlines): 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): 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] 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): 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] 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): # 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: -- cgit v1.2.3