jhbuild r2588 - in trunk: . jhbuild jhbuild/frontends



Author: fpeters
Date: Thu Dec 18 21:06:19 2008
New Revision: 2588
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2588&view=rev

Log:
* jhbuild/config.py, jhbuild/frontends/terminal.py: do not fail on
missing standard python curses module (required only for quiet mode).
(closes: #564879)



Modified:
   trunk/ChangeLog
   trunk/jhbuild/config.py
   trunk/jhbuild/frontends/terminal.py

Modified: trunk/jhbuild/config.py
==============================================================================
--- trunk/jhbuild/config.py	(original)
+++ trunk/jhbuild/config.py	Thu Dec 18 21:06:19 2008
@@ -281,3 +281,14 @@
                     valarr.remove(x)
             os.environ['LD_PRELOAD'] = ' '.join(valarr)
 
+    def __setattr__(self, k, v):
+        '''Override __setattr__ for additional checks on some options.'''
+        if k == 'quiet_mode' and v:
+            try:
+                import curses
+            except ImportError:
+                print >> sys.stderr, uencode(
+                        _('W: quiet mode has been disabled because the Python curses module is missing.'))
+                v = False
+
+        self.__dict__[k] = v

Modified: trunk/jhbuild/frontends/terminal.py
==============================================================================
--- trunk/jhbuild/frontends/terminal.py	(original)
+++ trunk/jhbuild/frontends/terminal.py	Thu Dec 18 21:06:19 2008
@@ -48,11 +48,15 @@
 
 user_shell = os.environ.get('SHELL', '/bin/sh')
 
-import curses
 try:
-    curses.setupterm()
-except:
-    pass
+    import curses
+except ImportError:
+    curses = None
+else:
+    try:
+        curses.setupterm()
+    except:
+        pass
 
 # tray icon stuff ...
 icondir = os.path.join(os.path.dirname(__file__), 'icons')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]