From d0f904d407f57998419bd9c305ce53e5eaa36b24 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 12 May 2016 08:30:35 +0100 Subject: bitbake: Convert to python 3 Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. Signed-off-by: Richard Purdie --- lib/bblayers/action.py | 2 +- lib/bblayers/common.py | 2 +- lib/bblayers/layerindex.py | 12 ++++++------ lib/bblayers/query.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'lib/bblayers') diff --git a/lib/bblayers/action.py b/lib/bblayers/action.py index 5b95e2ecb..d4c1792f6 100644 --- a/lib/bblayers/action.py +++ b/lib/bblayers/action.py @@ -117,7 +117,7 @@ build results (as the layer priority order has effectively changed). applied_appends = [] for layer in layers: overlayed = [] - for f in self.tinfoil.cooker.collection.overlayed.iterkeys(): + for f in self.tinfoil.cooker.collection.overlayed.keys(): for of in self.tinfoil.cooker.collection.overlayed[f]: if of.startswith(layer): overlayed.append(of) diff --git a/lib/bblayers/common.py b/lib/bblayers/common.py index 360b9d764..b10fb4cea 100644 --- a/lib/bblayers/common.py +++ b/lib/bblayers/common.py @@ -14,7 +14,7 @@ class LayerPlugin(): self.tinfoil = tinfoil self.bblayers = (self.tinfoil.config_data.getVar('BBLAYERS', True) or "").split() layerconfs = self.tinfoil.config_data.varhistory.get_variable_items_files('BBFILE_COLLECTIONS', self.tinfoil.config_data) - self.bbfile_collections = {layer: os.path.dirname(os.path.dirname(path)) for layer, path in layerconfs.iteritems()} + self.bbfile_collections = {layer: os.path.dirname(os.path.dirname(path)) for layer, path in layerconfs.items()} @staticmethod def add_command(subparsers, cmdname, function, parserecipes=True, *args, **kwargs): diff --git a/lib/bblayers/layerindex.py b/lib/bblayers/layerindex.py index 3c39d8a79..10ad718eb 100644 --- a/lib/bblayers/layerindex.py +++ b/lib/bblayers/layerindex.py @@ -1,10 +1,10 @@ import argparse -import httplib +import http.client import json import logging import os import subprocess -import urlparse +import urllib.parse from bblayers.action import ActionPlugin @@ -24,12 +24,12 @@ class LayerIndexPlugin(ActionPlugin): def get_json_data(self, apiurl): proxy_settings = os.environ.get("http_proxy", None) conn = None - _parsedurl = urlparse.urlparse(apiurl) + _parsedurl = urllib.parse.urlparse(apiurl) path = _parsedurl.path query = _parsedurl.query def parse_url(url): - parsedurl = urlparse.urlparse(url) + parsedurl = urllib.parse.urlparse(url) if parsedurl.netloc[0] == '[': host, port = parsedurl.netloc[1:].split(']', 1) if ':' in port: @@ -46,11 +46,11 @@ class LayerIndexPlugin(ActionPlugin): if proxy_settings is None: host, port = parse_url(apiurl) - conn = httplib.HTTPConnection(host, port) + conn = http.client.HTTPConnection(host, port) conn.request("GET", path + "?" + query) else: host, port = parse_url(proxy_settings) - conn = httplib.HTTPConnection(host, port) + conn = http.client.HTTPConnection(host, port) conn.request("GET", apiurl) r = conn.getresponse() diff --git a/lib/bblayers/query.py b/lib/bblayers/query.py index b5b98f763..b8c817b12 100644 --- a/lib/bblayers/query.py +++ b/lib/bblayers/query.py @@ -128,7 +128,7 @@ skipped recipes will also be listed, with a " (skipped)" suffix. # Ensure we list skipped recipes # We are largely guessing about PN, PV and the preferred version here, # but we have no choice since skipped recipes are not fully parsed - skiplist = self.tinfoil.cooker.skiplist.keys() + skiplist = list(self.tinfoil.cooker.skiplist.keys()) skiplist.sort( key=lambda fileitem: self.tinfoil.cooker.collection.calc_bbfile_priority(fileitem) ) skiplist.reverse() for fn in skiplist: @@ -275,7 +275,7 @@ Lists recipes with the bbappends that apply to them as subitems. def show_appends_for_skipped(self): filenames = [os.path.basename(f) - for f in self.tinfoil.cooker.skiplist.iterkeys()] + for f in self.tinfoil.cooker.skiplist.keys()] return self.show_appends_output(filenames, None, " (skipped)") def show_appends_output(self, filenames, best_filename, name_suffix = ''): -- cgit 1.2.3-korg