Fix build error in _curses module when not using libncursesw.
Code extracted from Victor Stinner's patch for issue #12567.
This commit is contained in:
parent
4fbff6c631
commit
9e2e99097c
|
@ -906,6 +906,7 @@ PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_NCURSESW
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
|
PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -937,6 +938,7 @@ PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
return PyLong_FromLong(rtn);
|
return PyLong_FromLong(rtn);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args)
|
PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args)
|
||||||
|
@ -1636,7 +1638,9 @@ static PyMethodDef PyCursesWindow_Methods[] = {
|
||||||
{"getbkgd", (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS},
|
{"getbkgd", (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS},
|
||||||
{"getch", (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS},
|
{"getch", (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS},
|
||||||
{"getkey", (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS},
|
{"getkey", (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS},
|
||||||
|
#ifdef HAVE_NCURSESW
|
||||||
{"get_wch", (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},
|
{"get_wch", (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},
|
||||||
|
#endif
|
||||||
{"getmaxyx", (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS},
|
{"getmaxyx", (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS},
|
||||||
{"getparyx", (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS},
|
{"getparyx", (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS},
|
||||||
{"getstr", (PyCFunction)PyCursesWindow_GetStr, METH_VARARGS},
|
{"getstr", (PyCFunction)PyCursesWindow_GetStr, METH_VARARGS},
|
||||||
|
|
6
setup.py
6
setup.py
|
@ -1161,6 +1161,10 @@ class PyBuildExt(build_ext):
|
||||||
else:
|
else:
|
||||||
missing.extend(['nis', 'resource', 'termios'])
|
missing.extend(['nis', 'resource', 'termios'])
|
||||||
|
|
||||||
|
curses_defines = []
|
||||||
|
if curses_library == 'ncursesw':
|
||||||
|
curses_defines.append(('HAVE_NCURSESW', '1'))
|
||||||
|
|
||||||
# Curses support, requiring the System V version of curses, often
|
# Curses support, requiring the System V version of curses, often
|
||||||
# provided by the ncurses library.
|
# provided by the ncurses library.
|
||||||
panel_library = 'panel'
|
panel_library = 'panel'
|
||||||
|
@ -1171,6 +1175,7 @@ class PyBuildExt(build_ext):
|
||||||
panel_library = 'panelw'
|
panel_library = 'panelw'
|
||||||
curses_libs = [curses_library]
|
curses_libs = [curses_library]
|
||||||
exts.append( Extension('_curses', ['_cursesmodule.c'],
|
exts.append( Extension('_curses', ['_cursesmodule.c'],
|
||||||
|
define_macros=curses_defines,
|
||||||
libraries = curses_libs) )
|
libraries = curses_libs) )
|
||||||
elif curses_library == 'curses' and platform != 'darwin':
|
elif curses_library == 'curses' and platform != 'darwin':
|
||||||
# OSX has an old Berkeley curses, not good enough for
|
# OSX has an old Berkeley curses, not good enough for
|
||||||
|
@ -1183,6 +1188,7 @@ class PyBuildExt(build_ext):
|
||||||
curses_libs = ['curses']
|
curses_libs = ['curses']
|
||||||
|
|
||||||
exts.append( Extension('_curses', ['_cursesmodule.c'],
|
exts.append( Extension('_curses', ['_cursesmodule.c'],
|
||||||
|
define_macros=curses_defines,
|
||||||
libraries = curses_libs) )
|
libraries = curses_libs) )
|
||||||
else:
|
else:
|
||||||
missing.append('_curses')
|
missing.append('_curses')
|
||||||
|
|
Loading…
Reference in New Issue