From ccf40a6c2e7ee3b9c0e04314f88186bed7cd33e9 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Wed, 6 Mar 2019 19:01:24 +0000 Subject: [PATCH 01/11] Switch to officially support curses from 3rd-party ASIS supported ncurses --- .../2019-03-06-18-55-10.bpo-36210.fup9H2.rst | 6 ++++++ setup.py | 17 +++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst diff --git a/Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst b/Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst new file mode 100644 index 00000000000000..64980d7f1dd587 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst @@ -0,0 +1,6 @@ +3rd-party packaging of ncurses (with ASIS support) conflicts +with officially supported AIX curses library. +Configure AIX build to use libcurses.a rather than libncurses.a +(that then fails). Also skip trying to build _curses_panel. + +patch by M Felt diff --git a/setup.py b/setup.py index b96961073b987b..77022b602d651a 100644 --- a/setup.py +++ b/setup.py @@ -869,7 +869,8 @@ def detect_readline_curses(self): curses_library = readline_termcap_library elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): curses_library = 'ncursesw' - elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'): + # Issue 36210: AIX and ncurses does not co-exist with IBM supplied curses + elif not HOST_PLATFORM.startswith("aix") and self.compiler.find_library_file(self.lib_dirs, 'ncurses'): curses_library = 'ncurses' elif self.compiler.find_library_file(self.lib_dirs, 'curses'): curses_library = 'curses' @@ -964,14 +965,18 @@ 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)): - self.add(Extension('_curses_panel', ['_curses_panel.c'], + # Issue 36210: + # On AIX, the 3rd-party ncurses packaging does not co-exist + # with the IBM provided libcurses.a -- ignore as default + if not HOST_PLATFORM.startswith("aix"): + if (curses_enabled and not HOST_PLATFORM.startswith("aix") 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: - self.missing.append('_curses_panel') + else: + self.missing.append('_curses_panel') def detect_crypt(self): # crypt module. From 178a739248e34f0d80c4911ff717c391a781a8d2 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Mon, 1 Apr 2019 17:39:14 +0000 Subject: [PATCH 02/11] line was too long [PEP 8], now two lines --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 77022b602d651a..bc7074c79f4608 100644 --- a/setup.py +++ b/setup.py @@ -870,7 +870,8 @@ def detect_readline_curses(self): elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): curses_library = 'ncursesw' # Issue 36210: AIX and ncurses does not co-exist with IBM supplied curses - elif not HOST_PLATFORM.startswith("aix") and self.compiler.find_library_file(self.lib_dirs, 'ncurses'): + elif self.compiler.find_library_file(self.lib_dirs, 'ncurses') + and not HOST_PLATFORM.startswith("aix"): curses_library = 'ncurses' elif self.compiler.find_library_file(self.lib_dirs, 'curses'): curses_library = 'curses' From f29cf2c37d58154eb8651cadcac0f1c83227300b Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Mon, 1 Apr 2019 17:51:01 +0000 Subject: [PATCH 03/11] clarify change and remove repeated boolean logic --- setup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index bc7074c79f4608..d234c04e906208 100644 --- a/setup.py +++ b/setup.py @@ -967,10 +967,11 @@ def detect_readline_curses(self): # If the curses module is enabled, check for the panel module # Issue 36210: - # On AIX, the 3rd-party ncurses packaging does not co-exist - # with the IBM provided libcurses.a -- ignore as default + # AIX libcurses does not support _curses_panel + # 3rd party support for _curses_panel is broken + # hence, ignore _curses_panel on AIX if not HOST_PLATFORM.startswith("aix"): - if (curses_enabled and not HOST_PLATFORM.startswith("aix") and + if (curses_enabled and self.compiler.find_library_file(self.lib_dirs, panel_library)): self.add(Extension('_curses_panel', ['_curses_panel.c'], include_dirs=curses_includes, From 4d74e70445e231c65dd1d85e9fe0ebd073c53744 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Mon, 1 Apr 2019 19:11:22 +0000 Subject: [PATCH 04/11] boolean logic over two lines needs a backslash on first line --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d234c04e906208..0d5e450945a23a 100644 --- a/setup.py +++ b/setup.py @@ -870,7 +870,7 @@ def detect_readline_curses(self): elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): curses_library = 'ncursesw' # Issue 36210: AIX and ncurses does not co-exist with IBM supplied curses - elif self.compiler.find_library_file(self.lib_dirs, 'ncurses') + elif self.compiler.find_library_file(self.lib_dirs, 'ncurses') \ and not HOST_PLATFORM.startswith("aix"): curses_library = 'ncurses' elif self.compiler.find_library_file(self.lib_dirs, 'curses'): From 401a2666ea317399e65e1cd4e954de37f5a0b36a Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Mon, 1 Apr 2019 19:23:59 +0000 Subject: [PATCH 05/11] stop saying optional modules osaudiodev and spwd are missing on AIX --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 0d5e450945a23a..d6cebc14ddddc3 100644 --- a/setup.py +++ b/setup.py @@ -767,7 +767,7 @@ 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: + elif not HOST_PLATFORM.startswith("aix"): self.missing.append('spwd') # select(2); not on ancient System V @@ -1429,7 +1429,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 HOST_PLATFORM.startswith("aix"): self.missing.append('ossaudiodev') if MACOS: From f56b7647fc14ccaf97ffb39eaacb8c8d0c8c48ee Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Mon, 1 Apr 2019 19:27:38 +0000 Subject: [PATCH 06/11] update News blurb --- .../next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst b/Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst index 64980d7f1dd587..07518e3fb5f46c 100644 --- a/Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst +++ b/Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst @@ -1,6 +1,9 @@ +Update optional extension module detection for AIX +osaudiodev and spwd are not applicable for AIX +Stop saying these are missing. 3rd-party packaging of ncurses (with ASIS support) conflicts with officially supported AIX curses library. -Configure AIX build to use libcurses.a rather than libncurses.a -(that then fails). Also skip trying to build _curses_panel. +Configure AIX to use libcurses.a - which works - +And skip trying to build _curses_panel. patch by M Felt From c7ca6fd038143923775dd56ea16ff02376251613 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Thu, 20 Jun 2019 10:21:03 +0000 Subject: [PATCH 07/11] Modify inline comments and clarify logic --- setup.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index ecf80f6a54b9c7..d351b5b05648e2 100644 --- a/setup.py +++ b/setup.py @@ -805,6 +805,8 @@ 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'])) + # AIX has shadow passwords, but access is not via getspent(), etc. + # module support is not to be expected elif not HOST_PLATFORM.startswith("aix"): self.missing.append('spwd') @@ -909,9 +911,12 @@ 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: AIX and ncurses does not co-exist with IBM supplied curses - elif self.compiler.find_library_file(self.lib_dirs, 'ncurses') \ - and not HOST_PLATFORM.startswith("aix"): + # Issue 36210: OSS provided ncurses does not link on AIX + # Use IBM supplied 'curses' for successful build of _curses + elif HOST_PLATFORM.startswith("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'): curses_library = 'curses' @@ -981,7 +986,7 @@ def detect_readline_curses(self): curses_defines.append(('HAVE_NCURSESW', '1')) curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1')) - curses_enabled = True + ncurses_enabled = curses_enabled = True if curses_library.startswith('ncurses'): curses_libs = [curses_library] self.add(Extension('_curses', ['_cursesmodule.c'], @@ -991,6 +996,7 @@ def detect_readline_curses(self): elif curses_library == 'curses' and not MACOS: # OSX has an old Berkeley curses, not good enough for # the _curses module. + ncurses_enabled = False if (self.compiler.find_library_file(self.lib_dirs, 'terminfo')): curses_libs = ['curses', 'terminfo'] elif (self.compiler.find_library_file(self.lib_dirs, 'termcap')): @@ -1003,22 +1009,19 @@ def detect_readline_curses(self): libraries=curses_libs)) else: curses_enabled = False + ncurses_enabled = False self.missing.append('_curses') # If the curses module is enabled, check for the panel module - # Issue 36210: - # AIX libcurses does not support _curses_panel - # 3rd party support for _curses_panel is broken - # hence, ignore _curses_panel on AIX - if not HOST_PLATFORM.startswith("aix"): - if (curses_enabled and + # _curses_panel needs some form of ncurses + if (curses_enabled and ncurses_enabled 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: - self.missing.append('_curses_panel') + else: + self.missing.append('_curses_panel') def detect_crypt(self): # crypt module. From 7c6b2e7679273af54b69025464839c1b4dbb7aa5 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Thu, 20 Jun 2019 11:17:51 +0000 Subject: [PATCH 08/11] Add missing backslash --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d351b5b05648e2..c26bb9295e7e47 100644 --- a/setup.py +++ b/setup.py @@ -913,7 +913,7 @@ def detect_readline_curses(self): curses_library = 'ncursesw' # Issue 36210: OSS provided ncurses does not link on AIX # Use IBM supplied 'curses' for successful build of _curses - elif HOST_PLATFORM.startswith("aix") and + elif HOST_PLATFORM.startswith("aix") and \ self.compiler.find_library_file(self.lib_dirs, 'curses'): curses_library = 'curses' elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'): From d240053871fcf738ab89b346db1837febb6bceba Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Thu, 20 Jun 2019 16:42:59 +0000 Subject: [PATCH 09/11] Fix whitespace --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index c26bb9295e7e47..30ee3d5f0dc447 100644 --- a/setup.py +++ b/setup.py @@ -1016,10 +1016,10 @@ def detect_readline_curses(self): # _curses_panel needs some form of ncurses if (curses_enabled and ncurses_enabled 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])) + self.add(Extension('_curses_panel', ['_curses_panel.c'], + include_dirs=curses_includes, + define_macros=curses_defines, + libraries=[panel_library, *curses_libs])) else: self.missing.append('_curses_panel') From a0117e0006590e6fabf2e15e9976f55c7d000743 Mon Sep 17 00:00:00 2001 From: Nick Coghlan Date: Fri, 21 Jun 2019 21:02:31 +1000 Subject: [PATCH 10/11] Update 2019-03-06-18-55-10.bpo-36210.fup9H2.rst --- .../Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst b/Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst index 07518e3fb5f46c..aa9a56fe57aeca 100644 --- a/Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst +++ b/Misc/NEWS.d/next/Build/2019-03-06-18-55-10.bpo-36210.fup9H2.rst @@ -1,9 +1,9 @@ -Update optional extension module detection for AIX -osaudiodev and spwd are not applicable for AIX -Stop saying these are missing. -3rd-party packaging of ncurses (with ASIS support) conflicts -with officially supported AIX curses library. -Configure AIX to use libcurses.a - which works - -And skip trying to build _curses_panel. +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 From 257214486ae577c85956f922529ac0040f0746c9 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Fri, 21 Jun 2019 13:14:16 +0000 Subject: [PATCH 11/11] use variable skip_curses_panel with AIX --- setup.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 30ee3d5f0dc447..86e9816dc7b6e3 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) @@ -806,8 +807,8 @@ def detect_simple_extensions(self): self.config_h_vars.get('HAVE_GETSPENT', False)): self.add(Extension('spwd', ['spwdmodule.c'])) # AIX has shadow passwords, but access is not via getspent(), etc. - # module support is not to be expected - elif not HOST_PLATFORM.startswith("aix"): + # module support is not expected so it not 'missing' + elif not AIX: self.missing.append('spwd') # select(2); not on ancient System V @@ -913,8 +914,7 @@ def detect_readline_curses(self): curses_library = 'ncursesw' # Issue 36210: OSS provided ncurses does not link on AIX # Use IBM supplied 'curses' for successful build of _curses - elif HOST_PLATFORM.startswith("aix") and \ - self.compiler.find_library_file(self.lib_dirs, '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' @@ -986,7 +986,7 @@ def detect_readline_curses(self): curses_defines.append(('HAVE_NCURSESW', '1')) curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1')) - ncurses_enabled = curses_enabled = True + curses_enabled = True if curses_library.startswith('ncurses'): curses_libs = [curses_library] self.add(Extension('_curses', ['_cursesmodule.c'], @@ -996,7 +996,6 @@ def detect_readline_curses(self): elif curses_library == 'curses' and not MACOS: # OSX has an old Berkeley curses, not good enough for # the _curses module. - ncurses_enabled = False if (self.compiler.find_library_file(self.lib_dirs, 'terminfo')): curses_libs = ['curses', 'terminfo'] elif (self.compiler.find_library_file(self.lib_dirs, 'termcap')): @@ -1009,18 +1008,18 @@ def detect_readline_curses(self): libraries=curses_libs)) else: curses_enabled = False - ncurses_enabled = False self.missing.append('_curses') # If the curses module is enabled, check for the panel module # _curses_panel needs some form of ncurses - if (curses_enabled and ncurses_enabled and + 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): @@ -1473,7 +1472,7 @@ def detect_platform_specific_exts(self): # Platform-specific libraries if HOST_PLATFORM.startswith(('linux', 'freebsd', 'gnukfreebsd')): self.add(Extension('ossaudiodev', ['ossaudiodev.c'])) - elif not HOST_PLATFORM.startswith("aix"): + elif not AIX: self.missing.append('ossaudiodev') if MACOS: