summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2000-08-09 21:11:07 (GMT)
committerEric S. Raymond <esr@thyrsus.com>2000-08-09 21:11:07 (GMT)
commit1ebd3f6c4bf8c20750064b06a82e8727ce50e72b (patch)
tree23e40c7a513d693a6f8be040cf299973ed63c6cc
parent46a415167464d8a7234c4a79dc4f7df084211825 (diff)
downloadcpython-1ebd3f6c4bf8c20750064b06a82e8727ce50e72b.zip
cpython-1ebd3f6c4bf8c20750064b06a82e8727ce50e72b.tar.gz
cpython-1ebd3f6c4bf8c20750064b06a82e8727ce50e72b.tar.bz2
Tweak curses.wrapper so it initializes colors if they are available.
-rw-r--r--Doc/lib/libcurses.tex9
-rw-r--r--Lib/curses/wrapper.py9
-rw-r--r--configure.in6
3 files changed, 20 insertions, 4 deletions
diff --git a/Doc/lib/libcurses.tex b/Doc/lib/libcurses.tex
index be8df0c..192a8ca 100644
--- a/Doc/lib/libcurses.tex
+++ b/Doc/lib/libcurses.tex
@@ -1300,8 +1300,9 @@ as its first argument, followed by any other arguments passed to
\function{wrapper()}.
\end{funcdesc}
-Before calling the hook function, \function{wrapper()} turns on
-cbreak mode, turns off echo, and enables the terminal keypad. On
-exit (whether normally or by exception) it restores cooked mode,
-turns on echo, and disables the terminal keypad.
+Before calling the hook function, \function{wrapper()} turns on cbreak
+mode, turns off echo, enables the terminal keypad, and initializes
+colors if the terminal has color support. On exit (whether normally
+or by exception) it restores cooked mode, turns on echo, and disables
+the terminal keypad.
diff --git a/Lib/curses/wrapper.py b/Lib/curses/wrapper.py
index e7e7bb6..51fb724 100644
--- a/Lib/curses/wrapper.py
+++ b/Lib/curses/wrapper.py
@@ -32,6 +32,15 @@ def wrapper(func, *rest):
# a special value like curses.KEY_LEFT will be returned
stdscr.keypad(1)
+ # Start color, too. Harmless if the terminal doesn't have
+ # color; user can test with has_color() later on. The try/catch
+ # works around a minor bit of over-conscientiousness in the curses
+ # module -- the error return from C start_color() is ignorable.
+ try:
+ curses.start_color()
+ except:
+ pass
+
res = apply(func, (stdscr,) + rest)
except:
# In the event of an error, restore the terminal
diff --git a/configure.in b/configure.in
index 0367bd1..1566643 100644
--- a/configure.in
+++ b/configure.in
@@ -1014,6 +1014,12 @@ AC_SUBST(HAVE_GETHOSTBYNAME)
# checks for system services
# (none yet)
+# Cope with the DB mess. If we detect libdba, assume it's a version 2
+# or later DB and should be linked first (before the DB 1.xx stuff in glibc).
+# Also define an appropriate symbol so we can conditionalize code in the
+# dbmmodule; the API has changed since 1.xx.
+AC_CHECK_LIB(dba, __db_mutex_lock)
+
# Linux requires this for correct f.p. operations
AC_CHECK_FUNC(__fpu_control,
[],