summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-11-01 13:11:12 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-11-01 13:11:12 (GMT)
commit2be9a31213e93e26a71150efaef1a975f8b9afec (patch)
tree5485514a2d8c01bc5fd904c59434905c5a2eff30
parent89b84b026b389f3c61cbbc5ee89afd8248721b0d (diff)
downloadcpython-2be9a31213e93e26a71150efaef1a975f8b9afec.zip
cpython-2be9a31213e93e26a71150efaef1a975f8b9afec.tar.gz
cpython-2be9a31213e93e26a71150efaef1a975f8b9afec.tar.bz2
bpo-31919: Fix building the curses module on OpenIndiana. (GH-4211) (#4215)
(cherry picked from commit 894ebd065e02debf20c0657d26020ecc42b7534f)
-rw-r--r--Lib/test/test_curses.py22
-rw-r--r--Modules/_cursesmodule.c6
-rwxr-xr-xconfigure30
-rw-r--r--configure.ac11
-rw-r--r--pyconfig.h.in3
5 files changed, 61 insertions, 11 deletions
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index 785a31c..514ed83 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -143,6 +143,7 @@ class TestCurses(unittest.TestCase):
stdscr.idlok(1)
if hasattr(stdscr, 'immedok'):
stdscr.immedok(1)
+ stdscr.immedok(0)
stdscr.insch('c')
stdscr.insdelln(1)
stdscr.insnstr('abc', 3)
@@ -176,26 +177,27 @@ class TestCurses(unittest.TestCase):
stdscr.setscrreg(10,15)
win3 = stdscr.subwin(10,10)
win3 = stdscr.subwin(10,10, 5,5)
- if hasattr(stdscr, 'syncok'):
+ if hasattr(stdscr, 'syncok') and not sys.platform.startswith("sunos"):
stdscr.syncok(1)
stdscr.timeout(5)
stdscr.touchline(5,5)
stdscr.touchline(5,5,0)
stdscr.vline('a', 3)
stdscr.vline('a', 3, curses.A_STANDOUT)
- stdscr.chgat(5, 2, 3, curses.A_BLINK)
- stdscr.chgat(3, curses.A_BOLD)
- stdscr.chgat(5, 8, curses.A_UNDERLINE)
- stdscr.chgat(curses.A_BLINK)
+ if hasattr(stdscr, 'chgat'):
+ stdscr.chgat(5, 2, 3, curses.A_BLINK)
+ stdscr.chgat(3, curses.A_BOLD)
+ stdscr.chgat(5, 8, curses.A_UNDERLINE)
+ stdscr.chgat(curses.A_BLINK)
stdscr.refresh()
stdscr.vline(1,1, 'a', 3)
stdscr.vline(1,1, 'a', 3, curses.A_STANDOUT)
- if hasattr(curses, 'resize'):
- stdscr.resize()
- if hasattr(curses, 'enclose'):
- stdscr.enclose()
+ if hasattr(stdscr, 'resize'):
+ stdscr.resize(25, 80)
+ if hasattr(stdscr, 'enclose'):
+ stdscr.enclose(10, 10)
self.assertRaises(ValueError, stdscr.getstr, -400)
self.assertRaises(ValueError, stdscr.getstr, 2, 3, -400)
@@ -423,6 +425,8 @@ class TestCurses(unittest.TestCase):
def test_issue13051(self):
stdscr = self.stdscr
+ if not hasattr(stdscr, 'resize'):
+ raise unittest.SkipTest('requires curses.window.resize')
box = curses.textpad.Textbox(stdscr, insert_mode=True)
lines, cols = stdscr.getmaxyx()
stdscr.resize(lines-2, cols-2)
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 94c67c1..4a1d08a 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -943,7 +943,7 @@ int py_mvwdelch(WINDOW *w, int y, int x)
#endif
/* chgat, added by Fabian Kreutz <fabian.kreutz at gmx.net> */
-
+#ifdef HAVE_CURSES_WCHGAT
static PyObject *
PyCursesWindow_ChgAt(PyCursesWindowObject *self, PyObject *args)
{
@@ -996,7 +996,7 @@ PyCursesWindow_ChgAt(PyCursesWindowObject *self, PyObject *args)
}
return PyCursesCheckERR(rtn, "chgat");
}
-
+#endif
static PyObject *
PyCursesWindow_DelCh(PyCursesWindowObject *self, PyObject *args)
@@ -2001,7 +2001,9 @@ static PyMethodDef PyCursesWindow_Methods[] = {
{"attron", (PyCFunction)PyCursesWindow_AttrOn, METH_VARARGS},
{"attrset", (PyCFunction)PyCursesWindow_AttrSet, METH_VARARGS},
{"bkgd", (PyCFunction)PyCursesWindow_Bkgd, METH_VARARGS},
+#ifdef HAVE_CURSES_WCHGAT
{"chgat", (PyCFunction)PyCursesWindow_ChgAt, METH_VARARGS},
+#endif
{"bkgdset", (PyCFunction)PyCursesWindow_BkgdSet, METH_VARARGS},
{"border", (PyCFunction)PyCursesWindow_Border, METH_VARARGS},
{"box", (PyCFunction)PyCursesWindow_Box, METH_VARARGS},
diff --git a/configure b/configure
index 7ca386f..24d86f5 100755
--- a/configure
+++ b/configure
@@ -16110,6 +16110,36 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wchgat" >&5
+$as_echo_n "checking for wchgat... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <curses.h>
+int
+main ()
+{
+
+#ifndef wchgat
+void *x=wchgat
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+$as_echo "#define HAVE_CURSES_WCHGAT 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for filter" >&5
$as_echo_n "checking for filter... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
diff --git a/configure.ac b/configure.ac
index 33cb78d..9a784e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5071,6 +5071,17 @@ void *x=syncok
[AC_MSG_RESULT(no)]
)
+AC_MSG_CHECKING(for wchgat)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
+#ifndef wchgat
+void *x=wchgat
+#endif
+]])],
+ [AC_DEFINE(HAVE_CURSES_WCHGAT, 1, Define if you have the 'wchgat' function.)
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)]
+)
+
AC_MSG_CHECKING(for filter)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
#ifndef filter
diff --git a/pyconfig.h.in b/pyconfig.h.in
index bf1efd8..bc2693b 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -179,6 +179,9 @@
/* Define if you have the 'use_env' function. */
#undef HAVE_CURSES_USE_ENV
+/* Define if you have the 'wchgat' function. */
+#undef HAVE_CURSES_WCHGAT
+
/* Define to 1 if you have the declaration of `isfinite', and to 0 if you
don't. */
#undef HAVE_DECL_ISFINITE