summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Khouya <dakhouya@gmail.com>2020-07-01 12:27:40 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-07-19 16:22:12 +0100
commit38a756daa939a1dc2546565a690eec7ad7d2060d (patch)
tree454adeaa5225a2ac1c8c05fec5d73cbf99df496e
parent5a63668dbbc410489ac6a88cb79e1a265cde77ac (diff)
downloadpoky-38a756daa939a1dc2546565a690eec7ad7d2060d.tar.gz
poky-38a756daa939a1dc2546565a690eec7ad7d2060d.tar.bz2
poky-38a756daa939a1dc2546565a690eec7ad7d2060d.zip
bitbake: lib/ui/taskexp: Validate gi import
When running bitbake -g -u taskexp without having gi python module or and invalid gtk version, bitbake fails with a stack trace. In case of import or version error, bitbake should exit with an error message instead of a stack trace. (Bitbake rev: 45e32f2651d35bf7a315af95cfe0b1070e038c9e) Signed-off-by: David Khouya <dakhouya@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 2a2c507f239b047f34765312df4168030e38b90d) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/ui/taskexp.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/bitbake/lib/bb/ui/taskexp.py b/bitbake/lib/bb/ui/taskexp.py
index 8fff244235..336d197deb 100644
--- a/bitbake/lib/bb/ui/taskexp.py
+++ b/bitbake/lib/bb/ui/taskexp.py
@@ -8,9 +8,15 @@
#
import sys
-import gi
-gi.require_version('Gtk', '3.0')
-from gi.repository import Gtk, Gdk, GObject
+
+try:
+ import gi
+ gi.require_version('Gtk', '3.0')
+except ValueError:
+ sys.exit("FATAL: Gtk version needs to be 3.0")
+except ImportError:
+ sys.exit("FATAL: Gtk ui could not load the required gi python module")
+
import threading
from xmlrpc import client
import bb