diff options
author | Joshua Lock <josh@linux.intel.com> | 2012-04-03 17:35:41 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-04-05 14:01:04 +0100 |
commit | 192d5fdf9ea27cdc8b043204857ae5b21173a011 (patch) | |
tree | 5f358e1c83e8ce338ad6c08ba18086bfaf8170b1 /lib/bb/ui/hob.py | |
parent | 5fed953105fd58f09e42dce233aab2c6eced7c37 (diff) | |
download | bitbake-192d5fdf9ea27cdc8b043204857ae5b21173a011.tar.gz |
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.
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/ui/hob.py')
-rwxr-xr-x | lib/bb/ui/hob.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/bb/ui/hob.py b/lib/bb/ui/hob.py index e72ab23e3..1321ebbac 100755 --- a/lib/bb/ui/hob.py +++ b/lib/bb/ui/hob.py @@ -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 |