On 2010-07-19 00:47+0200 Eric Noulard wrote:

"import sys; print sys.version.split()[0]" will not work with python 3 because
print is a function:

Hi Eric:

Thanks for that reminder about using the print function for python3
and also for giving me the hint about sys.version_info to avoid
trailing information after the version triplet.

To draw this subthread to a definite conclusion, here is what works
for me now to get python version for either python2 or python3.

softw...@raven> python -c \
'import sys; print("%s.%s.%s" % sys.version_info[0:3])'
2.6.5

softw...@raven> python3 -c \
'import sys; print("%s.%s.%s" % sys.version_info[0:3])'
3.1.2

So I would recommend this command form to determined the python
version corresponding to the found interpreter for CMake.

Thanks again for your help with this.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to