diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-12 08:30:35 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-02 08:24:02 +0100 |
| commit | 0f2c59367a649de5f57acdccfb4f1fdba9cde730 (patch) | |
| tree | 7a3558a3e08e690fbb0b5bdc4044316f9ab4bbcb /bitbake/lib/bb/ui | |
| parent | ef1df516512587ad415f76a9626620992d660e45 (diff) | |
| download | poky-0f2c59367a649de5f57acdccfb4f1fdba9cde730.tar.gz | |
bitbake: bitbake: Convert to python 3
Various misc changes to convert bitbake to python3 which don't warrant
separation into separate commits.
(Bitbake rev: d0f904d407f57998419bd9c305ce53e5eaa36b24)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
| -rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobwidget.py | 2 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/crumbs/progressbar.py | 6 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/crumbs/runningbuild.py | 12 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/goggle.py | 11 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 6 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/ncurses.py | 8 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/uievent.py | 4 |
7 files changed, 27 insertions, 22 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py index 2b969c146e..1f51a3cf7f 100644 --- a/bitbake/lib/bb/ui/crumbs/hobwidget.py +++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py | |||
| @@ -612,7 +612,7 @@ class HobIconChecker(hic): | |||
| 612 | def set_hob_icon_to_stock_icon(self, file_path, stock_id=""): | 612 | def set_hob_icon_to_stock_icon(self, file_path, stock_id=""): |
| 613 | try: | 613 | try: |
| 614 | pixbuf = gtk.gdk.pixbuf_new_from_file(file_path) | 614 | pixbuf = gtk.gdk.pixbuf_new_from_file(file_path) |
| 615 | except Exception, e: | 615 | except Exception as e: |
| 616 | return None | 616 | return None |
| 617 | 617 | ||
| 618 | if stock_id and (gtk.icon_factory_lookup_default(stock_id) == None): | 618 | if stock_id and (gtk.icon_factory_lookup_default(stock_id) == None): |
diff --git a/bitbake/lib/bb/ui/crumbs/progressbar.py b/bitbake/lib/bb/ui/crumbs/progressbar.py index 3e2c660e4a..03230ae8a9 100644 --- a/bitbake/lib/bb/ui/crumbs/progressbar.py +++ b/bitbake/lib/bb/ui/crumbs/progressbar.py | |||
| @@ -44,9 +44,9 @@ class HobProgressBar (gtk.ProgressBar): | |||
| 44 | self.set_text(text) | 44 | self.set_text(text) |
| 45 | 45 | ||
| 46 | def set_stop_title(self, text=None): | 46 | def set_stop_title(self, text=None): |
| 47 | if not text: | 47 | if not text: |
| 48 | text = "" | 48 | text = "" |
| 49 | self.set_text(text) | 49 | self.set_text(text) |
| 50 | 50 | ||
| 51 | def reset(self): | 51 | def reset(self): |
| 52 | self.set_fraction(0) | 52 | self.set_fraction(0) |
diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py index 16a955d2b1..9b695ac2ed 100644 --- a/bitbake/lib/bb/ui/crumbs/runningbuild.py +++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py | |||
| @@ -23,14 +23,14 @@ import gtk | |||
| 23 | import gobject | 23 | import gobject |
| 24 | import logging | 24 | import logging |
| 25 | import time | 25 | import time |
| 26 | import urllib | 26 | import urllib.request, urllib.parse, urllib.error |
| 27 | import urllib2 | 27 | import urllib.request, urllib.error, urllib.parse |
| 28 | import pango | 28 | import pango |
| 29 | from bb.ui.crumbs.hobcolor import HobColors | 29 | from bb.ui.crumbs.hobcolor import HobColors |
| 30 | from bb.ui.crumbs.hobwidget import HobWarpCellRendererText, HobCellRendererPixbuf | 30 | from bb.ui.crumbs.hobwidget import HobWarpCellRendererText, HobCellRendererPixbuf |
| 31 | 31 | ||
| 32 | class RunningBuildModel (gtk.TreeStore): | 32 | class RunningBuildModel (gtk.TreeStore): |
| 33 | (COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_COLOR, COL_NUM_ACTIVE) = range(7) | 33 | (COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_COLOR, COL_NUM_ACTIVE) = list(range(7)) |
| 34 | 34 | ||
| 35 | def __init__ (self): | 35 | def __init__ (self): |
| 36 | gtk.TreeStore.__init__ (self, | 36 | gtk.TreeStore.__init__ (self, |
| @@ -443,8 +443,8 @@ def do_pastebin(text): | |||
| 443 | url = 'http://pastebin.com/api_public.php' | 443 | url = 'http://pastebin.com/api_public.php' |
| 444 | params = {'paste_code': text, 'paste_format': 'text'} | 444 | params = {'paste_code': text, 'paste_format': 'text'} |
| 445 | 445 | ||
| 446 | req = urllib2.Request(url, urllib.urlencode(params)) | 446 | req = urllib.request.Request(url, urllib.parse.urlencode(params)) |
| 447 | response = urllib2.urlopen(req) | 447 | response = urllib.request.urlopen(req) |
| 448 | paste_url = response.read() | 448 | paste_url = response.read() |
| 449 | 449 | ||
| 450 | return paste_url | 450 | return paste_url |
| @@ -519,7 +519,7 @@ class RunningBuildTreeView (gtk.TreeView): | |||
| 519 | 519 | ||
| 520 | # @todo Provide visual feedback to the user that it is done and that | 520 | # @todo Provide visual feedback to the user that it is done and that |
| 521 | # it worked. | 521 | # it worked. |
| 522 | print paste_url | 522 | print(paste_url) |
| 523 | 523 | ||
| 524 | self._add_to_clipboard(paste_url) | 524 | self._add_to_clipboard(paste_url) |
| 525 | 525 | ||
diff --git a/bitbake/lib/bb/ui/goggle.py b/bitbake/lib/bb/ui/goggle.py index f4ee7b41ae..f5f8f1668f 100644 --- a/bitbake/lib/bb/ui/goggle.py +++ b/bitbake/lib/bb/ui/goggle.py | |||
| @@ -18,13 +18,18 @@ | |||
| 18 | # with this program; if not, write to the Free Software Foundation, Inc., | 18 | # with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | 20 | ||
| 21 | from gi import pygtkcompat | ||
| 22 | |||
| 23 | pygtkcompat.enable() | ||
| 24 | pygtkcompat.enable_gtk(version='3.0') | ||
| 25 | |||
| 21 | import gobject | 26 | import gobject |
| 22 | import gtk | 27 | import gtk |
| 23 | import xmlrpclib | 28 | import xmlrpc.client |
| 24 | from bb.ui.crumbs.runningbuild import RunningBuildTreeView, RunningBuild | 29 | from bb.ui.crumbs.runningbuild import RunningBuildTreeView, RunningBuild |
| 25 | from bb.ui.crumbs.progress import ProgressBar | 30 | from bb.ui.crumbs.progress import ProgressBar |
| 26 | 31 | ||
| 27 | import Queue | 32 | import queue |
| 28 | 33 | ||
| 29 | 34 | ||
| 30 | def event_handle_idle_func (eventHandler, build, pbar): | 35 | def event_handle_idle_func (eventHandler, build, pbar): |
| @@ -96,7 +101,7 @@ def main (server, eventHandler, params): | |||
| 96 | elif ret != True: | 101 | elif ret != True: |
| 97 | print("Error running command '%s': returned %s" % (cmdline, ret)) | 102 | print("Error running command '%s': returned %s" % (cmdline, ret)) |
| 98 | return 1 | 103 | return 1 |
| 99 | except xmlrpclib.Fault as x: | 104 | except xmlrpcclient.Fault as x: |
| 100 | print("XMLRPC Fault getting commandline:\n %s" % x) | 105 | print("XMLRPC Fault getting commandline:\n %s" % x) |
| 101 | return 1 | 106 | return 1 |
| 102 | 107 | ||
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 08c872e397..9605c8ee50 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
| @@ -22,7 +22,7 @@ from __future__ import division | |||
| 22 | 22 | ||
| 23 | import os | 23 | import os |
| 24 | import sys | 24 | import sys |
| 25 | import xmlrpclib | 25 | import xmlrpc.client as xmlrpclib |
| 26 | import logging | 26 | import logging |
| 27 | import progressbar | 27 | import progressbar |
| 28 | import signal | 28 | import signal |
| @@ -184,8 +184,8 @@ class TerminalFilter(object): | |||
| 184 | def clearFooter(self): | 184 | def clearFooter(self): |
| 185 | if self.footer_present: | 185 | if self.footer_present: |
| 186 | lines = self.footer_present | 186 | lines = self.footer_present |
| 187 | sys.stdout.write(self.curses.tparm(self.cuu, lines)) | 187 | sys.stdout.buffer.write(self.curses.tparm(self.cuu, lines)) |
| 188 | sys.stdout.write(self.curses.tparm(self.ed)) | 188 | sys.stdout.buffer.write(self.curses.tparm(self.ed)) |
| 189 | sys.stdout.flush() | 189 | sys.stdout.flush() |
| 190 | self.footer_present = False | 190 | self.footer_present = False |
| 191 | 191 | ||
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index 9589a77d75..d81e4138ba 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py | |||
| @@ -45,7 +45,7 @@ | |||
| 45 | """ | 45 | """ |
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | from __future__ import division | 48 | |
| 49 | import logging | 49 | import logging |
| 50 | import os, sys, itertools, time, subprocess | 50 | import os, sys, itertools, time, subprocess |
| 51 | 51 | ||
| @@ -55,7 +55,7 @@ except ImportError: | |||
| 55 | sys.exit("FATAL: The ncurses ui could not load the required curses python module.") | 55 | sys.exit("FATAL: The ncurses ui could not load the required curses python module.") |
| 56 | 56 | ||
| 57 | import bb | 57 | import bb |
| 58 | import xmlrpclib | 58 | import xmlrpc.client |
| 59 | from bb import ui | 59 | from bb import ui |
| 60 | from bb.ui import uihelper | 60 | from bb.ui import uihelper |
| 61 | 61 | ||
| @@ -252,7 +252,7 @@ class NCursesUI: | |||
| 252 | elif ret != True: | 252 | elif ret != True: |
| 253 | print("Couldn't get default commandlind! %s" % ret) | 253 | print("Couldn't get default commandlind! %s" % ret) |
| 254 | return | 254 | return |
| 255 | except xmlrpclib.Fault as x: | 255 | except xmlrpc.client.Fault as x: |
| 256 | print("XMLRPC Fault getting commandline:\n %s" % x) | 256 | print("XMLRPC Fault getting commandline:\n %s" % x) |
| 257 | return | 257 | return |
| 258 | 258 | ||
| @@ -331,7 +331,7 @@ class NCursesUI: | |||
| 331 | taw.setText(0, 0, "") | 331 | taw.setText(0, 0, "") |
| 332 | if activetasks: | 332 | if activetasks: |
| 333 | taw.appendText("Active Tasks:\n") | 333 | taw.appendText("Active Tasks:\n") |
| 334 | for task in activetasks.itervalues(): | 334 | for task in activetasks.values(): |
| 335 | taw.appendText(task["title"] + '\n') | 335 | taw.appendText(task["title"] + '\n') |
| 336 | if failedtasks: | 336 | if failedtasks: |
| 337 | taw.appendText("Failed Tasks:\n") | 337 | taw.appendText("Failed Tasks:\n") |
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py index df093c53c0..ca1916664d 100644 --- a/bitbake/lib/bb/ui/uievent.py +++ b/bitbake/lib/bb/ui/uievent.py | |||
| @@ -25,7 +25,7 @@ client/server deadlocks. | |||
| 25 | """ | 25 | """ |
| 26 | 26 | ||
| 27 | import socket, threading, pickle, collections | 27 | import socket, threading, pickle, collections |
| 28 | from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler | 28 | from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler |
| 29 | 29 | ||
| 30 | class BBUIEventQueue: | 30 | class BBUIEventQueue: |
| 31 | def __init__(self, BBServer, clientinfo=("localhost, 0")): | 31 | def __init__(self, BBServer, clientinfo=("localhost, 0")): |
| @@ -137,7 +137,7 @@ class UIXMLRPCServer (SimpleXMLRPCServer): | |||
| 137 | SimpleXMLRPCServer.__init__( self, | 137 | SimpleXMLRPCServer.__init__( self, |
| 138 | interface, | 138 | interface, |
| 139 | requestHandler=SimpleXMLRPCRequestHandler, | 139 | requestHandler=SimpleXMLRPCRequestHandler, |
| 140 | logRequests=False, allow_none=True) | 140 | logRequests=False, allow_none=True, use_builtin_types=True) |
| 141 | 141 | ||
| 142 | def get_request(self): | 142 | def get_request(self): |
| 143 | while not self.quit: | 143 | while not self.quit: |
