-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
python: Do not link extensions with libpython when not required #11098
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11098 +/- ##
==========================================
- Coverage 68.58% 67.77% -0.82%
==========================================
Files 412 207 -205
Lines 87861 44927 -42934
Branches 20728 9926 -10802
==========================================
- Hits 60261 30449 -29812
+ Misses 23093 12106 -10987
+ Partials 4507 2372 -2135
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
mesonbuild/modules/python.py
Outdated
| pydep = self._dependency_method_impl({}) | ||
| if not pydep.found(): | ||
| raise mesonlib.MesonException('Python dependency not found') | ||
| # On macOS and some Linux distros (Debian) distutils doesn't link |
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.
I copied this comment from a few lines above, however, I'm not sure this statement is accurate. Judging from the python.pc distributed with Python, it is never necessary to link with libpython https://github.com/python/cpython/blob/81f7359f67a7166d57a10a3d5366406d9c85f1de/Misc/python.pc.in#L12 on systems where pkg-config is used, which I assume is at least all variants of Linux. The python.pc.in does not allow for inserting anything for the Libs entry.
Apply the information gathered through distutils also to the case when the dependecy has not been expressed explicitly. The spurious linking has been observed on Python 3.7 on Linux where distutils does not instruct to link libpython but the Python's pkg-config contains linker flags to link to libpython. Fixes mesonbuild#11097.
3803058 to
45e737c
Compare
|
I reworded the comments to be clarify the need for this change. Because the fix applies only to the dependency constructed from the pkg-config metadata, an alternative approach would be to strip the linker flags in |
|
The flake8 error in the tests is not due to this PR. |
|
Superseded by #11104. |
Apply the information gathered through distutils also to the case when the dependecy has not been expressed explicitly. The spurious linking has been observed on Python 3.7 on Linux where distutils does not instruct to link libpython but the Python's pkg-config contains linker flags to link to libpython.
Fixes #11097.