Skip to contentSkip to conversation

Warn users if they don't have the required modules for Hob v2

PATCH Applied Joshua Lock 2 participants 3 messages Apr 4, 2012 – Apr 5, 2012

lore
Share & tools
lore
#0 lore raw

cover Warn users if they don't have the required modules for Hob v2

A second version of this change, to notify the user as to the missing requirements rather than issuing a backtrace if they don't have the right versions, or required modules, to run hob.

Cheers,
Joshua

The following changes since commit 035e146ff92236a3eda71ad71e8389737f91753b:

Hob: In building log page, fixed the issue about 'endpath' not clear when next to start build (2012-03-30 17:19:35 +0100)

are available in the git repository at:
git://github.com/incandescant/bitbake josh/hob
https://github.com/incandescant/bitbake/tree/josh/hob

Joshua Lock (1):
lib/bb/ui/hob: exit cleanly if the required pygtk version isn't
available

 lib/bb/ui/hob.py |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 1/1 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.

---
 lib/bb/ui/hob.py |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
lib/bb/ui/hob.py +11 -2
index e72ab23..1321ebb 100755
@@ -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
Signature · 1 line
1.7.7.6
#2 lore raw

Re: [PATCH 1/1] lib/bb/ui/hob: exit cleanly if the required pygtk version isn't available

Quoted 7 lines · Joshua Lock

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

---
 lib/bb/ui/hob.py |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

Merged to master, thanks.

Richard