Skip to content

Commit 08970cb

Browse files
aixtoolsncoghlan
authored andcommitted
bpo-36210: update optional extension handling for AIX (GH-12202)
* Switch to officially supported curses from 3rd-party ASIS supported ncurses * stop saying optional modules osaudiodev and spwd are missing on AIX Patch by M.Felt
1 parent d006800 commit 08970cb

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Update optional extension module detection for AIX.
2+
ossaudiodev and spwd are not applicable for AIX, and
3+
are no longer reported as missing.
4+
3rd-party packaging of ncurses (with ASIS support)
5+
conflicts with officially supported AIX curses library,
6+
so configure AIX to use libcurses.a. However, skip
7+
trying to build _curses_panel.
8+
9+
patch by M Felt

setup.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def get_platform():
4343
MS_WINDOWS = (HOST_PLATFORM == 'win32')
4444
CYGWIN = (HOST_PLATFORM == 'cygwin')
4545
MACOS = (HOST_PLATFORM == 'darwin')
46+
AIX = (HOST_PLATFORM.startswith('aix'))
4647
VXWORKS = ('vxworks' in HOST_PLATFORM)
4748

4849

@@ -805,7 +806,9 @@ def detect_simple_extensions(self):
805806
if (self.config_h_vars.get('HAVE_GETSPNAM', False) or
806807
self.config_h_vars.get('HAVE_GETSPENT', False)):
807808
self.add(Extension('spwd', ['spwdmodule.c']))
808-
else:
809+
# AIX has shadow passwords, but access is not via getspent(), etc.
810+
# module support is not expected so it not 'missing'
811+
elif not AIX:
809812
self.missing.append('spwd')
810813

811814
# select(2); not on ancient System V
@@ -909,6 +912,10 @@ def detect_readline_curses(self):
909912
curses_library = readline_termcap_library
910913
elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
911914
curses_library = 'ncursesw'
915+
# Issue 36210: OSS provided ncurses does not link on AIX
916+
# Use IBM supplied 'curses' for successful build of _curses
917+
elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
918+
curses_library = 'curses'
912919
elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'):
913920
curses_library = 'ncurses'
914921
elif self.compiler.find_library_file(self.lib_dirs, 'curses'):
@@ -1004,13 +1011,15 @@ def detect_readline_curses(self):
10041011
self.missing.append('_curses')
10051012

10061013
# If the curses module is enabled, check for the panel module
1007-
if (curses_enabled and
1008-
self.compiler.find_library_file(self.lib_dirs, panel_library)):
1014+
# _curses_panel needs some form of ncurses
1015+
skip_curses_panel = True if AIX else False
1016+
if (curses_enabled and not skip_curses_panel and
1017+
self.compiler.find_library_file(self.lib_dirs, panel_library)):
10091018
self.add(Extension('_curses_panel', ['_curses_panel.c'],
1010-
include_dirs=curses_includes,
1011-
define_macros=curses_defines,
1012-
libraries=[panel_library, *curses_libs]))
1013-
else:
1019+
include_dirs=curses_includes,
1020+
define_macros=curses_defines,
1021+
libraries=[panel_library, *curses_libs]))
1022+
elif not skip_curses_panel:
10141023
self.missing.append('_curses_panel')
10151024

10161025
def detect_crypt(self):
@@ -1463,7 +1472,7 @@ def detect_platform_specific_exts(self):
14631472
# Platform-specific libraries
14641473
if HOST_PLATFORM.startswith(('linux', 'freebsd', 'gnukfreebsd')):
14651474
self.add(Extension('ossaudiodev', ['ossaudiodev.c']))
1466-
else:
1475+
elif not AIX:
14671476
self.missing.append('ossaudiodev')
14681477

14691478
if MACOS:

0 commit comments

Comments
 (0)