[cmake-developers] FindPythonInterp.cmake an different major versions

Rolf Eike Beer eike at sf-mail.de
Tue Jan 17 13:50:19 EST 2012


Commit 20980ef56a847fec7922983257fd5be467b689bd changed the FindPythonInterp 
to search for "python" first, instead of prefering the most recent (python 2) 
version. This was intended to allow the user to have a different default 
python than the newest version. But for the same reason it is as wrong :/

Today a user was in #cmake that had a system default python that was some 3.x 
version, and therefore /usr/bin/python was a symlink to /usr/bin/python3. The 
current module has no possiblity for a developer to specify that 
FindPythonInterp should search for python2 first. So I wrote the attached 
patch which allow the developer to say that a python2 or python3 major version 
should be preferred.

This is actually a bit hacky, but nevertheless "works for him"(tm). But 
actually I think the whole version selection stuff in this module needs an 
overhaul. If the user says he needs e.g. version 2.5 the first look should be 
python2.5, and then check python2, python, and whatever. Instead python is 
checked first (may be 3.x), if that is not found e.g. 2.7 is checked (which 
may be wrong for the same reason as stated in the above commit).

At the end this thing finds "some" python version and then lets FPHSA check if 
that version matches the user desired version. Instead it should _first_ 
actually try to find the desired version (which is rather easy for python), 
and later call FPHSA.

Also this module doesn't know at all about python 3 major versions, so with a 
system default python of python2 (like Gentoo currently has) a requested 
version of 3.0 will always fail if the user does not explicitely specify the 
correct python interpreter on the command line.

Opinions?

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-FindPythonInterp-make-major-version-selectable.patch
Type: text/x-patch
Size: 1813 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20120117/7303d2a9/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20120117/7303d2a9/attachment.sig>


More information about the cmake-developers mailing list