MantisBT - CMake
View Issue Details
0010279CMakeModulespublic2010-02-12 09:102011-05-02 14:45
Didier Raboud 
Marcus D. Hanwell 
normalfeaturealways
closedfixed 
CMake-2-8 
CMake 2.8.4CMake 2.8.4 
0010279: cmake-data: FindPython{Interp,Libs}.cmake should take the desired python version as argument
Hi,

FindPythonInterp and FindPythonLibs correctly find the most recent python
binary and libraries. But when cmake is used for a Debian package, it is
convenient to be able to select the python version you want.

Without that feature, if one wants a package build against more than one
version of python, he is forced to patching and hackery. See e.g:

http://patch-tracker.debian.org/patch/series/view/pyside/0.2.3-1/multiple_python_versions.patch [^]

So if we could simply feed a "-DPYTHON_VERSION 2.6" to cmake, it would be
really cool.

Thanks in advance for consideration and best regards,

OdyX
This bug was reported in the Debian bug tracker, where there are patches already:

http://bugs.debian.org/569321 [^]
No tags attached.
diff FindPythonInterp.cmake.diff (1,740) 2010-02-12 09:10
https://public.kitware.com/Bug/file/2857/FindPythonInterp.cmake.diff
diff FindPythonLibs.cmake.diff (801) 2010-02-12 09:10
https://public.kitware.com/Bug/file/2858/FindPythonLibs.cmake.diff
diff FindPython_fix_#569321_and_#580503.diff (4,226) 2010-06-07 10:59
https://public.kitware.com/Bug/file/3168/FindPython_fix_%23569321_and_%23580503.diff
Issue History
2010-02-12 09:10Didier RaboudNew Issue
2010-02-12 09:10Didier RaboudFile Added: FindPythonInterp.cmake.diff
2010-02-12 09:10Didier RaboudFile Added: FindPythonLibs.cmake.diff
2010-02-12 09:11Didier RaboudNote Added: 0019513
2010-05-08 03:40Alex NeundorfCategoryCMake => Modules
2010-06-07 10:59CuranFile Added: FindPython_fix_#569321_and_#580503.diff
2010-06-07 11:00CuranNote Added: 0020931
2010-07-29 11:37Brad KingNote Added: 0021551
2010-12-14 18:13David ColeAssigned To => Marcus D. Hanwell
2010-12-14 18:13David ColeStatusnew => assigned
2011-01-10 14:03Marcus D. HanwellNote Added: 0024542
2011-01-10 15:06CuranNote Added: 0024552
2011-01-10 15:44CuranNote Added: 0024557
2011-01-11 13:05Marcus D. HanwellNote Added: 0024590
2011-01-11 13:12Scott KittermanNote Added: 0024591
2011-01-12 07:19David ColeNote Added: 0024613
2011-01-12 10:32Marcus D. HanwellNote Added: 0024618
2011-01-12 10:32Marcus D. HanwellStatusassigned => resolved
2011-01-12 10:32Marcus D. HanwellFixed in Version => CMake 2.8.4
2011-01-12 10:32Marcus D. HanwellResolutionopen => fixed
2011-01-12 12:23David ColeTarget Version => CMake 2.8.4
2011-05-02 14:45David ColeNote Added: 0026334
2011-05-02 14:45David ColeStatusresolved => closed

Notes
(0019513)
Didier Raboud   
2010-02-12 09:11   
This could also be extended to use pyversions to narrow the search to installed versions instead of hardcoding the list of versions.
(0020931)
Curan   
2010-06-07 11:00   
Debian has addressed this issue with the now attached patch (FindPython_fix_#569321_and_#580503.diff). The latest version can be downloaded from http://git.debian.org/?p=collab-maint/cmake.git;a=blob_plain;f=debian/patches/FindPython_fix_%23569321_and_%23580503.diff;h=2ab6814860ccdae723ae110db9b3f90751d5f102;hb=HEAD [^]
(0021551)
Brad King   
2010-07-29 11:37   
Currently FindPython has no module maintainer:

  http://www.cmake.org/Wiki/CMake:Module_Maintainers [^]

and therefore we accept no patches to it.

If anyone wants to become the module maintainer you will get git push access to the CMake/Modules source directory and can apply patches as necessary.
(0024542)
Marcus D. Hanwell   
2011-01-10 14:03   
2d3594b begins to address these issues, using an approach similar to Boost. The proposed patch would have caused the Python executable on Windows to be ignored, due to the naming of the executable. Additionally I do not have a pyversions, using Arch Linux. How widely packaged is pyversions?
(0024552)
Curan   
2011-01-10 15:06   
Ok, the Windows case wasn't tested, as I don't have Windows around.

About pyversions: hm, not sure, but it could(!!) be a Debian-specific thing. I'm not into Python, I just tried to fix a bug in CMake (initially for Debian). Didier (#569321) or Jakub (#580503) are more likely to know that. I'll ping them and maybe one of them can give a good answer.
(0024557)
Curan   
2011-01-10 15:44   
Ok, that was fast. Jakub answered, that pyversions is indeed a debianism. The replacement – in his opinion – should be:
python -c 'import sys; print "%d.%d" % sys.version_info[:2]'
(0024590)
Marcus D. Hanwell   
2011-01-11 13:05   
That only gives me the current version of the Python interpreter I found here. We still have to actually find the interpreter too, and some packages would like to find 3.x in preference to 2.x. I think the additional version variable should allow that, and is a step in the right direction for the 2.8.4 release.

I don't have time, and the 2.8.4 window is closing, but will try to take a better look at this soon.
(0024591)
Scott Kitterman   
2011-01-11 13:12   
You should find Python and Python3 separately since they are incompatible. You probably want FindPython3Interp and FindPython3Libs in addition to FindPythonInterp and FindPythonLibs.
(0024613)
David Cole   
2011-01-12 07:19   
Marcus, we're including the commit you made on Monday in the first release candidate for CMake 2.8.4.

Is this bug then resolved, or is there more work to be done on it?

(i.e. -- should I resolve it and mark it as fixed in 2.8.4, or should I leave it open?)

Thanks,
David
(0024618)
Marcus D. Hanwell   
2011-01-12 10:32   
I think the initial request made in this bug report is now satisfied - you can supply an ordered list of desired Python versions. There is some debate about consistency, and how to determine this version. I will defer those to future work, and advise people to use Python_ADDITIONAL_VERSIONS to set the Python version they wish, in order of priority.
(0026334)
David Cole   
2011-05-02 14:45   
Closing resolved issues that have not been updated in more than 3 months.