aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-05-18 21:39:44 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-02 08:10:03 +0100
commit25d4d8274bac696a484f83d7f3ada778cf95f4d0 (patch)
tree626c84b436b57344bbb512870f4d2acd9f5b1195 /scripts/lib
parent210e290c9251839dc74e3aabdcea3655dd707a50 (diff)
downloadopenembedded-core-contrib-25d4d8274bac696a484f83d7f3ada778cf95f4d0.tar.gz
scripts: Fix deprecated dict methods for python3
Replaced iteritems -> items, itervalues -> values, iterkeys -> keys or 'in' Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/devtool/__init__.py2
-rw-r--r--scripts/lib/devtool/standard.py14
-rw-r--r--scripts/lib/devtool/upgrade.py2
-rw-r--r--scripts/lib/recipetool/append.py8
-rw-r--r--scripts/lib/recipetool/create.py12
-rw-r--r--scripts/lib/recipetool/create_buildsys.py10
-rw-r--r--scripts/lib/recipetool/create_buildsys_python.py18
-rw-r--r--scripts/lib/recipetool/create_npm.py4
8 files changed, 35 insertions, 35 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index ff97dfc94b..506d95b0f7 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -155,7 +155,7 @@ def check_workspace_recipe(workspace, pn, checksrc=True, bbclassextend=False):
workspacepn = pn
- for recipe, value in workspace.iteritems():
+ for recipe, value in workspace.items():
if recipe == pn:
break
if bbclassextend:
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index d6186b9ece..08153c6edc 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1091,11 +1091,11 @@ def _update_recipe_srcrev(args, srctree, rd, config_data):
else:
files_dir = os.path.join(os.path.dirname(recipefile),
rd.getVar('BPN', True))
- for basepath, path in upd_f.iteritems():
+ for basepath, path in upd_f.items():
logger.info('Updating file %s' % basepath)
_move_file(os.path.join(local_files_dir, basepath), path)
update_srcuri= True
- for basepath, path in new_f.iteritems():
+ for basepath, path in new_f.items():
logger.info('Adding new file %s' % basepath)
_move_file(os.path.join(local_files_dir, basepath),
os.path.join(files_dir, basepath))
@@ -1173,11 +1173,11 @@ def _update_recipe_patch(args, config, workspace, srctree, rd, config_data):
logger.info('No patches or local source files needed updating')
else:
# Update existing files
- for basepath, path in upd_f.iteritems():
+ for basepath, path in upd_f.items():
logger.info('Updating file %s' % basepath)
_move_file(os.path.join(local_files_dir, basepath), path)
updatefiles = True
- for basepath, path in upd_p.iteritems():
+ for basepath, path in upd_p.items():
patchfn = os.path.join(patches_dir, basepath)
if changed_revs is not None:
# Avoid updating patches that have not actually changed
@@ -1192,13 +1192,13 @@ def _update_recipe_patch(args, config, workspace, srctree, rd, config_data):
# Add any new files
files_dir = os.path.join(os.path.dirname(recipefile),
rd.getVar('BPN', True))
- for basepath, path in new_f.iteritems():
+ for basepath, path in new_f.items():
logger.info('Adding new file %s' % basepath)
_move_file(os.path.join(local_files_dir, basepath),
os.path.join(files_dir, basepath))
srcuri.append('file://%s' % basepath)
updaterecipe = True
- for basepath, path in new_p.iteritems():
+ for basepath, path in new_p.items():
logger.info('Adding new patch %s' % basepath)
_move_file(os.path.join(patches_dir, basepath),
os.path.join(files_dir, basepath))
@@ -1285,7 +1285,7 @@ def update_recipe(args, config, basepath, workspace):
def status(args, config, basepath, workspace):
"""Entry point for the devtool 'status' subcommand"""
if workspace:
- for recipe, value in workspace.iteritems():
+ for recipe, value in workspace.items():
recipefile = value['recipefile']
if recipefile:
recipestr = ' (%s)' % recipefile
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 07a90188f3..66e5f59a01 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -70,7 +70,7 @@ def _remove_patch_dirs(recipefolder):
def _recipe_contains(rd, var):
rf = rd.getVar('FILE', True)
varfiles = oe.recipeutils.get_var_files(rf, [var], rd)
- for var, fn in varfiles.iteritems():
+ for var, fn in varfiles.items():
if fn and fn.startswith(os.path.dirname(rf) + os.sep):
return True
return False
diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py
index 558fd25ac5..35756b08af 100644
--- a/scripts/lib/recipetool/append.py
+++ b/scripts/lib/recipetool/append.py
@@ -61,7 +61,7 @@ def find_target_file(targetpath, d, pkglist=None):
'/etc/gshadow': '/etc/gshadow should be managed through the useradd and extrausers classes',
'${sysconfdir}/hostname': '${sysconfdir}/hostname contents should be set by setting hostname_pn-base-files = "value" in configuration',}
- for pthspec, message in invalidtargets.iteritems():
+ for pthspec, message in invalidtargets.items():
if fnmatch.fnmatchcase(targetpath, d.expand(pthspec)):
raise InvalidTargetFileError(d.expand(message))
@@ -152,7 +152,7 @@ def determine_file_source(targetpath, rd):
# Check patches
srcpatches = []
patchedfiles = oe.recipeutils.get_recipe_patched_files(rd)
- for patch, filelist in patchedfiles.iteritems():
+ for patch, filelist in patchedfiles.items():
for fileitem in filelist:
if fileitem[0] == srcpath:
srcpatches.append((patch, fileitem[1]))
@@ -270,7 +270,7 @@ def appendfile(args):
postinst_pns = []
selectpn = None
- for targetpath, pnlist in recipes.iteritems():
+ for targetpath, pnlist in recipes.items():
for pn in pnlist:
if pn.startswith('?'):
alternative_pns.append(pn[1:])
@@ -351,7 +351,7 @@ def appendsrc(args, files, rd, extralines=None):
copyfiles = {}
extralines = extralines or []
- for newfile, srcfile in files.iteritems():
+ for newfile, srcfile in files.items():
src_destdir = os.path.dirname(srcfile)
if not args.use_workdir:
if rd.getVar('S', True) == rd.getVar('STAGING_KERNEL_DIR', True):
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 4a59363eea..5a37d18209 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -61,8 +61,8 @@ class RecipeHandler(object):
libpaths = list(set([base_libdir, libdir]))
libname_re = re.compile('^lib(.+)\.so.*$')
pkglibmap = {}
- for lib, item in shlib_providers.iteritems():
- for path, pkg in item.iteritems():
+ for lib, item in shlib_providers.items():
+ for path, pkg in item.items():
if path in libpaths:
res = libname_re.match(lib)
if res:
@@ -74,7 +74,7 @@ class RecipeHandler(object):
# Now turn it into a library->recipe mapping
pkgdata_dir = d.getVar('PKGDATA_DIR', True)
- for libname, pkg in pkglibmap.iteritems():
+ for libname, pkg in pkglibmap.items():
try:
with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f:
for line in f:
@@ -663,7 +663,7 @@ def create_recipe(args):
else:
extraoutdir = os.path.join(os.path.dirname(outfile), pn)
bb.utils.mkdirhier(extraoutdir)
- for destfn, extrafile in extrafiles.iteritems():
+ for destfn, extrafile in extrafiles.items():
shutil.move(extrafile, os.path.join(extraoutdir, destfn))
lines = lines_before
@@ -901,7 +901,7 @@ def split_pkg_licenses(licvalues, packages, outlines, fallback_licenses=None, pn
"""
pkglicenses = {pn: []}
for license, licpath, _ in licvalues:
- for pkgname, pkgpath in packages.iteritems():
+ for pkgname, pkgpath in packages.items():
if licpath.startswith(pkgpath + '/'):
if pkgname in pkglicenses:
pkglicenses[pkgname].append(license)
@@ -928,7 +928,7 @@ def read_pkgconfig_provides(d):
for line in f:
pkgmap[os.path.basename(line.rstrip())] = os.path.splitext(os.path.basename(fn))[0]
recipemap = {}
- for pc, pkg in pkgmap.iteritems():
+ for pc, pkg in pkgmap.items():
pkgdatafile = os.path.join(pkgdatadir, 'runtime', pkg)
if os.path.exists(pkgdatafile):
with open(pkgdatafile, 'r') as f:
diff --git a/scripts/lib/recipetool/create_buildsys.py b/scripts/lib/recipetool/create_buildsys.py
index ad857801d3..de3d9aed6f 100644
--- a/scripts/lib/recipetool/create_buildsys.py
+++ b/scripts/lib/recipetool/create_buildsys.py
@@ -44,7 +44,7 @@ class CmakeRecipeHandler(RecipeHandler):
classes.append('cmake')
values = CmakeRecipeHandler.extract_cmake_deps(lines_before, srctree, extravalues)
classes.extend(values.pop('inherit', '').split())
- for var, value in values.iteritems():
+ for var, value in values.items():
lines_before.append('%s = "%s"' % (var, value))
lines_after.append('# Specify any options you want to pass to cmake using EXTRA_OECMAKE:')
lines_after.append('EXTRA_OECMAKE = ""')
@@ -159,7 +159,7 @@ class CmakeRecipeHandler(RecipeHandler):
def find_cmake_package(pkg):
RecipeHandler.load_devel_filemap(tinfoil.config_data)
- for fn, pn in RecipeHandler.recipecmakefilemap.iteritems():
+ for fn, pn in RecipeHandler.recipecmakefilemap.items():
splitname = fn.split('/')
if len(splitname) > 1:
if splitname[0].lower().startswith(pkg.lower()):
@@ -348,7 +348,7 @@ class AutotoolsRecipeHandler(RecipeHandler):
autoconf = True
values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, extravalues)
classes.extend(values.pop('inherit', '').split())
- for var, value in values.iteritems():
+ for var, value in values.items():
lines_before.append('%s = "%s"' % (var, value))
else:
conffile = RecipeHandler.checkfiles(srctree, ['configure'])
@@ -446,7 +446,7 @@ class AutotoolsRecipeHandler(RecipeHandler):
defines = {}
def subst_defines(value):
newvalue = value
- for define, defval in defines.iteritems():
+ for define, defval in defines.items():
newvalue = newvalue.replace(define, defval)
if newvalue != value:
return subst_defines(newvalue)
@@ -753,7 +753,7 @@ class MakefileRecipeHandler(RecipeHandler):
if scanfile and os.path.exists(scanfile):
values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, acfile=scanfile)
classes.extend(values.pop('inherit', '').split())
- for var, value in values.iteritems():
+ for var, value in values.items():
if var == 'DEPENDS':
lines_before.append('# NOTE: some of these dependencies may be optional, check the Makefile and/or upstream documentation')
lines_before.append('%s = "%s"' % (var, value))
diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py
index c3823307a4..cc3b5a45fd 100644
--- a/scripts/lib/recipetool/create_buildsys_python.py
+++ b/scripts/lib/recipetool/create_buildsys_python.py
@@ -238,7 +238,7 @@ class PythonRecipeHandler(RecipeHandler):
# Map PKG-INFO & setup.py fields to bitbake variables
bbinfo = {}
- for field, values in info.iteritems():
+ for field, values in info.items():
if field in self.excluded_fields:
continue
@@ -294,8 +294,8 @@ class PythonRecipeHandler(RecipeHandler):
lines_after.append('# The upstream names may not correspond exactly to bitbake package names.')
lines_after.append('#')
lines_after.append('# Uncomment this line to enable all the optional features.')
- lines_after.append('#PACKAGECONFIG ?= "{}"'.format(' '.join(k.lower() for k in extras_req.iterkeys())))
- for feature, feature_reqs in extras_req.iteritems():
+ lines_after.append('#PACKAGECONFIG ?= "{}"'.format(' '.join(k.lower() for k in extras_req)))
+ for feature, feature_reqs in extras_req.items():
unmapped_deps.difference_update(feature_reqs)
feature_req_deps = ('python-' + r.replace('.', '-').lower() for r in sorted(feature_reqs))
@@ -442,8 +442,8 @@ class PythonRecipeHandler(RecipeHandler):
del info[variable]
elif new_value != value:
info[variable] = new_value
- elif hasattr(value, 'iteritems'):
- for dkey, dvalue in value.iteritems():
+ elif hasattr(value, 'items'):
+ for dkey, dvalue in value.items():
new_list = []
for pos, a_value in enumerate(dvalue):
new_value = replace_value(search, replace, a_value)
@@ -558,7 +558,7 @@ class PythonRecipeHandler(RecipeHandler):
else:
continue
- for fn in files_info.iterkeys():
+ for fn in files_info:
for suffix in suffixes:
if fn.endswith(suffix):
break
@@ -640,7 +640,7 @@ class SetupScriptVisitor(ast.NodeVisitor):
def visit_setup(self, node):
call = LiteralAstTransform().visit(node)
self.keywords = call.keywords
- for k, v in self.keywords.iteritems():
+ for k, v in self.keywords.items():
if has_non_literals(v):
self.non_literals.append(k)
@@ -708,8 +708,8 @@ def has_non_literals(value):
return True
elif isinstance(value, basestring):
return False
- elif hasattr(value, 'itervalues'):
- return any(has_non_literals(v) for v in value.itervalues())
+ elif hasattr(value, 'values'):
+ return any(has_non_literals(v) for v in value.values())
elif hasattr(value, '__iter__'):
return any(has_non_literals(v) for v in value)
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index ffbcb4905c..fcc0172af8 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -128,7 +128,7 @@ class NpmRecipeHandler(RecipeHandler):
license = self._handle_license(data)
if license:
licenses['${PN}'] = license
- for pkgname, pkgitem in npmpackages.iteritems():
+ for pkgname, pkgitem in npmpackages.items():
_, pdata = pkgitem
license = self._handle_license(pdata)
if license:
@@ -136,7 +136,7 @@ class NpmRecipeHandler(RecipeHandler):
# Now write out the package-specific license values
# We need to strip out the json data dicts for this since split_pkg_licenses
# isn't expecting it
- packages = OrderedDict((x,y[0]) for x,y in npmpackages.iteritems())
+ packages = OrderedDict((x,y[0]) for x,y in npmpackages.items())
packages['${PN}'] = ''
pkglicenses = split_pkg_licenses(licvalues, packages, lines_after, licenses)
all_licenses = list(set([item for pkglicense in pkglicenses.values() for item in pkglicense]))