lib/bb/ui/hob: exit cleanly if the required pygtk version isn't available

Hob uses API from pygtk 2.22, therefore check to see whether this
version is available and exit cleanly if not.

(Bitbake rev: 192d5fdf9ea27cdc8b043204857ae5b21173a011)

Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Lock 2012-04-03 17:35:41 -07:00 committed by Richard Purdie
parent d2402f6c8e
commit a84e353282
1 changed files with 11 additions and 2 deletions

View File

@ -20,10 +20,19 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import gobject
import gtk
import sys
import os
requirements = "FATAL: pygtk (version 2.22.0 or later) and pygobject are required to use Hob"
try:
import gobject
import gtk
import pygtk
pygtk.require('2.0') # to be certain we don't have gtk+ 1.x !?!
ver = gtk.pygtk_version
if ver < (2, 22, 0):
sys.exit("%s (you have pygtk %s.%s.%s)." % (requirements, ver[0], ver[1], ver[2]))
except ImportError as exc:
sys.exit("%s (%s)." % (requirements, str(exc)))
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
try:
import bb