From 4da4a558a9632c09ae834f7f4e14b9c4e8eedf0b Mon Sep 17 00:00:00 2001 From: Miguel Angel Ajo Date: Wed, 12 Feb 2014 22:17:19 +0100 Subject: [PATCH] Enforces python2.6 / 2.7, thanks to orsonmmz --- CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84ec69197f..44e56d5c72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -513,18 +513,24 @@ set( INC_AFTER # Find Python and other scripting resources if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) - if( NOT APPLE ) - set( PythonInterp_FIND_VERSION ) - else() + if( APPLE ) set( PYTHON_LIBRARY /System/Library/Frameworks/Python.framework/Versions/2.6/Python ) set( PYTHON_INCLUDE_DIR /System/Library/Frameworks/Python.framework/Versions//2.6/include/python2.6 ) set( PythonInterp_FIND_VERSION 2.6 ) set( PythonLibs_FIND_VERSION 2.6 ) endif() + + # force a python version < 3.0 + set( PythonInterp_FIND_VERSION 2.6) + set( PythonLibs_FIND_VERSION 2.6 ) find_package( PythonInterp ) + check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" ) - + + if( NOT PYTHON_VERSION_MAJOR EQUAL 2 ) + message( FATAL_ERROR "Python 2.x is required." ) + endif() # Get the correct Python site package install path from the Python interpreter found by # FindPythonInterp unless the user specifically defined a custom path. if( NOT PYTHON_SITE_PACKAGE_PATH ) @@ -542,7 +548,7 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) mark_as_advanced( PYTHON_DEST ) message( STATUS "Python module install path: ${PYTHON_DEST}" ) - find_package( PythonLibs ) + find_package( PythonLibs 2.6 ) #message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )