[cmake-developers] [CMake 0012920]: FindPythonInterp.cmake fails to find python version

Mantis Bug Tracker mantis at public.kitware.com
Mon Jan 30 11:12:59 EST 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12920 
====================================================================== 
Reported By:                Chip Christian
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12920
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-01-30 18:12 WAST
Last Modified:              2012-01-30 18:12 WAST
====================================================================== 
Summary:                    FindPythonInterp.cmake fails to find python version
Description: 
python 2.4.3 does not support a "--version" arg but *does* provide "-V"

also, as written it requires FindPackageHandleStandardArgs.cmake to be located
in the same directory for some reason

patch can be found in Additional Information

Additional Information: 
--- /usr/share/cmake/Modules/FindPythonInterp.cmake     2011-12-30
10:49:56.000000000 -0600
+++ cmake/FindPythonInterp.cmake        2012-01-30 10:04:37.000000000 -0600
@@ -51,7 +51,7 @@
 
 # determine python version string
 if(PYTHON_EXECUTABLE)
-    execute_process(COMMAND "${PYTHON_EXECUTABLE}" --version ERROR_VARIABLE
_VERSION OUTPUT_QUIET ERROR_STRIP_TRAILING_WHITESPACE)
+    execute_process(COMMAND "${PYTHON_EXECUTABLE}" -V ERROR_VARIABLE _VERSION
OUTPUT_QUIET ERROR_STRIP_TRAILING_WHITESPACE)
     string(REPLACE "Python " "" PYTHON_VERSION_STRING "${_VERSION}")
     string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1"
PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}")
     string(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1"
PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}")
@@ -60,7 +60,7 @@
 
 # handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE
if
 # all listed variables are TRUE
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+# include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE
VERSION_VAR PYTHON_VERSION_STRING)
 
 mark_as_advanced(PYTHON_EXECUTABLE)

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-01-30 18:12 Chip Christian New Issue                                    
======================================================================




More information about the cmake-developers mailing list