Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6919223

Browse files
committed
Issue #14225: Fix Unicode support for curses (#12567) on OS X:
1. on OS X, there is no separate /usr/lib/libcursesw nor libpanelw 2. _XOPEN_SOURCE_EXTENDED must be enabled for _curses build
1 parent fd8a838 commit 6919223

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ Tests
165165
Build
166166
-----
167167

168+
- Issue #14225: Fix Unicode support for curses (#12567) on OS X
169+
168170
- Issue #14928: Fix importlib bootstrap issues by using a custom executable
169171
(Modules/_freeze_importlib) to build Python/importlib.h.
170172

setup.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,18 @@ class db_found(Exception): pass
11851185
# Bug 1464056: If _curses.so links with ncursesw,
11861186
# _curses_panel.so must link with panelw.
11871187
panel_library = 'panelw'
1188+
if platform == 'darwin':
1189+
# On OS X, there is no separate /usr/lib/libncursesw nor
1190+
# libpanelw. If we are here, we found a locally-supplied
1191+
# version of libncursesw. There should be also be a
1192+
# libpanelw. _XOPEN_SOURCE defines are usually excluded
1193+
# for OS X but we need _XOPEN_SOURCE_EXTENDED here for
1194+
# ncurses wide char support
1195+
curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1'))
1196+
elif platform == 'darwin' and curses_library == 'ncurses':
1197+
# Building with the system-suppied combined libncurses/libpanel
1198+
curses_defines.append(('HAVE_NCURSESW', '1'))
1199+
curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1'))
11881200

11891201
if curses_library.startswith('ncurses'):
11901202
curses_libs = [curses_library]
@@ -1213,6 +1225,7 @@ class db_found(Exception): pass
12131225
self.compiler.find_library_file(lib_dirs, panel_library)):
12141226
exts.append( Extension('_curses_panel', ['_curses_panel.c'],
12151227
include_dirs=curses_includes,
1228+
define_macros=curses_defines,
12161229
libraries = [panel_library] + curses_libs) )
12171230
else:
12181231
missing.append('_curses_panel')

0 commit comments

Comments
 (0)