Skip to content

[3.12] gh-113565: Improve and harden detection of curses dependencies (#119816) #121222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Include/py_curses.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,21 @@
#define NCURSES_OPAQUE 0
#endif

#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#if defined(HAVE_NCURSESW_NCURSES_H)
# include <ncursesw/ncurses.h>
#elif defined(HAVE_NCURSESW_CURSES_H)
# include <ncursesw/curses.h>
#elif defined(HAVE_NCURSES_NCURSES_H)
# include <ncurses/ncurses.h>
#elif defined(HAVE_NCURSES_CURSES_H)
# include <ncurses/curses.h>
#elif defined(HAVE_NCURSES_H)
# include <ncurses.h>
#elif defined(HAVE_CURSES_H)
# include <curses.h>
#endif

#ifdef HAVE_NCURSES_H
#ifdef NCURSES_VERSION
/* configure was checking <curses.h>, but we will
use <ncurses.h>, which has some or all these features. */
#if !defined(WINDOW_HAS_FLAGS) && !(NCURSES_OPAQUE+0)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Improve :mod:`curses` and :mod:`curses.panel` dependency checks in
:program:`configure`.
8 changes: 7 additions & 1 deletion Modules/_curses_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ static const char PyCursesVersion[] = "2.1";

#include "py_curses.h"

#include <panel.h>
#if defined(HAVE_NCURSESW_PANEL_H)
# include <ncursesw/panel.h>
#elif defined(HAVE_NCURSES_PANEL_H)
# include <ncurses/panel.h>
#elif defined(HAVE_PANEL_H)
# include <panel.h>
#endif

typedef struct {
PyObject *PyCursesError;
Expand Down
2 changes: 1 addition & 1 deletion Modules/_cursesmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static const char PyCursesVersion[] = "2.2";
#include <langinfo.h>
#endif

#if !defined(HAVE_NCURSES_H) && (defined(sgi) || defined(__sun) || defined(SCO5))
#if !defined(NCURSES_VERSION) && (defined(sgi) || defined(__sun) || defined(SCO5))
#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
typedef chtype attr_t; /* No attr_t type is available */
#endif
Expand Down
Loading
Loading