All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ui: Improve error message if bitbake cannot import python curses module
@ 2012-08-21 21:05 Mark Hatle
  2012-08-22 12:56 ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Hatle @ 2012-08-21 21:05 UTC (permalink / raw)
  To: bitbake-devel

From: Konrad Scherer <Konrad.Scherer@windriver.com>

On some SuSE systems, the curses python module is not installed by default.
Instead of a python failure, we want a nicer error message.

(On SuSE systems the package is typically python-curses.)

Signed-off-by: Konrad Scherer <Konrad.Scherer@windriver.com>
Signed-off-by: Jeff Polk <jeff.polk@windriver.com>

Reword commit message, rebase to latest bitbake.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 lib/bb/ui/knotty.py  |    6 +++++-
 lib/bb/ui/ncurses.py |    8 +++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index b01daee..858cacf 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -141,7 +141,11 @@ class TerminalFilter(object):
         if not self.interactive:
             return
 
-        import curses
+        try:
+            import curses
+        except ImportError:
+            sys.exit("FATAL: The knotty ui could not load the required curses python module.")
+	
         import termios
         self.curses = curses
         self.termios = termios
diff --git a/lib/bb/ui/ncurses.py b/lib/bb/ui/ncurses.py
index 1425bbd..f573b95 100644
--- a/lib/bb/ui/ncurses.py
+++ b/lib/bb/ui/ncurses.py
@@ -47,7 +47,13 @@
 
 from __future__ import division
 import logging
-import os, sys, curses, itertools, time, subprocess
+import os, sys, itertools, time, subprocess
+
+try:
+    import curses
+except ImportError:
+    sys.exit("FATAL: The ncurses ui could not load the required curses python module.")
+
 import bb
 import xmlrpclib
 from bb import ui
-- 
1.7.3.4




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ui: Improve error message if bitbake cannot import python curses module
  2012-08-21 21:05 [PATCH] ui: Improve error message if bitbake cannot import python curses module Mark Hatle
@ 2012-08-22 12:56 ` Richard Purdie
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2012-08-22 12:56 UTC (permalink / raw)
  To: Mark Hatle; +Cc: bitbake-devel

On Tue, 2012-08-21 at 16:05 -0500, Mark Hatle wrote:
> From: Konrad Scherer <Konrad.Scherer@windriver.com>
> 
> On some SuSE systems, the curses python module is not installed by default.
> Instead of a python failure, we want a nicer error message.
> 
> (On SuSE systems the package is typically python-curses.)
> 
> Signed-off-by: Konrad Scherer <Konrad.Scherer@windriver.com>
> Signed-off-by: Jeff Polk <jeff.polk@windriver.com>
> 
> Reword commit message, rebase to latest bitbake.
> 
> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> ---
>  lib/bb/ui/knotty.py  |    6 +++++-
>  lib/bb/ui/ncurses.py |    8 +++++++-
>  2 files changed, 12 insertions(+), 2 deletions(-)

Thanks, merged to master.

I did wonder if this shouldn't just print a warning and proceed as if
the terminal were non-interactive though. Regardless, this improves the
situation.

Cheers,

Richard




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] ui: Improve error message if bitbake cannot import python curses module
@ 2012-08-21 19:17 Mark Hatle
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Hatle @ 2012-08-21 19:17 UTC (permalink / raw)
  To: bitbake-devel

From: Konrad Scherer <Konrad.Scherer@windriver.com>

On some SuSE systems, the curses python module is not installed by default.
Instead of a python failure, we want a nicer error message.

(On SuSE systems the package is typically python-curses.)

Signed-off-by: Konrad Scherer <Konrad.Scherer@windriver.com>
Signed-off-by: Jeff Polk <jeff.polk@windriver.com>

Reword commit message, rebase to latest bitbake.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 lib/bb/ui/knotty.py  |    6 +++++-
 lib/bb/ui/ncurses.py |    8 +++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index b01daee..858cacf 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -141,7 +141,11 @@ class TerminalFilter(object):
         if not self.interactive:
             return
 
-        import curses
+        try:
+            import curses
+        except ImportError:
+            sys.exit("FATAL: The knotty ui could not load the required curses python module.")
+	
         import termios
         self.curses = curses
         self.termios = termios
diff --git a/lib/bb/ui/ncurses.py b/lib/bb/ui/ncurses.py
index 1425bbd..f573b95 100644
--- a/lib/bb/ui/ncurses.py
+++ b/lib/bb/ui/ncurses.py
@@ -47,7 +47,13 @@
 
 from __future__ import division
 import logging
-import os, sys, curses, itertools, time, subprocess
+import os, sys, itertools, time, subprocess
+
+try:
+    import curses
+except ImportError:
+    sys.exit("FATAL: The ncurses ui could not load the required curses python module.")
+
 import bb
 import xmlrpclib
 from bb import ui
-- 
1.7.3.4




^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-22 13:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-21 21:05 [PATCH] ui: Improve error message if bitbake cannot import python curses module Mark Hatle
2012-08-22 12:56 ` Richard Purdie
  -- strict thread matches above, loose matches on Subject: below --
2012-08-21 19:17 Mark Hatle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.