Skip to content

gh-113565: Improve and harden detection of curses dependencies #119816

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

Merged
merged 21 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
71a243d
gh-113565: Use pkg-config to detect ncurses[w] and panel[w]
erlend-aasland May 31, 2024
a036e9f
Pull in main
erlend-aasland May 31, 2024
a57e18d
Clean up pkg-config variables, fix manual check
erlend-aasland Jun 1, 2024
2965d4c
Pull in main
erlend-aasland Jun 1, 2024
de58647
Correctly choose includes in configure.ac and py_curses.h; use NCURSE…
erlend-aasland Jun 1, 2024
f874d3f
Add NEWS
erlend-aasland Jun 2, 2024
4eb1580
Simplify pkg-config checks and make sure we always do our header and …
erlend-aasland Jun 2, 2024
fb275e2
Disable curses/panel if not found; don't mark them as missing
erlend-aasland Jun 2, 2024
18b68c5
Enable panel only if curses is also found; harden term.h check, and c…
erlend-aasland Jun 2, 2024
6031b83
Pull in main
erlend-aasland Jun 2, 2024
bedd4b0
Use WITH_SAVE_ENV for all curses feature checks
erlend-aasland Jun 2, 2024
4990e46
Pull in main
erlend-aasland Jun 3, 2024
e61f55d
Fix pkg-config failure clause
erlend-aasland Jun 3, 2024
289058c
Mark curses/panel as missing iso. disabled if deps are not found
erlend-aasland Jun 3, 2024
739af74
Don't mess up compiler and linker flags; WITH_SAVE_ENV does not nest
erlend-aasland Jun 3, 2024
7edb576
AC_SEARCH_LIBS implicitly updates LIBS; no need for us to duplicate t…
erlend-aasland Jun 3, 2024
68336b7
Prioritise the *w libs in all checks and guards
erlend-aasland Jun 3, 2024
b5b8582
Pull in main
erlend-aasland Jun 3, 2024
311da9a
Guard panel includes
erlend-aasland Jun 3, 2024
26d2d0f
Pull in main
erlend-aasland Jun 3, 2024
487e0fd
Pull in main
erlend-aasland Jul 1, 2024
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 @@ -36,13 +36,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) && \
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 @@ -19,7 +19,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 @@ -128,7 +128,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