Skip to contentSkip to conversation

Error gracefully on systems which don't support Hob

PATCH In review Joshua Lock 2 participants 5 messages Mar 31, 2012 – Apr 5, 2012

lore
Share & tools
lore
#0 lore raw

cover Error gracefully on systems which don't support Hob

Hob requires pygtk 2.22 or later and systems without that will see a Python backtrace.
This small change tests whether pygtk is installed and tests which version of it is available and prints an error if pytgtk is missing or too low a version.

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 |   11 +++++++++--
 1 files changed, 9 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 |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
lib/bb/ui/hob.py +9 -2
index e72ab23..2f595cb 100755
@@ -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
Signature · 1 line
1.7.7.6
#4 lore raw
In reply to Joshua Lock

I have a more informative version of this patch which I'll submit shortly.

Quoted 23 lines · Joshua Lock

Hob requires pygtk 2.22 or later and systems without that will see a Python backtrace.
This small change tests whether pygtk is installed and tests which version of it is available and prints an error if pytgtk is missing or too low a version.

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 |   11 +++++++++--
  1 files changed, 9 insertions(+), 2 deletions(-)
Signature · 3 lines
Joshua '贾詡' Lock
        Yocto Project "Johannes factotum"
        Intel Open Source Technology Centre
#2 lore raw

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

In reply to Joshua Lock
Quoted 2 lines · 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

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#3 lore raw

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

Quoted 9 lines · Paul Eggleton
Quoted 2 lines · 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

Signature · 3 lines
Joshua '贾詡' Lock
        Yocto Project "Johannes factotum"
        Intel Open Source Technology Centre