[Python-checkins] bpo-36210: correct logic in setup.py for optional extensions for AIX (GH-12202) (GH-16376)

Ned Deily webhook-mailer at python.org
Wed Sep 25 10:14:14 EDT 2019


https://github.com/python/cpython/commit/e4be8c984d035da30f9ed051aa6f3f762f0e9060
commit: e4be8c984d035da30f9ed051aa6f3f762f0e9060
branch: 3.8
author: Michael Felt <aixtools at users.noreply.github.com>
committer: Ned Deily <nad at python.org>
date: 2019-09-25T10:14:09-04:00
summary:

bpo-36210: correct logic in setup.py for optional extensions for AIX (GH-12202) (GH-16376)

files:
A Misc/NEWS.d/next/Build/2019-09-24-22-47-47.bpo-36210.EmL9X1.rst
M setup.py

diff --git a/Misc/NEWS.d/next/Build/2019-09-24-22-47-47.bpo-36210.EmL9X1.rst b/Misc/NEWS.d/next/Build/2019-09-24-22-47-47.bpo-36210.EmL9X1.rst
new file mode 100644
index 000000000000..aa9a56fe57ae
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2019-09-24-22-47-47.bpo-36210.EmL9X1.rst
@@ -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
diff --git a/setup.py b/setup.py
index be2ac0b01d00..20d7f35652fe 100644
--- a/setup.py
+++ b/setup.py
@@ -43,6 +43,7 @@ def get_platform():
 MS_WINDOWS = (HOST_PLATFORM == 'win32')
 CYGWIN = (HOST_PLATFORM == 'cygwin')
 MACOS = (HOST_PLATFORM == 'darwin')
+AIX = (HOST_PLATFORM.startswith('aix'))
 VXWORKS = ('vxworks' in HOST_PLATFORM)
 
 
@@ -807,7 +808,9 @@ def detect_simple_extensions(self):
         if (self.config_h_vars.get('HAVE_GETSPNAM', False) or
                 self.config_h_vars.get('HAVE_GETSPENT', False)):
             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')
 
         # select(2); not on ancient System V
@@ -911,6 +914,10 @@ def detect_readline_curses(self):
             curses_library = readline_termcap_library
         elif self.compiler.find_library_file(self.lib_dirs, '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'):
             curses_library = 'ncurses'
         elif self.compiler.find_library_file(self.lib_dirs, 'curses'):
@@ -1006,13 +1013,15 @@ def detect_readline_curses(self):
             self.missing.append('_curses')
 
         # If the curses module is enabled, check for the panel module
-        if (curses_enabled and
-            self.compiler.find_library_file(self.lib_dirs, panel_library)):
+        # _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.add(Extension('_curses_panel', ['_curses_panel.c'],
                                include_dirs=curses_includes,
                                define_macros=curses_defines,
                                libraries=[panel_library, *curses_libs]))
-        else:
+        elif not skip_curses_panel:
             self.missing.append('_curses_panel')
 
     def detect_crypt(self):
@@ -1465,7 +1474,7 @@ def detect_platform_specific_exts(self):
         # Platform-specific libraries
         if HOST_PLATFORM.startswith(('linux', 'freebsd', 'gnukfreebsd')):
             self.add(Extension('ossaudiodev', ['ossaudiodev.c']))
-        else:
+        elif not AIX:
             self.missing.append('ossaudiodev')
 
         if MACOS:



More information about the Python-checkins mailing list