-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-113565: Improve and harden detection of curses dependencies #119816
Conversation
erlend-aasland
commented
May 31, 2024
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: configure prefers system install of ncurses over available pkg-config on macOS #113565
This comment was marked as outdated.
This comment was marked as outdated.
If you agree on the overall strategy, I'll continue working on this. |
…S_VERSION to guard ncurses features
…heck for update_panels() independently of initscr()
I finally managed to coerce this the way I would like it. Locally on macOS, the SDK supplied curses/panel libs are detected just fine using Now, this is a large PR, but the With this PR we now do:
I believe this is now ready for an initial round of review. Footnotes
|
I'm conflicted regarding backporting this change. I think we should consider it for 3.13, but I'm not so sure about 3.12. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
All buildbot failures are unrelated to this PR: good!
|
Yes, and that is expected :) The hard ting with changes like this, is we have to tediously examine all buildbots and verify that the dependency detection works as expected, and examine again that the correct compile and linker flags are used in the build phase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! (But prefer not to backport as possible, original issue is also classified as the feature not the bug..)
About the backport, I would like to delegate the decision to @ned-deily
Oh same here, I prefer to not backport such change just to limit the risk of regression. |
Thanks for the reviews, Donghee and Victor! I still think we should backport :) |
It's up to you if you want to be responsible for potential regression. What are advantages of backporting the change if the current code "just works" on the stable 3.12 branch? Buildbots only test the most common major platforms. Other platforms such as OpenBSD, NetBSD, AIX, Solaris, HP-UX, and others are not tested. |
It's a bug-fix; it does not "just work" on 3.12 ;) IMO, the risk of regression is extremely low. This change improves the build system's ability to detect |
@ned-deily, friendly ping 🏓 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, although I limited my review to a non-exhaustive read-through and to testing before and after build configurations on macOS using the current (Sonoma 14.5) release and Command Line Tools with (1) the system-provided ncurses, (2) MacPorts ncurses, (3) Homebrew ncurses, and (4) our Python for macOS installer build. No regressions were noted with or without pkg-config
use. I did not test on any other platforms.
FWIW, the PR also eliminates a previously seen compile warning when using either the MacPorts or Homebrew ncurses:
In file included from ./Include/py_curses.h:40:
/opt/homebrew/Cellar/ncurses/6.5/include/ncursesw/ncurses.h:152:9: warning: 'NCURSES_OPAQUE' macro redefined [-Wmacro-redefined]
#define NCURSES_OPAQUE 1
^
./Include/py_curses.h:36:9: note: previous definition is here
#define NCURSES_OPAQUE 0
WRT backporting, I would like to see this in 3.13; I'm somewhat ambivalent about backporting to 3.12. While it is indeed fixing some somewhat buggy build behavior, it is behavior that has been out there since 3.12.0 (and 3.11?) and presumably most downstream builders of Python 3.12 have figured out how to live with it. If it were a bug that affected all users of Python, that would be one thing, but one that only affects builders and, at that, only those who are concerned about ncurses ... that's a lot of churn in some of our favorite files (like |
Thank you so much for taking the time to review this huge PR, everyone; highly appreciated! Regarding other operating systems, I did examine a big chunk of the buildbots and found no regressions. I'll create backports for 3.13 and 3.12, but I'll leave the 3.12 one open for Thomas to decide. |
This comment has been minimized.
This comment has been minimized.
…ythonGH-119816) 1. Use pkg-config to check for ncursesw/panelw. If that fails, use pkg-config to check for ncurses/panel. 2. Regardless of pkg-config output, search for curses/panel headers, so we're sure we have all defines in pyconfig.h. 3. Regardless of pkg-config output, check if libncurses or libncursesw contains the 'initscr' symbol; if it does _and_ pkg-config failed earlier, add the resulting -llib linker option to CURSES_LIBS. Ditto for 'update_panels' and PANEL_LIBS. 4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're using updated LIBS and CPPFLAGS for those. Add the PY_CHECK_CURSES convenience macro. (cherry picked from commit f80376b) Co-authored-by: Erlend E. Aasland <erlend@python.org>
This comment was marked as outdated.
This comment was marked as outdated.
GH-121202 is a backport of this pull request to the 3.13 branch. |
…GH-119816) (#121202) 1. Use pkg-config to check for ncursesw/panelw. If that fails, use pkg-config to check for ncurses/panel. 2. Regardless of pkg-config output, search for curses/panel headers, so we're sure we have all defines in pyconfig.h. 3. Regardless of pkg-config output, check if libncurses or libncursesw contains the 'initscr' symbol; if it does _and_ pkg-config failed earlier, add the resulting -llib linker option to CURSES_LIBS. Ditto for 'update_panels' and PANEL_LIBS. 4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're using updated LIBS and CPPFLAGS for those. Add the PY_CHECK_CURSES convenience macro. (cherry picked from commit f80376b) Co-authored-by: Erlend E. Aasland <erlend@python.org>
Well done @erlend-aasland :-) |
GH-121222 is a backport of this pull request to the 3.12 branch. |
…ython#119816) 1. Use pkg-config to check for ncursesw/panelw. If that fails, use pkg-config to check for ncurses/panel. 2. Regardless of pkg-config output, search for curses/panel headers, so we're sure we have all defines in pyconfig.h. 3. Regardless of pkg-config output, check if libncurses or libncursesw contains the 'initscr' symbol; if it does _and_ pkg-config failed earlier, add the resulting -llib linker option to CURSES_LIBS. Ditto for 'update_panels' and PANEL_LIBS. 4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're using updated LIBS and CPPFLAGS for those. Add the PY_CHECK_CURSES convenience macro.
…ython#119816) 1. Use pkg-config to check for ncursesw/panelw. If that fails, use pkg-config to check for ncurses/panel. 2. Regardless of pkg-config output, search for curses/panel headers, so we're sure we have all defines in pyconfig.h. 3. Regardless of pkg-config output, check if libncurses or libncursesw contains the 'initscr' symbol; if it does _and_ pkg-config failed earlier, add the resulting -llib linker option to CURSES_LIBS. Ditto for 'update_panels' and PANEL_LIBS. 4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're using updated LIBS and CPPFLAGS for those. Add the PY_CHECK_CURSES convenience macro.
…ython#119816) 1. Use pkg-config to check for ncursesw/panelw. If that fails, use pkg-config to check for ncurses/panel. 2. Regardless of pkg-config output, search for curses/panel headers, so we're sure we have all defines in pyconfig.h. 3. Regardless of pkg-config output, check if libncurses or libncursesw contains the 'initscr' symbol; if it does _and_ pkg-config failed earlier, add the resulting -llib linker option to CURSES_LIBS. Ditto for 'update_panels' and PANEL_LIBS. 4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're using updated LIBS and CPPFLAGS for those. Add the PY_CHECK_CURSES convenience macro.