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
This commit is contained in:
Michael Felt 2019-06-21 15:58:00 +02:00 committed by Nick Coghlan
parent d0068000b2
commit 08970cb03c
2 changed files with 26 additions and 8 deletions

View File

@ -0,0 +1,9 @@
Update optional extension module detection for AIX.
ossaudiodev and spwd are not applicable for AIX, and
are no longer reported as missing.
3rd-party packaging of ncurses (with ASIS support)
conflicts with officially supported AIX curses library,
so configure AIX to use libcurses.a. However, skip
trying to build _curses_panel.
patch by M Felt

View File

@ -43,6 +43,7 @@ HOST_PLATFORM = get_platform()
MS_WINDOWS = (HOST_PLATFORM == 'win32') MS_WINDOWS = (HOST_PLATFORM == 'win32')
CYGWIN = (HOST_PLATFORM == 'cygwin') CYGWIN = (HOST_PLATFORM == 'cygwin')
MACOS = (HOST_PLATFORM == 'darwin') MACOS = (HOST_PLATFORM == 'darwin')
AIX = (HOST_PLATFORM.startswith('aix'))
VXWORKS = ('vxworks' in HOST_PLATFORM) VXWORKS = ('vxworks' in HOST_PLATFORM)
@ -805,7 +806,9 @@ class PyBuildExt(build_ext):
if (self.config_h_vars.get('HAVE_GETSPNAM', False) or if (self.config_h_vars.get('HAVE_GETSPNAM', False) or
self.config_h_vars.get('HAVE_GETSPENT', False)): self.config_h_vars.get('HAVE_GETSPENT', False)):
self.add(Extension('spwd', ['spwdmodule.c'])) self.add(Extension('spwd', ['spwdmodule.c']))
else: # AIX has shadow passwords, but access is not via getspent(), etc.
# module support is not expected so it not 'missing'
elif not AIX:
self.missing.append('spwd') self.missing.append('spwd')
# select(2); not on ancient System V # select(2); not on ancient System V
@ -909,6 +912,10 @@ class PyBuildExt(build_ext):
curses_library = readline_termcap_library curses_library = readline_termcap_library
elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
curses_library = 'ncursesw' curses_library = 'ncursesw'
# Issue 36210: OSS provided ncurses does not link on AIX
# Use IBM supplied 'curses' for successful build of _curses
elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
curses_library = 'curses'
elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'): elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'):
curses_library = 'ncurses' curses_library = 'ncurses'
elif self.compiler.find_library_file(self.lib_dirs, 'curses'): elif self.compiler.find_library_file(self.lib_dirs, 'curses'):
@ -1004,13 +1011,15 @@ class PyBuildExt(build_ext):
self.missing.append('_curses') self.missing.append('_curses')
# If the curses module is enabled, check for the panel module # If the curses module is enabled, check for the panel module
if (curses_enabled and # _curses_panel needs some form of ncurses
skip_curses_panel = True if AIX else False
if (curses_enabled and not skip_curses_panel and
self.compiler.find_library_file(self.lib_dirs, panel_library)): self.compiler.find_library_file(self.lib_dirs, panel_library)):
self.add(Extension('_curses_panel', ['_curses_panel.c'], self.add(Extension('_curses_panel', ['_curses_panel.c'],
include_dirs=curses_includes, include_dirs=curses_includes,
define_macros=curses_defines, define_macros=curses_defines,
libraries=[panel_library, *curses_libs])) libraries=[panel_library, *curses_libs]))
else: elif not skip_curses_panel:
self.missing.append('_curses_panel') self.missing.append('_curses_panel')
def detect_crypt(self): def detect_crypt(self):
@ -1463,7 +1472,7 @@ class PyBuildExt(build_ext):
# Platform-specific libraries # Platform-specific libraries
if HOST_PLATFORM.startswith(('linux', 'freebsd', 'gnukfreebsd')): if HOST_PLATFORM.startswith(('linux', 'freebsd', 'gnukfreebsd')):
self.add(Extension('ossaudiodev', ['ossaudiodev.c'])) self.add(Extension('ossaudiodev', ['ossaudiodev.c']))
else: elif not AIX:
self.missing.append('ossaudiodev') self.missing.append('ossaudiodev')
if MACOS: if MACOS: