[cmake-developers] [CMake 0013818]: FindPythonInterp finds a cygwin symlink which can't be used with execute_process

Mantis Bug Tracker mantis at public.kitware.com
Fri Dec 28 15:04:26 EST 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13818 
====================================================================== 
Reported By:                Reid Kleckner
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13818
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-12-28 15:04 EST
Last Modified:              2012-12-28 15:04 EST
====================================================================== 
Summary:                    FindPythonInterp finds a cygwin symlink which can't
be used with execute_process
Description: 
I'm using native Windows CMake from a Cygwin shell, so Cygwin Python is on my
PATH.  My /usr/bin looks like:
$ ll /usr/bin/python*
lrwxrwxrwx 1 rnk Domain Users   13 Aug 20 18:35 /usr/bin/python -> python2.6.exe
-rwxr-xr-x 1 rnk Domain Users 4622 Jun  9  2012 /usr/bin/python2.6.exe
-rwxr-xr-x 1 rnk Domain Users 1419 Jun  9  2012 /usr/bin/python2.6-config
lrwxrwxrwx 1 rnk Domain Users   16 Aug 20 18:35 /usr/bin/python-config ->
python2.6-config

FindPythonInterp.cmake uses find_program() with "python" first, which succeeds.

This is a reasonable result to return, but then execute_process fails on the
Cygwin symlink file.  It doesn't seem reasonable for native Windows CMake to
know how to follow Cygwin symlinks, so maybe find_program should fail on such
symlinks, or FindPythonInterp should test that it can actually execute the
python executable, and fall back to its version based queries.

As a workaround, it's pretty easy for me to point it at the right executable.

Steps to Reproduce: 
Install or build native Windows CMake
In a Cygwin shell, run cmake on this script:

include(FindPythonInterp)
if( NOT PYTHONINTERP_FOUND )
  message(FATAL_ERROR "can't find python")
endif ()

execute_process(
  COMMAND ${PYTHON_EXECUTABLE} -c "print \"hello\"" RESULT_VARIABLE result)
if (NOT "${result}" STREQUAL "0")
  message(FATAL_ERROR "PYTHON_EXECUTABLE failed, is it a symlink?")
endif ()

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-12-28 15:04 Reid Kleckner  New Issue                                    
======================================================================




More information about the cmake-developers mailing list