From bc8971d122a02ed823acf0758da267dccc584f98 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 12 May 2016 08:30:35 +0100 Subject: bitbake: bitbake: Convert to python 3 megacommit This needs breaking up into smaller changes. (Bitbake rev: cf51f19aed208a75d38c14cd585d9b9f115e3ba3) Signed-off-by: Richard Purdie --- bitbake/bin/bitbake-layers | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'bitbake/bin/bitbake-layers') diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers index 8b17eb0696..9d397e93a2 100755 --- a/bitbake/bin/bitbake-layers +++ b/bitbake/bin/bitbake-layers @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This script has subcommands which operate against your bitbake layers, either # displaying useful information, or acting against them. @@ -27,7 +27,7 @@ import fnmatch from collections import defaultdict import argparse import re -import httplib, urlparse, json +import http.client, urllib.parse, json import subprocess bindir = os.path.dirname(__file__) @@ -68,7 +68,7 @@ class Commands(): self.bblayers = (self.bbhandler.config_data.getVar('BBLAYERS', True) or "").split() self.bbhandler.prepare(config_only) layerconfs = self.bbhandler.config_data.varhistory.get_variable_items_files('BBFILE_COLLECTIONS', self.bbhandler.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()} def do_show_layers(self, args): @@ -134,11 +134,11 @@ Removes the specified layer from bblayers.conf 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: @@ -155,11 +155,11 @@ Removes the specified layer from bblayers.conf 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() @@ -632,7 +632,7 @@ build results (as the layer priority order has effectively changed). applied_appends = [] for layer in layers: overlayed = [] - for f in self.bbhandler.cooker.collection.overlayed.iterkeys(): + for f in self.bbhandler.cooker.collection.overlayed.keys(): for of in self.bbhandler.cooker.collection.overlayed[f]: if of.startswith(layer): overlayed.append(of) @@ -777,7 +777,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.bbhandler.cooker.skiplist.iterkeys()] + for f in self.bbhandler.cooker.skiplist.keys()] return self.show_appends_output(filenames, None, " (skipped)") def show_appends_output(self, filenames, best_filename, name_suffix = ''): @@ -1006,6 +1006,7 @@ def main(): parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true') subparsers = parser.add_subparsers(title='subcommands', metavar='') + subparsers.required = True parser_show_layers = add_command('show-layers', cmds.do_show_layers) -- cgit v1.2.3-54-g00ecf