summaryrefslogtreecommitdiffstats
path: root/lib/bb/ui
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-12 08:30:35 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-01 15:27:55 +0100
commitd0f904d407f57998419bd9c305ce53e5eaa36b24 (patch)
tree47488e99b76374cddf1566cb8af3f3c32bd13b76 /lib/bb/ui
parentbf25f05ce4db11466e62f134f9a6916f886a93d9 (diff)
downloadbitbake-d0f904d407f57998419bd9c305ce53e5eaa36b24.tar.gz
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/ui')
-rw-r--r--lib/bb/ui/crumbs/hobwidget.py2
-rw-r--r--lib/bb/ui/crumbs/progressbar.py6
-rw-r--r--lib/bb/ui/crumbs/runningbuild.py12
-rw-r--r--lib/bb/ui/goggle.py11
-rw-r--r--lib/bb/ui/knotty.py6
-rw-r--r--lib/bb/ui/ncurses.py8
-rw-r--r--lib/bb/ui/uievent.py4
7 files changed, 27 insertions, 22 deletions
diff --git a/lib/bb/ui/crumbs/hobwidget.py b/lib/bb/ui/crumbs/hobwidget.py
index 2b969c146..1f51a3cf7 100644
--- a/lib/bb/ui/crumbs/hobwidget.py
+++ b/lib/bb/ui/crumbs/hobwidget.py
@@ -612,7 +612,7 @@ class HobIconChecker(hic):
def set_hob_icon_to_stock_icon(self, file_path, stock_id=""):
try:
pixbuf = gtk.gdk.pixbuf_new_from_file(file_path)
- except Exception, e:
+ except Exception as e:
return None
if stock_id and (gtk.icon_factory_lookup_default(stock_id) == None):
diff --git a/lib/bb/ui/crumbs/progressbar.py b/lib/bb/ui/crumbs/progressbar.py
index 3e2c660e4..03230ae8a 100644
--- a/lib/bb/ui/crumbs/progressbar.py
+++ b/lib/bb/ui/crumbs/progressbar.py
@@ -44,9 +44,9 @@ class HobProgressBar (gtk.ProgressBar):
self.set_text(text)
def set_stop_title(self, text=None):
- if not text:
- text = ""
- self.set_text(text)
+ if not text:
+ text = ""
+ self.set_text(text)
def reset(self):
self.set_fraction(0)
diff --git a/lib/bb/ui/crumbs/runningbuild.py b/lib/bb/ui/crumbs/runningbuild.py
index 16a955d2b..9b695ac2e 100644
--- a/lib/bb/ui/crumbs/runningbuild.py
+++ b/lib/bb/ui/crumbs/runningbuild.py
@@ -23,14 +23,14 @@ import gtk
import gobject
import logging
import time
-import urllib
-import urllib2
+import urllib.request, urllib.parse, urllib.error
+import urllib.request, urllib.error, urllib.parse
import pango
from bb.ui.crumbs.hobcolor import HobColors
from bb.ui.crumbs.hobwidget import HobWarpCellRendererText, HobCellRendererPixbuf
class RunningBuildModel (gtk.TreeStore):
- (COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_COLOR, COL_NUM_ACTIVE) = range(7)
+ (COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_COLOR, COL_NUM_ACTIVE) = list(range(7))
def __init__ (self):
gtk.TreeStore.__init__ (self,
@@ -443,8 +443,8 @@ def do_pastebin(text):
url = 'http://pastebin.com/api_public.php'
params = {'paste_code': text, 'paste_format': 'text'}
- req = urllib2.Request(url, urllib.urlencode(params))
- response = urllib2.urlopen(req)
+ req = urllib.request.Request(url, urllib.parse.urlencode(params))
+ response = urllib.request.urlopen(req)
paste_url = response.read()
return paste_url
@@ -519,7 +519,7 @@ class RunningBuildTreeView (gtk.TreeView):
# @todo Provide visual feedback to the user that it is done and that
# it worked.
- print paste_url
+ print(paste_url)
self._add_to_clipboard(paste_url)
diff --git a/lib/bb/ui/goggle.py b/lib/bb/ui/goggle.py
index f4ee7b41a..f5f8f1668 100644
--- a/lib/bb/ui/goggle.py
+++ b/lib/bb/ui/goggle.py
@@ -18,13 +18,18 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+from gi import pygtkcompat
+
+pygtkcompat.enable()
+pygtkcompat.enable_gtk(version='3.0')
+
import gobject
import gtk
-import xmlrpclib
+import xmlrpc.client
from bb.ui.crumbs.runningbuild import RunningBuildTreeView, RunningBuild
from bb.ui.crumbs.progress import ProgressBar
-import Queue
+import queue
def event_handle_idle_func (eventHandler, build, pbar):
@@ -96,7 +101,7 @@ def main (server, eventHandler, params):
elif ret != True:
print("Error running command '%s': returned %s" % (cmdline, ret))
return 1
- except xmlrpclib.Fault as x:
+ except xmlrpcclient.Fault as x:
print("XMLRPC Fault getting commandline:\n %s" % x)
return 1
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 08c872e39..9605c8ee5 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -22,7 +22,7 @@ from __future__ import division
import os
import sys
-import xmlrpclib
+import xmlrpc.client as xmlrpclib
import logging
import progressbar
import signal
@@ -184,8 +184,8 @@ class TerminalFilter(object):
def clearFooter(self):
if self.footer_present:
lines = self.footer_present
- sys.stdout.write(self.curses.tparm(self.cuu, lines))
- sys.stdout.write(self.curses.tparm(self.ed))
+ sys.stdout.buffer.write(self.curses.tparm(self.cuu, lines))
+ sys.stdout.buffer.write(self.curses.tparm(self.ed))
sys.stdout.flush()
self.footer_present = False
diff --git a/lib/bb/ui/ncurses.py b/lib/bb/ui/ncurses.py
index 9589a77d7..d81e4138b 100644
--- a/lib/bb/ui/ncurses.py
+++ b/lib/bb/ui/ncurses.py
@@ -45,7 +45,7 @@
"""
-from __future__ import division
+
import logging
import os, sys, itertools, time, subprocess
@@ -55,7 +55,7 @@ except ImportError:
sys.exit("FATAL: The ncurses ui could not load the required curses python module.")
import bb
-import xmlrpclib
+import xmlrpc.client
from bb import ui
from bb.ui import uihelper
@@ -252,7 +252,7 @@ class NCursesUI:
elif ret != True:
print("Couldn't get default commandlind! %s" % ret)
return
- except xmlrpclib.Fault as x:
+ except xmlrpc.client.Fault as x:
print("XMLRPC Fault getting commandline:\n %s" % x)
return
@@ -331,7 +331,7 @@ class NCursesUI:
taw.setText(0, 0, "")
if activetasks:
taw.appendText("Active Tasks:\n")
- for task in activetasks.itervalues():
+ for task in activetasks.values():
taw.appendText(task["title"] + '\n')
if failedtasks:
taw.appendText("Failed Tasks:\n")
diff --git a/lib/bb/ui/uievent.py b/lib/bb/ui/uievent.py
index df093c53c..ca1916664 100644
--- a/lib/bb/ui/uievent.py
+++ b/lib/bb/ui/uievent.py
@@ -25,7 +25,7 @@ client/server deadlocks.
"""
import socket, threading, pickle, collections
-from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
+from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
class BBUIEventQueue:
def __init__(self, BBServer, clientinfo=("localhost, 0")):
@@ -137,7 +137,7 @@ class UIXMLRPCServer (SimpleXMLRPCServer):
SimpleXMLRPCServer.__init__( self,
interface,
requestHandler=SimpleXMLRPCRequestHandler,
- logRequests=False, allow_none=True)
+ logRequests=False, allow_none=True, use_builtin_types=True)
def get_request(self):
while not self.quit: