Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 603406 - dev-util/cmake-3.6.3 - PythonInterp finds wrong Python executable with CMAKE_BUILD_TYPE=Gentoo
Summary: dev-util/cmake-3.6.3 - PythonInterp finds wrong Python executable with CMAKE_...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-22 00:42 UTC by Wim de With
Modified: 2023-03-04 10:15 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Minimal CMakeList.txt to reproduce behavior (CMakeLists.txt,40 bytes, text/plain)
2016-12-22 00:42 UTC, Wim de With
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wim de With 2016-12-22 00:42:33 UTC
Created attachment 457060 [details]
Minimal CMakeList.txt to reproduce behavior

If you build the attached CMakeLists.txt with:

cmake .

CMake finds the correct Python executable (/usr/bin/python2.7):
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.12", minimum required is "2.7")

If you build it with:

cmake -DCMAKE_BUILD_TYPE=Gentoo .

CMake finds /usr/bin/python, which I eselected to python3.4:
-- Found PythonInterp: /usr/bin/python (found suitable version "3.4.5", minimum required is "2.7")
Comment 1 Michael Palimaka (kensington) gentoo-dev 2016-12-22 13:58:49 UTC
This is intentional behaviour.

When we build a package against python, we need to be absolutely certain that we are building against the correct version given the selected PYTHON_TARGET.

From FindPythonInterp.cmake:

>if (CMAKE_GENTOO_BUILD OR CMAKE_BUILD_TYPE STREQUAL Gentoo)
>    set(_Python_NAMES python)
>endif()

When a Gentoo build is active (intended only to be the case when building via a package manager), we throw away whatever cmake would have found and force /usr/bin/python instead.  The python eclass then exports EPYTHON="pythonX.Y" causing /usr/bin/python to point to the correct version given the active PYTHON_TARGET.