mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
python: fix broken usage of FindPython.cmake breaking python selection
In commit9a9a262ea1we moved from pkg-config to find_package() to work around a deficiency in the pkgsrc package manager, which does not ship pkg-config files as intended by CPython. In the process, Gentoo and other platforms that, unlike pkgsrc, publicly support multiple versions of python installed in parallel, had python version selection broken. Consequently, weechat linked to the wrong python, which happened to be installed in build chroots but was not the versioned python package that the weechat package listed as a dependency. Attempting to install weechat then broke on some systems (which installed one version of python as a dependency but actually linked to a totally different one). This happens due to a design bug in upstream CMake. It is never conceptually reasonable to use ``` find_package(Python COMPONENTS ...) ``` and omit the "Interpreter" component; if you do, CMake will ignore its own documentation on how to control the build to use a specific python, and choose one randomly (== "latest version available"). If, and only if, the Interpreter component is checked, the development headers / libraries for python will be guaranteed consistent with the documented lookup variables from FindPython.cmake's documentation. Bug: https://bugs.gentoo.org/968814 Fixes:9a9a262ea1Fixes: https://github.com/weechat/weechat/pull/2251 Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
This commit is contained in:
committed by
Sébastien Helleu
parent
dc4df8b9aa
commit
4c79e870af
@@ -20,9 +20,9 @@
|
||||
#
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.18.0")
|
||||
find_package(Python 3.0 REQUIRED COMPONENTS Development)
|
||||
find_package(Python 3.0 REQUIRED COMPONENTS Interpreter Development)
|
||||
else()
|
||||
find_package(Python 3.0 REQUIRED COMPONENTS Development.Embed)
|
||||
find_package(Python 3.0 REQUIRED COMPONENTS Interpreter Development.Embed)
|
||||
endif()
|
||||
|
||||
add_library(python MODULE
|
||||
|
||||
Reference in New Issue
Block a user