summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool
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:24:01 +0100
commit7eab022d4b484aec40998f95835ba46c5da168cf (patch)
treee88a3bf01eada7d44e41bfadee5721ce6ec198e0 /scripts/lib/recipetool
parent63404baadbfd1225bbb955f8c8f817073aef65d8 (diff)
downloadpoky-7eab022d4b484aec40998f95835ba46c5da168cf.tar.gz
scripts: Fix deprecated dict methods for python3
Replaced iteritems -> items, itervalues -> values, iterkeys -> keys or 'in' (From OE-Core rev: 25d4d8274bac696a484f83d7f3ada778cf95f4d0) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool')
-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
5 files changed, 26 insertions, 26 deletions
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):
61 '/etc/gshadow': '/etc/gshadow should be managed through the useradd and extrausers classes', 61 '/etc/gshadow': '/etc/gshadow should be managed through the useradd and extrausers classes',
62 '${sysconfdir}/hostname': '${sysconfdir}/hostname contents should be set by setting hostname_pn-base-files = "value" in configuration',} 62 '${sysconfdir}/hostname': '${sysconfdir}/hostname contents should be set by setting hostname_pn-base-files = "value" in configuration',}
63 63
64 for pthspec, message in invalidtargets.iteritems(): 64 for pthspec, message in invalidtargets.items():
65 if fnmatch.fnmatchcase(targetpath, d.expand(pthspec)): 65 if fnmatch.fnmatchcase(targetpath, d.expand(pthspec)):
66 raise InvalidTargetFileError(d.expand(message)) 66 raise InvalidTargetFileError(d.expand(message))
67 67
@@ -152,7 +152,7 @@ def determine_file_source(targetpath, rd):
152 # Check patches 152 # Check patches
153 srcpatches = [] 153 srcpatches = []
154 patchedfiles = oe.recipeutils.get_recipe_patched_files(rd) 154 patchedfiles = oe.recipeutils.get_recipe_patched_files(rd)
155 for patch, filelist in patchedfiles.iteritems(): 155 for patch, filelist in patchedfiles.items():
156 for fileitem in filelist: 156 for fileitem in filelist:
157 if fileitem[0] == srcpath: 157 if fileitem[0] == srcpath:
158 srcpatches.append((patch, fileitem[1])) 158 srcpatches.append((patch, fileitem[1]))
@@ -270,7 +270,7 @@ def appendfile(args):
270 postinst_pns = [] 270 postinst_pns = []
271 271
272 selectpn = None 272 selectpn = None
273 for targetpath, pnlist in recipes.iteritems(): 273 for targetpath, pnlist in recipes.items():
274 for pn in pnlist: 274 for pn in pnlist:
275 if pn.startswith('?'): 275 if pn.startswith('?'):
276 alternative_pns.append(pn[1:]) 276 alternative_pns.append(pn[1:])
@@ -351,7 +351,7 @@ def appendsrc(args, files, rd, extralines=None):
351 351
352 copyfiles = {} 352 copyfiles = {}
353 extralines = extralines or [] 353 extralines = extralines or []
354 for newfile, srcfile in files.iteritems(): 354 for newfile, srcfile in files.items():
355 src_destdir = os.path.dirname(srcfile) 355 src_destdir = os.path.dirname(srcfile)
356 if not args.use_workdir: 356 if not args.use_workdir:
357 if rd.getVar('S', True) == rd.getVar('STAGING_KERNEL_DIR', True): 357 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):
61 libpaths = list(set([base_libdir, libdir])) 61 libpaths = list(set([base_libdir, libdir]))
62 libname_re = re.compile('^lib(.+)\.so.*$') 62 libname_re = re.compile('^lib(.+)\.so.*$')
63 pkglibmap = {} 63 pkglibmap = {}
64 for lib, item in shlib_providers.iteritems(): 64 for lib, item in shlib_providers.items():
65 for path, pkg in item.iteritems(): 65 for path, pkg in item.items():
66 if path in libpaths: 66 if path in libpaths:
67 res = libname_re.match(lib) 67 res = libname_re.match(lib)
68 if res: 68 if res:
@@ -74,7 +74,7 @@ class RecipeHandler(object):
74 74
75 # Now turn it into a library->recipe mapping 75 # Now turn it into a library->recipe mapping
76 pkgdata_dir = d.getVar('PKGDATA_DIR', True) 76 pkgdata_dir = d.getVar('PKGDATA_DIR', True)
77 for libname, pkg in pkglibmap.iteritems(): 77 for libname, pkg in pkglibmap.items():
78 try: 78 try:
79 with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f: 79 with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f:
80 for line in f: 80 for line in f:
@@ -663,7 +663,7 @@ def create_recipe(args):
663 else: 663 else:
664 extraoutdir = os.path.join(os.path.dirname(outfile), pn) 664 extraoutdir = os.path.join(os.path.dirname(outfile), pn)
665 bb.utils.mkdirhier(extraoutdir) 665 bb.utils.mkdirhier(extraoutdir)
666 for destfn, extrafile in extrafiles.iteritems(): 666 for destfn, extrafile in extrafiles.items():
667 shutil.move(extrafile, os.path.join(extraoutdir, destfn)) 667 shutil.move(extrafile, os.path.join(extraoutdir, destfn))
668 668
669 lines = lines_before 669 lines = lines_before
@@ -901,7 +901,7 @@ def split_pkg_licenses(licvalues, packages, outlines, fallback_licenses=None, pn
901 """ 901 """
902 pkglicenses = {pn: []} 902 pkglicenses = {pn: []}
903 for license, licpath, _ in licvalues: 903 for license, licpath, _ in licvalues:
904 for pkgname, pkgpath in packages.iteritems(): 904 for pkgname, pkgpath in packages.items():
905 if licpath.startswith(pkgpath + '/'): 905 if licpath.startswith(pkgpath + '/'):
906 if pkgname in pkglicenses: 906 if pkgname in pkglicenses:
907 pkglicenses[pkgname].append(license) 907 pkglicenses[pkgname].append(license)
@@ -928,7 +928,7 @@ def read_pkgconfig_provides(d):
928 for line in f: 928 for line in f:
929 pkgmap[os.path.basename(line.rstrip())] = os.path.splitext(os.path.basename(fn))[0] 929 pkgmap[os.path.basename(line.rstrip())] = os.path.splitext(os.path.basename(fn))[0]
930 recipemap = {} 930 recipemap = {}
931 for pc, pkg in pkgmap.iteritems(): 931 for pc, pkg in pkgmap.items():
932 pkgdatafile = os.path.join(pkgdatadir, 'runtime', pkg) 932 pkgdatafile = os.path.join(pkgdatadir, 'runtime', pkg)
933 if os.path.exists(pkgdatafile): 933 if os.path.exists(pkgdatafile):
934 with open(pkgdatafile, 'r') as f: 934 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):
44 classes.append('cmake') 44 classes.append('cmake')
45 values = CmakeRecipeHandler.extract_cmake_deps(lines_before, srctree, extravalues) 45 values = CmakeRecipeHandler.extract_cmake_deps(lines_before, srctree, extravalues)
46 classes.extend(values.pop('inherit', '').split()) 46 classes.extend(values.pop('inherit', '').split())
47 for var, value in values.iteritems(): 47 for var, value in values.items():
48 lines_before.append('%s = "%s"' % (var, value)) 48 lines_before.append('%s = "%s"' % (var, value))
49 lines_after.append('# Specify any options you want to pass to cmake using EXTRA_OECMAKE:') 49 lines_after.append('# Specify any options you want to pass to cmake using EXTRA_OECMAKE:')
50 lines_after.append('EXTRA_OECMAKE = ""') 50 lines_after.append('EXTRA_OECMAKE = ""')
@@ -159,7 +159,7 @@ class CmakeRecipeHandler(RecipeHandler):
159 159
160 def find_cmake_package(pkg): 160 def find_cmake_package(pkg):
161 RecipeHandler.load_devel_filemap(tinfoil.config_data) 161 RecipeHandler.load_devel_filemap(tinfoil.config_data)
162 for fn, pn in RecipeHandler.recipecmakefilemap.iteritems(): 162 for fn, pn in RecipeHandler.recipecmakefilemap.items():
163 splitname = fn.split('/') 163 splitname = fn.split('/')
164 if len(splitname) > 1: 164 if len(splitname) > 1:
165 if splitname[0].lower().startswith(pkg.lower()): 165 if splitname[0].lower().startswith(pkg.lower()):
@@ -348,7 +348,7 @@ class AutotoolsRecipeHandler(RecipeHandler):
348 autoconf = True 348 autoconf = True
349 values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, extravalues) 349 values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, extravalues)
350 classes.extend(values.pop('inherit', '').split()) 350 classes.extend(values.pop('inherit', '').split())
351 for var, value in values.iteritems(): 351 for var, value in values.items():
352 lines_before.append('%s = "%s"' % (var, value)) 352 lines_before.append('%s = "%s"' % (var, value))
353 else: 353 else:
354 conffile = RecipeHandler.checkfiles(srctree, ['configure']) 354 conffile = RecipeHandler.checkfiles(srctree, ['configure'])
@@ -446,7 +446,7 @@ class AutotoolsRecipeHandler(RecipeHandler):
446 defines = {} 446 defines = {}
447 def subst_defines(value): 447 def subst_defines(value):
448 newvalue = value 448 newvalue = value
449 for define, defval in defines.iteritems(): 449 for define, defval in defines.items():
450 newvalue = newvalue.replace(define, defval) 450 newvalue = newvalue.replace(define, defval)
451 if newvalue != value: 451 if newvalue != value:
452 return subst_defines(newvalue) 452 return subst_defines(newvalue)
@@ -753,7 +753,7 @@ class MakefileRecipeHandler(RecipeHandler):
753 if scanfile and os.path.exists(scanfile): 753 if scanfile and os.path.exists(scanfile):
754 values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, acfile=scanfile) 754 values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, acfile=scanfile)
755 classes.extend(values.pop('inherit', '').split()) 755 classes.extend(values.pop('inherit', '').split())
756 for var, value in values.iteritems(): 756 for var, value in values.items():
757 if var == 'DEPENDS': 757 if var == 'DEPENDS':
758 lines_before.append('# NOTE: some of these dependencies may be optional, check the Makefile and/or upstream documentation') 758 lines_before.append('# NOTE: some of these dependencies may be optional, check the Makefile and/or upstream documentation')
759 lines_before.append('%s = "%s"' % (var, value)) 759 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):
238 238
239 # Map PKG-INFO & setup.py fields to bitbake variables 239 # Map PKG-INFO & setup.py fields to bitbake variables
240 bbinfo = {} 240 bbinfo = {}
241 for field, values in info.iteritems(): 241 for field, values in info.items():
242 if field in self.excluded_fields: 242 if field in self.excluded_fields:
243 continue 243 continue
244 244
@@ -294,8 +294,8 @@ class PythonRecipeHandler(RecipeHandler):
294 lines_after.append('# The upstream names may not correspond exactly to bitbake package names.') 294 lines_after.append('# The upstream names may not correspond exactly to bitbake package names.')
295 lines_after.append('#') 295 lines_after.append('#')
296 lines_after.append('# Uncomment this line to enable all the optional features.') 296 lines_after.append('# Uncomment this line to enable all the optional features.')
297 lines_after.append('#PACKAGECONFIG ?= "{}"'.format(' '.join(k.lower() for k in extras_req.iterkeys()))) 297 lines_after.append('#PACKAGECONFIG ?= "{}"'.format(' '.join(k.lower() for k in extras_req)))
298 for feature, feature_reqs in extras_req.iteritems(): 298 for feature, feature_reqs in extras_req.items():
299 unmapped_deps.difference_update(feature_reqs) 299 unmapped_deps.difference_update(feature_reqs)
300 300
301 feature_req_deps = ('python-' + r.replace('.', '-').lower() for r in sorted(feature_reqs)) 301 feature_req_deps = ('python-' + r.replace('.', '-').lower() for r in sorted(feature_reqs))
@@ -442,8 +442,8 @@ class PythonRecipeHandler(RecipeHandler):
442 del info[variable] 442 del info[variable]
443 elif new_value != value: 443 elif new_value != value:
444 info[variable] = new_value 444 info[variable] = new_value
445 elif hasattr(value, 'iteritems'): 445 elif hasattr(value, 'items'):
446 for dkey, dvalue in value.iteritems(): 446 for dkey, dvalue in 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)
@@ -558,7 +558,7 @@ class PythonRecipeHandler(RecipeHandler):
558 else: 558 else:
559 continue 559 continue
560 560
561 for fn in files_info.iterkeys(): 561 for fn in files_info:
562 for suffix in suffixes: 562 for suffix in suffixes:
563 if fn.endswith(suffix): 563 if fn.endswith(suffix):
564 break 564 break
@@ -640,7 +640,7 @@ class SetupScriptVisitor(ast.NodeVisitor):
640 def visit_setup(self, node): 640 def visit_setup(self, node):
641 call = LiteralAstTransform().visit(node) 641 call = LiteralAstTransform().visit(node)
642 self.keywords = call.keywords 642 self.keywords = call.keywords
643 for k, v in self.keywords.iteritems(): 643 for k, v in self.keywords.items():
644 if has_non_literals(v): 644 if has_non_literals(v):
645 self.non_literals.append(k) 645 self.non_literals.append(k)
646 646
@@ -708,8 +708,8 @@ def has_non_literals(value):
708 return True 708 return True
709 elif isinstance(value, basestring): 709 elif isinstance(value, basestring):
710 return False 710 return False
711 elif hasattr(value, 'itervalues'): 711 elif hasattr(value, 'values'):
712 return any(has_non_literals(v) for v in value.itervalues()) 712 return any(has_non_literals(v) for v in value.values())
713 elif hasattr(value, '__iter__'): 713 elif hasattr(value, '__iter__'):
714 return any(has_non_literals(v) for v in value) 714 return any(has_non_literals(v) for v in value)
715 715
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):
128 license = self._handle_license(data) 128 license = self._handle_license(data)
129 if license: 129 if license:
130 licenses['${PN}'] = license 130 licenses['${PN}'] = license
131 for pkgname, pkgitem in npmpackages.iteritems(): 131 for pkgname, pkgitem in npmpackages.items():
132 _, pdata = pkgitem 132 _, pdata = pkgitem
133 license = self._handle_license(pdata) 133 license = self._handle_license(pdata)
134 if license: 134 if license:
@@ -136,7 +136,7 @@ class NpmRecipeHandler(RecipeHandler):
136 # Now write out the package-specific license values 136 # Now write out the package-specific license values
137 # We need to strip out the json data dicts for this since split_pkg_licenses 137 # We need to strip out the json data dicts for this since split_pkg_licenses
138 # isn't expecting it 138 # isn't expecting it
139 packages = OrderedDict((x,y[0]) for x,y in npmpackages.iteritems()) 139 packages = OrderedDict((x,y[0]) for x,y in npmpackages.items())
140 packages['${PN}'] = '' 140 packages['${PN}'] = ''
141 pkglicenses = split_pkg_licenses(licvalues, packages, lines_after, licenses) 141 pkglicenses = split_pkg_licenses(licvalues, packages, lines_after, licenses)
142 all_licenses = list(set([item for pkglicense in pkglicenses.values() for item in pkglicense])) 142 all_licenses = list(set([item for pkglicense in pkglicenses.values() for item in pkglicense]))