Merge pull request #301 from lrusak/python-curses

Python: build readline and curses modules
This commit is contained in:
MilhouseVH 2016-05-05 22:38:49 +01:00
commit 53eca15b39
2 changed files with 243 additions and 2 deletions

View File

@ -33,7 +33,7 @@ PKG_LONGDESC="Python is an interpreted object-oriented programming language, and
PKG_IS_ADDON="no"
PKG_AUTORECONF="yes"
PY_DISABLED_MODULES="readline _curses _curses_panel _tkinter nis gdbm bsddb ossaudiodev"
PY_DISABLED_MODULES="_tkinter nis gdbm bsddb ossaudiodev"
PKG_CONFIGURE_OPTS_HOST="--cache-file=config.cache \
--without-cxx-main \
@ -116,7 +116,7 @@ makeinstall_target() {
}
post_makeinstall_target() {
EXCLUDE_DIRS="bsddb curses idlelib lib-tk lib2to3 msilib pydoc_data test unittest"
EXCLUDE_DIRS="bsddb idlelib lib-tk lib2to3 msilib pydoc_data test unittest"
for dir in $EXCLUDE_DIRS; do
rm -rf $INSTALL/usr/lib/python*/$dir
done

View File

@ -0,0 +1,241 @@
diff -Naur a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
--- a/Modules/_cursesmodule.c 2015-12-05 11:47:13.000000000 -0800
+++ b/Modules/_cursesmodule.c 2016-04-29 01:22:41.271608696 -0700
@@ -312,7 +312,6 @@
Window_NoArgNoReturnVoidFunction(wclear)
Window_OneArgNoReturnVoidFunction(idcok, int, "i;True(1) or False(0)")
-Window_OneArgNoReturnVoidFunction(immedok, int, "i;True(1) or False(0)")
Window_OneArgNoReturnVoidFunction(wtimeout, int, "i;delay")
Window_NoArg2TupleReturnFunction(getyx, int, "ii")
@@ -336,7 +335,6 @@
Window_OneArgNoReturnFunction(notimeout, int, "i;True(1) or False(0)")
Window_OneArgNoReturnFunction(scrollok, int, "i;True(1) or False(0)")
Window_OneArgNoReturnFunction(winsdelln, int, "i;nlines")
-Window_OneArgNoReturnFunction(syncok, int, "i;True(1) or False(0)")
Window_TwoArgNoReturnFunction(mvwin, int, "ii;y,x")
Window_TwoArgNoReturnFunction(mvderwin, int, "ii;y,x")
@@ -1580,7 +1578,6 @@
{"hline", (PyCFunction)PyCursesWindow_Hline, METH_VARARGS},
{"idcok", (PyCFunction)PyCursesWindow_idcok, METH_VARARGS},
{"idlok", (PyCFunction)PyCursesWindow_idlok, METH_VARARGS},
- {"immedok", (PyCFunction)PyCursesWindow_immedok, METH_VARARGS},
{"inch", (PyCFunction)PyCursesWindow_InCh, METH_VARARGS},
{"insch", (PyCFunction)PyCursesWindow_InsCh, METH_VARARGS},
{"insdelln", (PyCFunction)PyCursesWindow_winsdelln, METH_VARARGS},
@@ -1618,7 +1615,6 @@
{"subpad", (PyCFunction)PyCursesWindow_SubWin, METH_VARARGS},
{"subwin", (PyCFunction)PyCursesWindow_SubWin, METH_VARARGS},
{"syncdown", (PyCFunction)PyCursesWindow_wsyncdown, METH_NOARGS},
- {"syncok", (PyCFunction)PyCursesWindow_syncok, METH_VARARGS},
{"syncup", (PyCFunction)PyCursesWindow_wsyncup, METH_NOARGS},
{"timeout", (PyCFunction)PyCursesWindow_wtimeout, METH_VARARGS},
{"touchline", (PyCFunction)PyCursesWindow_TouchLine, METH_VARARGS},
@@ -1693,16 +1689,6 @@
NoArgNoReturnVoidFunction(noqiflush)
static PyObject *
-PyCurses_filter(PyObject *self)
-{
- /* not checking for PyCursesInitialised here since filter() must
- be called before initscr() */
- filter();
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-static PyObject *
PyCurses_Color_Content(PyObject *self, PyObject *args)
{
short color,r,g,b;
@@ -1772,19 +1758,6 @@
return PyString_FromStringAndSize(&ch, 1);
}
-static PyObject *
-PyCurses_getsyx(PyObject *self)
-{
- int x = 0;
- int y = 0;
-
- PyCursesInitialised;
-
- getsyx(y, x);
-
- return Py_BuildValue("(ii)", y, x);
-}
-
#ifdef NCURSES_MOUSE_VERSION
static PyObject *
PyCurses_GetMouse(PyObject *self)
@@ -1855,25 +1828,6 @@
return PyCursesCheckERR(halfdelay(tenths), "halfdelay");
}
-#ifndef STRICT_SYSV_CURSES
-/* No has_key! */
-static PyObject * PyCurses_has_key(PyObject *self, PyObject *args)
-{
- int ch;
-
- PyCursesInitialised;
-
- if (!PyArg_ParseTuple(args,"i",&ch)) return NULL;
-
- if (has_key(ch) == FALSE) {
- Py_INCREF(Py_False);
- return Py_False;
- }
- Py_INCREF(Py_True);
- return Py_True;
-}
-#endif /* STRICT_SYSV_CURSES */
-
static PyObject *
PyCurses_Init_Color(PyObject *self, PyObject *args)
{
@@ -2426,26 +2380,6 @@
#endif /* HAVE_CURSES_RESIZE_TERM */
static PyObject *
-PyCurses_setsyx(PyObject *self, PyObject *args)
-{
- int y,x;
-
- PyCursesInitialised;
-
- if (PyTuple_Size(args)!=2) {
- PyErr_SetString(PyExc_TypeError, "setsyx requires 2 arguments");
- return NULL;
- }
-
- if (!PyArg_ParseTuple(args, "ii;y, x", &y, &x)) return NULL;
-
- setsyx(y,x);
-
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-static PyObject *
PyCurses_Start_Color(PyObject *self)
{
int code;
@@ -2539,18 +2473,6 @@
}
static PyObject *
-PyCurses_TypeAhead(PyObject *self, PyObject *args)
-{
- int fd;
-
- PyCursesInitialised;
-
- if (!PyArg_ParseTuple(args,"i;fd",&fd)) return NULL;
-
- return PyCursesCheckERR(typeahead( fd ), "typeahead");
-}
-
-static PyObject *
PyCurses_UnCtrl(PyObject *self, PyObject *args)
{
PyObject *temp;
@@ -2594,25 +2516,6 @@
return PyCursesCheckERR(ungetch(ch), "ungetch");
}
-static PyObject *
-PyCurses_Use_Env(PyObject *self, PyObject *args)
-{
- int flag;
-
- switch(PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&flag))
- return NULL;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "use_env requires 1 argument");
- return NULL;
- }
- use_env(flag);
- Py_INCREF(Py_None);
- return Py_None;
-}
-
#ifndef STRICT_SYSV_CURSES
static PyObject *
PyCurses_Use_Default_Colors(PyObject *self)
@@ -2650,21 +2553,16 @@
{"echo", (PyCFunction)PyCurses_echo, METH_VARARGS},
{"endwin", (PyCFunction)PyCurses_endwin, METH_NOARGS},
{"erasechar", (PyCFunction)PyCurses_EraseChar, METH_NOARGS},
- {"filter", (PyCFunction)PyCurses_filter, METH_NOARGS},
{"flash", (PyCFunction)PyCurses_flash, METH_NOARGS},
{"flushinp", (PyCFunction)PyCurses_flushinp, METH_NOARGS},
#ifdef NCURSES_MOUSE_VERSION
{"getmouse", (PyCFunction)PyCurses_GetMouse, METH_NOARGS},
{"ungetmouse", (PyCFunction)PyCurses_UngetMouse, METH_VARARGS},
#endif
- {"getsyx", (PyCFunction)PyCurses_getsyx, METH_NOARGS},
{"getwin", (PyCFunction)PyCurses_GetWin, METH_O},
{"has_colors", (PyCFunction)PyCurses_has_colors, METH_NOARGS},
{"has_ic", (PyCFunction)PyCurses_has_ic, METH_NOARGS},
{"has_il", (PyCFunction)PyCurses_has_il, METH_NOARGS},
-#ifndef STRICT_SYSV_CURSES
- {"has_key", (PyCFunction)PyCurses_has_key, METH_VARARGS},
-#endif
{"halfdelay", (PyCFunction)PyCurses_HalfDelay, METH_VARARGS},
{"init_color", (PyCFunction)PyCurses_Init_Color, METH_VARARGS},
{"init_pair", (PyCFunction)PyCurses_Init_Pair, METH_VARARGS},
@@ -2708,7 +2606,6 @@
{"resize_term", (PyCFunction)PyCurses_Resize_Term, METH_VARARGS},
#endif
{"savetty", (PyCFunction)PyCurses_savetty, METH_NOARGS},
- {"setsyx", (PyCFunction)PyCurses_setsyx, METH_VARARGS},
{"setupterm", (PyCFunction)PyCurses_setupterm,
METH_VARARGS|METH_KEYWORDS},
{"start_color", (PyCFunction)PyCurses_Start_Color, METH_NOARGS},
@@ -2718,10 +2615,8 @@
{"tigetnum", (PyCFunction)PyCurses_tigetnum, METH_VARARGS},
{"tigetstr", (PyCFunction)PyCurses_tigetstr, METH_VARARGS},
{"tparm", (PyCFunction)PyCurses_tparm, METH_VARARGS},
- {"typeahead", (PyCFunction)PyCurses_TypeAhead, METH_VARARGS},
{"unctrl", (PyCFunction)PyCurses_UnCtrl, METH_VARARGS},
{"ungetch", (PyCFunction)PyCurses_UngetCh, METH_VARARGS},
- {"use_env", (PyCFunction)PyCurses_Use_Env, METH_VARARGS},
#ifndef STRICT_SYSV_CURSES
{"use_default_colors", (PyCFunction)PyCurses_Use_Default_Colors, METH_NOARGS},
#endif
diff -Naur a/setup.py b/setup.py
--- a/setup.py 2016-04-28 13:18:03.397008583 -0700
+++ b/setup.py 2016-04-28 13:28:04.595779984 -0700
@@ -766,7 +766,7 @@
else:
readline_extra_link_args = ()
- readline_libs = ['readline']
+ readline_libs = ['readline', 'termcap']
if readline_termcap_library:
pass # Issue 7384: Already linked against curses or tinfo.
elif curses_library:
@@ -1359,7 +1359,7 @@
# Bug 1464056: If _curses.so links with ncursesw,
# _curses_panel.so must link with panelw.
panel_library = 'panelw'
- curses_libs = [curses_library]
+ curses_libs = [curses_library, 'termcap']
curses_incs = find_file('curses.h', inc_dirs,
[os.path.join(d, 'ncursesw') for d in inc_dirs])
exts.append( Extension('_curses', ['_cursesmodule.c'],
@@ -1373,7 +1373,7 @@
elif (self.compiler.find_library_file(lib_dirs, 'termcap')):
curses_libs = ['curses', 'termcap']
else:
- curses_libs = ['curses']
+ curses_libs = ['curses', 'termcap']
exts.append( Extension('_curses', ['_cursesmodule.c'],
libraries = curses_libs) )