Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65b46a2

Browse files
erlend-aaslandnoahbkim
authored andcommitted
pythongh-113565: Improve and harden detection of curses dependencies (python#119816)
1. Use pkg-config to check for ncursesw/panelw. If that fails, use pkg-config to check for ncurses/panel.2. Regardless of pkg-config output, search for curses/panel headers, so we're sure we have all defines in pyconfig.h.3. Regardless of pkg-config output, check if libncurses or libncursesw contains the 'initscr' symbol; if it does _and_ pkg-config failed earlier, add the resulting -llib linker option to CURSES_LIBS. Ditto for 'update_panels' and PANEL_LIBS.4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're using updated LIBS and CPPFLAGS for those.Add the PY_CHECK_CURSES convenience macro.
1 parent11ede61 commit65b46a2

File tree

7 files changed

+580
-746
lines changed

7 files changed

+580
-746
lines changed

‎Include/py_curses.h‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,21 @@
3636
#defineNCURSES_OPAQUE 0
3737
#endif
3838

39-
#ifdefHAVE_NCURSES_H
40-
#include<ncurses.h>
41-
#else
42-
#include<curses.h>
39+
#if defined(HAVE_NCURSESW_NCURSES_H)
40+
# include<ncursesw/ncurses.h>
41+
#elif defined(HAVE_NCURSESW_CURSES_H)
42+
# include<ncursesw/curses.h>
43+
#elif defined(HAVE_NCURSES_NCURSES_H)
44+
# include<ncurses/ncurses.h>
45+
#elif defined(HAVE_NCURSES_CURSES_H)
46+
# include<ncurses/curses.h>
47+
#elif defined(HAVE_NCURSES_H)
48+
# include<ncurses.h>
49+
#elif defined(HAVE_CURSES_H)
50+
# include<curses.h>
4351
#endif
4452

45-
#ifdefHAVE_NCURSES_H
53+
#ifdefNCURSES_VERSION
4654
/* configure was checking <curses.h>, but we will
4755
use <ncurses.h>, which has some or all these features. */
4856
#if !defined(WINDOW_HAS_FLAGS)&& \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Improve:mod:`curses` and:mod:`curses.panel` dependency checks in
2+
:program:`configure`.

‎Modules/_curses_panel.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ static const char PyCursesVersion[] = "2.1";
1919

2020
#include"py_curses.h"
2121

22-
#include<panel.h>
22+
#if defined(HAVE_NCURSESW_PANEL_H)
23+
# include<ncursesw/panel.h>
24+
#elif defined(HAVE_NCURSES_PANEL_H)
25+
# include<ncurses/panel.h>
26+
#elif defined(HAVE_PANEL_H)
27+
# include<panel.h>
28+
#endif
2329

2430
typedefstruct {
2531
PyObject*PyCursesError;

‎Modules/_cursesmodule.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static const char PyCursesVersion[] = "2.2";
128128
#include<langinfo.h>
129129
#endif
130130

131-
#if !defined(HAVE_NCURSES_H)&& (defined(sgi)|| defined(__sun)|| defined(SCO5))
131+
#if !defined(NCURSES_VERSION)&& (defined(sgi)|| defined(__sun)|| defined(SCO5))
132132
#defineSTRICT_SYSV_CURSES/* Don't use ncurses extensions */
133133
typedefchtypeattr_t;/* No attr_t type is available */
134134
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp