Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-113565: Improve and harden detection of curses dependencies#119816
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Uh oh!
There was an error while loading.Please reload this page.
erlend-aasland commentedMay 31, 2024
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()
erlend-aasland commentedJun 2, 2024
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
|
erlend-aasland commentedJun 2, 2024
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.
vstinner commentedJun 6, 2024
All buildbot failures areunrelated to this PR: good!
|
erlend-aasland commentedJun 7, 2024
Yes, and that is expected :) The hard ting with changes like this, is we have to tediously examineall 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. |
corona10 left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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
vstinner commentedJun 9, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Oh same here, I prefer to not backport such change just to limit the risk of regression. |
erlend-aasland commentedJun 9, 2024
Thanks for the reviews, Donghee and Victor! I still think we should backport :) |
vstinner commentedJun 10, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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. |
erlend-aasland commentedJun 10, 2024
It's a bug-fix; it does not "just work" on 3.12 ;) IMO, the risk of regression is extremely low. This change improves thebuild system's ability to detect |
erlend-aasland commentedJun 27, 2024
@ned-deily, friendly ping 🏓 |
ned-deily left a comment
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 withoutpkg-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 0ned-deily commentedJul 1, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 |
erlend-aasland commentedJul 1, 2024
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 commitf80376b)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 the3.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 commitf80376b)Co-authored-by: Erlend E. Aasland <erlend@python.org>
vstinner commentedJul 1, 2024
Well done@erlend-aasland :-) |
GH-121222 is a backport of this pull request to the3.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.
Uh oh!
There was an error while loading.Please reload this page.