Skip to content

Commit e4be8c9

Browse files
aixtoolsned-deily
authored andcommitted
bpo-36210: correct logic in setup.py for optional extensions for AIX (GH-12202) (GH-16376)
1 parent 2e566bf commit e4be8c9

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
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: 14 additions & 5 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

@@ -807,7 +808,9 @@ def detect_simple_extensions(self):
807808
if (self.config_h_vars.get('HAVE_GETSPNAM', False) or
808809
self.config_h_vars.get('HAVE_GETSPENT', False)):
809810
self.add(Extension('spwd', ['spwdmodule.c']))
810-
else:
811+
# AIX has shadow passwords, but access is not via getspent(), etc.
812+
# module support is not expected so it not 'missing'
813+
elif not AIX:
811814
self.missing.append('spwd')
812815

813816
# select(2); not on ancient System V
@@ -911,6 +914,10 @@ def detect_readline_curses(self):
911914
curses_library = readline_termcap_library
912915
elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
913916
curses_library = 'ncursesw'
917+
# Issue 36210: OSS provided ncurses does not link on AIX
918+
# Use IBM supplied 'curses' for successful build of _curses
919+
elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
920+
curses_library = 'curses'
914921
elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'):
915922
curses_library = 'ncurses'
916923
elif self.compiler.find_library_file(self.lib_dirs, 'curses'):
@@ -1006,13 +1013,15 @@ def detect_readline_curses(self):
10061013
self.missing.append('_curses')
10071014

10081015
# If the curses module is enabled, check for the panel module
1009-
if (curses_enabled and
1010-
self.compiler.find_library_file(self.lib_dirs, panel_library)):
1016+
# _curses_panel needs some form of ncurses
1017+
skip_curses_panel = True if AIX else False
1018+
if (curses_enabled and not skip_curses_panel and
1019+
self.compiler.find_library_file(self.lib_dirs, panel_library)):
10111020
self.add(Extension('_curses_panel', ['_curses_panel.c'],
10121021
include_dirs=curses_includes,
10131022
define_macros=curses_defines,
10141023
libraries=[panel_library, *curses_libs]))
1015-
else:
1024+
elif not skip_curses_panel:
10161025
self.missing.append('_curses_panel')
10171026

10181027
def detect_crypt(self):
@@ -1465,7 +1474,7 @@ def detect_platform_specific_exts(self):
14651474
# Platform-specific libraries
14661475
if HOST_PLATFORM.startswith(('linux', 'freebsd', 'gnukfreebsd')):
14671476
self.add(Extension('ossaudiodev', ['ossaudiodev.c']))
1468-
else:
1477+
elif not AIX:
14691478
self.missing.append('ossaudiodev')
14701479

14711480
if MACOS:

0 commit comments

Comments
 (0)