Patchwork [bitbake-devel,1/1] lib/bb/ui/hob: exit cleanly if the required pygtk version isn't available

login
register
mail settings
Submitter Joshua Lock
Date March 31, 2012, 1:05 a.m.
Message ID <72c1e44f0bc8b40583d16ff8b396faf8cf62fed9.1333155656.git.josh@linux.intel.com>
Download mbox | patch
Permalink /patch/24967/
State New
Headers show

Comments

Joshua Lock - March 31, 2012, 1:05 a.m.
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>
---
 lib/bb/ui/hob.py |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
Paul Eggleton - April 5, 2012, 4:32 p.m.
On Friday 30 March 2012 18:05:29 Joshua Lock wrote:
> Hob uses API from pygtk 2.22, therefore check to see whether this
> version is available and exit cleanly if not.

Apparently Belen and Giulia have been doing their hob testing on an F15 
machine (fully up-to-date) and it was working OK, now it is blocked by this 
check - the version of PyGTK+ on there is 2.17.

Is that intended/desirable?

Cheers,
Paul
Joshua Lock - April 5, 2012, 4:44 p.m.
On 05/04/12 09:32, Paul Eggleton wrote:
> On Friday 30 March 2012 18:05:29 Joshua Lock wrote:
>> Hob uses API from pygtk 2.22, therefore check to see whether this
>> version is available and exit cleanly if not.
>
> Apparently Belen and Giulia have been doing their hob testing on an F15
> machine (fully up-to-date) and it was working OK, now it is blocked by this
> check - the version of PyGTK+ on there is 2.17.
>
> Is that intended/desirable?

Not at all, we're definitely using method calls which the API docs tell 
me are only available in pygtk 2.22 or newer... I guess this isn't the case.

It's beginning to look like the API is from Gtk+ 2.22 but that pygtk 
fell out of sync for version numbers, I'll change the check to test the 
Gtk+ version.

FYI the goal is to lower the required API to Gtk+ 2.18.x and pygtk 
2.16.x as are shipped with CentOS 6.

Cheers,
Joshua

Patch

diff --git a/lib/bb/ui/hob.py b/lib/bb/ui/hob.py
index e72ab23..2f595cb 100755
--- a/lib/bb/ui/hob.py
+++ b/lib/bb/ui/hob.py
@@ -20,10 +20,17 @@ 
 # 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
+try:
+    import gobject
+    import gtk
+    import pygtk
+    pygtk.require('2.0') # to be certain we don't have gtk+ 1.x !?!
+    if gtk.pygtk_version < (2, 22, 0):
+        sys.exit("FATAL: PyGtk version 2.22.x or later is required to use Hob")
+except:
+    sys.exit("FATAL: PyGtk (version 2.22.x or later) is required to use Hob")
 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
 try:
     import bb