diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-20 11:53:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-02 08:10:02 +0100 |
commit | caebd862bac7eed725e0f0321bf50793671b5312 (patch) | |
tree | 2da96b5da7b9b0e0ef04c03cf74f14ddfd180f30 /meta/lib/oe | |
parent | 2476bdcbef591e951d11d57d53f1315848758571 (diff) | |
download | openembedded-core-contrib-caebd862bac7eed725e0f0321bf50793671b5312.tar.gz |
classes/lib: Update to explictly create lists where needed
Iterators now return views, not lists in python3. Where we need
lists, handle this explicitly.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/classutils.py | 2 | ||||
-rw-r--r-- | meta/lib/oe/copy_buildsystem.py | 2 | ||||
-rw-r--r-- | meta/lib/oe/distro_check.py | 4 | ||||
-rw-r--r-- | meta/lib/oe/license.py | 10 | ||||
-rw-r--r-- | meta/lib/oe/manifest.py | 4 | ||||
-rw-r--r-- | meta/lib/oe/package_manager.py | 6 | ||||
-rw-r--r-- | meta/lib/oe/packagedata.py | 2 | ||||
-rw-r--r-- | meta/lib/oe/packagegroup.py | 4 | ||||
-rw-r--r-- | meta/lib/oe/prservice.py | 4 | ||||
-rw-r--r-- | meta/lib/oe/recipeutils.py | 6 | ||||
-rw-r--r-- | meta/lib/oe/rootfs.py | 4 | ||||
-rw-r--r-- | meta/lib/oe/sstatesig.py | 2 | ||||
-rw-r--r-- | meta/lib/oe/utils.py | 6 |
13 files changed, 28 insertions, 28 deletions
diff --git a/meta/lib/oe/classutils.py b/meta/lib/oe/classutils.py index 58188fdd6e0..98bb059a718 100644 --- a/meta/lib/oe/classutils.py +++ b/meta/lib/oe/classutils.py @@ -34,7 +34,7 @@ abstract base classes out of the registry).""" @classmethod def prioritized(tcls): - return sorted(tcls.registry.values(), + return sorted(list(tcls.registry.values()), key=lambda v: v.priority, reverse=True) def unregister(cls): diff --git a/meta/lib/oe/copy_buildsystem.py b/meta/lib/oe/copy_buildsystem.py index 0589b7f0455..eddf5bb2da4 100644 --- a/meta/lib/oe/copy_buildsystem.py +++ b/meta/lib/oe/copy_buildsystem.py @@ -195,7 +195,7 @@ def merge_lockedsigs(copy_tasks, lockedsigs_main, lockedsigs_extra, merged_outpu fulltypes.append(typename) f.write('SIGGEN_LOCKEDSIGS_TYPES = "%s"\n' % ' '.join(fulltypes)) - write_sigs_file(copy_output, tocopy.keys(), tocopy) + write_sigs_file(copy_output, list(tocopy.keys()), tocopy) if merged_output: write_sigs_file(merged_output, arch_order, merged) diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py index 8655a6fc148..ba1bba678d0 100644 --- a/meta/lib/oe/distro_check.py +++ b/meta/lib/oe/distro_check.py @@ -104,8 +104,8 @@ def get_source_package_list_from_url(url, section, d): bb.note("Reading %s: %s" % (url, section)) links = get_links_from_url(url, d) - srpms = filter(is_src_rpm, links) - names_list = map(package_name_from_srpm, srpms) + srpms = list(filter(is_src_rpm, links)) + names_list = list(map(package_name_from_srpm, srpms)) new_pkgs = [] for pkgs in names_list: diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py index f0f661c3ba9..39ef9654fcf 100644 --- a/meta/lib/oe/license.py +++ b/meta/lib/oe/license.py @@ -47,7 +47,7 @@ class LicenseVisitor(ast.NodeVisitor): """Get elements based on OpenEmbedded license strings""" def get_elements(self, licensestr): new_elements = [] - elements = filter(lambda x: x.strip(), license_operator.split(licensestr)) + elements = list([x for x in license_operator.split(licensestr) if x.strip()]) for pos, element in enumerate(elements): if license_pattern.match(element): if pos > 0 and license_pattern.match(elements[pos-1]): @@ -118,8 +118,8 @@ def is_included(licensestr, whitelist=None, blacklist=None): def choose_licenses(alpha, beta): """Select the option in an OR which is the 'best' (has the most included licenses).""" - alpha_weight = len(filter(include_license, alpha)) - beta_weight = len(filter(include_license, beta)) + alpha_weight = len(list(filter(include_license, alpha))) + beta_weight = len(list(filter(include_license, beta))) if alpha_weight > beta_weight: return alpha else: @@ -132,8 +132,8 @@ def is_included(licensestr, whitelist=None, blacklist=None): blacklist = [] licenses = flattened_licenses(licensestr, choose_licenses) - excluded = filter(lambda lic: exclude_license(lic), licenses) - included = filter(lambda lic: include_license(lic), licenses) + excluded = [lic for lic in licenses if exclude_license(lic)] + included = [lic for lic in licenses if include_license(lic)] if excluded: return False, excluded else: diff --git a/meta/lib/oe/manifest.py b/meta/lib/oe/manifest.py index 42832f15d2e..ec2ef500b20 100644 --- a/meta/lib/oe/manifest.py +++ b/meta/lib/oe/manifest.py @@ -219,7 +219,7 @@ class RpmManifest(Manifest): if var in self.vars_to_split: split_pkgs = self._split_multilib(self.d.getVar(var, True)) if split_pkgs is not None: - pkgs = dict(pkgs.items() + split_pkgs.items()) + pkgs = dict(list(pkgs.items()) + list(split_pkgs.items())) else: pkg_list = self.d.getVar(var, True) if pkg_list is not None: @@ -269,7 +269,7 @@ class OpkgManifest(Manifest): if var in self.vars_to_split: split_pkgs = self._split_multilib(self.d.getVar(var, True)) if split_pkgs is not None: - pkgs = dict(pkgs.items() + split_pkgs.items()) + pkgs = dict(list(pkgs.items()) + list(split_pkgs.items())) else: pkg_list = self.d.getVar(var, True) if pkg_list is not None: diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index abe9f6878b7..54e6970298a 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -643,8 +643,8 @@ class PackageManager(object): def construct_uris(self, uris, base_paths): def _append(arr1, arr2, sep='/'): res = [] - narr1 = map(lambda a: string.rstrip(a, sep), arr1) - narr2 = map(lambda a: string.lstrip(string.rstrip(a, sep), sep), arr2) + narr1 = [string.rstrip(a, sep) for a in arr1] + narr2 = [string.lstrip(string.rstrip(a, sep), sep) for a in arr2] for a1 in narr1: if arr2: for a2 in narr2: @@ -1111,7 +1111,7 @@ class RpmPM(PackageManager): sub_rdep = sub_data.get("RDEPENDS_" + pkg) if not sub_rdep: continue - done = bb.utils.explode_dep_versions2(sub_rdep).keys() + done = list(bb.utils.explode_dep_versions2(sub_rdep).keys()) next = done # Find all the rdepends on dependency chain while next: diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py index df1b4c52e36..21d4de914f7 100644 --- a/meta/lib/oe/packagedata.py +++ b/meta/lib/oe/packagedata.py @@ -66,7 +66,7 @@ def _pkgmap(d): bb.warn("No files in %s?" % pkgdatadir) files = [] - for pn in filter(lambda f: not os.path.isdir(os.path.join(pkgdatadir, f)), files): + for pn in [f for f in files if not os.path.isdir(os.path.join(pkgdatadir, f))]: try: pkgdata = read_pkgdatafile(os.path.join(pkgdatadir, pn)) except OSError: diff --git a/meta/lib/oe/packagegroup.py b/meta/lib/oe/packagegroup.py index a6fee5f9507..97819279b7f 100644 --- a/meta/lib/oe/packagegroup.py +++ b/meta/lib/oe/packagegroup.py @@ -16,11 +16,11 @@ def packages(features, d): yield pkg def required_packages(features, d): - req = filter(lambda feature: not is_optional(feature, d), features) + req = [feature for feature in features if not is_optional(feature, d)] return packages(req, d) def optional_packages(features, d): - opt = filter(lambda feature: is_optional(feature, d), features) + opt = [feature for feature in features if is_optional(feature, d)] return packages(opt, d) def active_packages(features, d): diff --git a/meta/lib/oe/prservice.py b/meta/lib/oe/prservice.py index 9e5a0c9830f..0054f954cc8 100644 --- a/meta/lib/oe/prservice.py +++ b/meta/lib/oe/prservice.py @@ -1,7 +1,7 @@ def prserv_make_conn(d, check = False): import prserv.serv - host_params = filter(None, (d.getVar("PRSERV_HOST", True) or '').split(':')) + host_params = list([_f for _f in (d.getVar("PRSERV_HOST", True) or '').split(':') if _f]) try: conn = None conn = prserv.serv.PRServerConnection(host_params[0], int(host_params[1])) @@ -114,7 +114,7 @@ def prserv_export_tofile(d, metainfo, datainfo, lockdown, nomax=False): bb.utils.unlockfile(lf) def prserv_check_avail(d): - host_params = filter(None, (d.getVar("PRSERV_HOST", True) or '').split(':')) + host_params = list([_f for _f in (d.getVar("PRSERV_HOST", True) or '').split(':') if _f]) try: if len(host_params) != 2: raise TypeError diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py index b437720fe73..146fe83e18a 100644 --- a/meta/lib/oe/recipeutils.py +++ b/meta/lib/oe/recipeutils.py @@ -692,7 +692,7 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, varnames = [item[0] for item in bbappendlines] if removevalues: - varnames.extend(removevalues.keys()) + varnames.extend(list(removevalues.keys())) with open(appendpath, 'r') as f: (updated, newlines) = bb.utils.edit_metadata(f, varnames, appendfile_varfunc) @@ -743,12 +743,12 @@ def replace_dir_vars(path, d): """Replace common directory paths with appropriate variable references (e.g. /etc becomes ${sysconfdir})""" dirvars = {} # Sort by length so we get the variables we're interested in first - for var in sorted(d.keys(), key=len): + for var in sorted(list(d.keys()), key=len): if var.endswith('dir') and var.lower() == var: value = d.getVar(var, True) if value.startswith('/') and not '\n' in value and value not in dirvars: dirvars[value] = var - for dirpath in sorted(dirvars.keys(), reverse=True): + for dirpath in sorted(list(dirvars.keys()), reverse=True): path = path.replace(dirpath, '${%s}' % dirvars[dirpath]) return path diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 7087b12f252..d93485819ab 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -536,7 +536,7 @@ class DpkgOpkgRootfs(Rootfs): pkg_depends = m_depends.group(1) # remove package dependencies not in postinsts - pkg_names = pkgs.keys() + pkg_names = list(pkgs.keys()) for pkg_name in pkg_names: deps = pkgs[pkg_name][:] @@ -569,7 +569,7 @@ class DpkgOpkgRootfs(Rootfs): pkgs = self._get_pkgs_postinsts(status_file) if pkgs: root = "__packagegroup_postinst__" - pkgs[root] = pkgs.keys() + pkgs[root] = list(pkgs.keys()) _dep_resolve(pkgs, root, pkg_list, []) pkg_list.remove(root) diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py index 500122d4618..a58f03a3428 100644 --- a/meta/lib/oe/sstatesig.py +++ b/meta/lib/oe/sstatesig.py @@ -210,7 +210,7 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash): continue f.write(" " + self.lockedpnmap[fn] + ":" + task + ":" + self.taskhash[k] + " \\\n") f.write(' "\n') - f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(types.keys()))) + f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(list(types.keys())))) def checkhashes(self, missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d): warn_msgs = [] diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index 32d61794eea..1bbdbb4bd5b 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py @@ -85,11 +85,11 @@ def prune_suffix(var, suffixes, d): def str_filter(f, str, d): from re import match - return " ".join(filter(lambda x: match(f, x, 0), str.split())) + return " ".join([x for x in str.split() if match(f, x, 0)]) def str_filter_out(f, str, d): from re import match - return " ".join(filter(lambda x: not match(f, x, 0), str.split())) + return " ".join([x for x in str.split() if not match(f, x, 0)]) def param_bool(cfg, field, dflt = None): """Lookup <field> in <cfg> map and convert it to a boolean; take @@ -134,7 +134,7 @@ def packages_filter_out_system(d): PN-dbg PN-doc PN-locale-eb-gb removed. """ pn = d.getVar('PN', True) - blacklist = map(lambda suffix: pn + suffix, ('', '-dbg', '-dev', '-doc', '-locale', '-staticdev')) + blacklist = [pn + suffix for suffix in ('', '-dbg', '-dev', '-doc', '-locale', '-staticdev')] localepkg = pn + "-locale-" pkgs = [] |