diff options
author | Dylan Baker <dylanx.c.baker@intel.com> | 2014-12-11 13:28:29 -0800 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2015-01-19 10:16:47 -0800 |
commit | 9600aa4557d1494658a45168220e1e97197a48ce (patch) | |
tree | c5f2621fe82cf4781a82d85d04e9db7a62918112 | |
parent | ee8579b452f0a6e59b1dd879b50715a83554fafc (diff) |
cmake: use cmake builtin python module
This removes a bunch of code that we rolled for finding python
interpreters, and uses the cmake builtins.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
-rw-r--r-- | CMakeLists.txt | 22 | ||||
-rw-r--r-- | cmake/Modules/PiglitFindMako.cmake | 2 | ||||
-rw-r--r-- | cmake/piglit_dispatch.cmake | 2 | ||||
-rw-r--r-- | generated_tests/CMakeLists.txt | 2 |
4 files changed, 6 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 301222240..ac4ba1b34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,28 +187,12 @@ IF(PIGLIT_BUILD_GLX_TESTS) pkg_check_modules(GLPROTO REQUIRED glproto) ENDIF() -# Check for presence of Python 2.7 or greater. -foreach(python_cmd python2 python) - execute_process( - COMMAND ${python_cmd} -c "import sys; assert '2.7' <= sys.version < '3'" - OUTPUT_QUIET - ERROR_QUIET - RESULT_VARIABLE python_version_check_error_code) - if(python_version_check_error_code EQUAL 0) - set(python ${python_cmd}) - break() - endif(python_version_check_error_code EQUAL 0) -endforeach(python_cmd) - -if(NOT DEFINED python) - message(FATAL_ERROR "python version 2.7 required") -endif(NOT DEFINED python) - +FIND_PACKAGE(PythonInterp 2.7 REQUIRED) include(PiglitFindMako) # Require numpy execute_process( - COMMAND ${python} -c "import numpy" + COMMAND ${PYTHON_EXECUTABLE} -c "import numpy" OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE import_numpy_error_code) @@ -507,7 +491,7 @@ set (CPACK_PACKAGE_VERSION_MINOR "0") # Use current date in YYYYMMDD format as patch number execute_process ( - COMMAND ${python} -c "import time, sys; sys.stdout.write(time.strftime('%Y%m%d'))" + COMMAND ${PYTHON_EXECUTABLE} -c "import time, sys; sys.stdout.write(time.strftime('%Y%m%d'))" OUTPUT_VARIABLE CPACK_PACKAGE_VERSION_PATCH ) diff --git a/cmake/Modules/PiglitFindMako.cmake b/cmake/Modules/PiglitFindMako.cmake index eaca60180..0637d30df 100644 --- a/cmake/Modules/PiglitFindMako.cmake +++ b/cmake/Modules/PiglitFindMako.cmake @@ -57,7 +57,7 @@ if(MAKO_VERSION VERSION_LESS MAKO_REQUIRED_VERSION) set(MAKO_VERSION "MAKO_VERSION-NOTFOUND") execute_process( - COMMAND ${python} -c "${__MAKO_CHECK_VERSION_PY}" + COMMAND ${PYTHON_EXECUTABLE} -c "${__MAKO_CHECK_VERSION_PY}" OUTPUT_VARIABLE __MAKO_ACTUAL_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_VARIABLE __MAKO_STDERR diff --git a/cmake/piglit_dispatch.cmake b/cmake/piglit_dispatch.cmake index 93d6a3a2b..f685900ef 100644 --- a/cmake/piglit_dispatch.cmake +++ b/cmake/piglit_dispatch.cmake @@ -43,7 +43,7 @@ set(piglit_dispatch_gen_depends add_custom_command( OUTPUT ${piglit_dispatch_gen_outputs} DEPENDS ${piglit_dispatch_gen_depends} - COMMAND ${python} ${piglit_dispatch_gen_script} --out-dir ${piglit_dispatch_gen_output_dir} + COMMAND ${PYTHON_EXECUTABLE} ${piglit_dispatch_gen_script} --out-dir ${piglit_dispatch_gen_output_dir} ) add_custom_target(piglit_dispatch_gen diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt index 57beb3e77..46617a6bd 100644 --- a/generated_tests/CMakeLists.txt +++ b/generated_tests/CMakeLists.txt @@ -13,7 +13,7 @@ function(piglit_make_generated_tests file_list generator_script) # during the build. add_custom_command( OUTPUT ${file_list} - COMMAND ${python} ${CMAKE_CURRENT_SOURCE_DIR}/${generator_script} > ${file_list} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${generator_script} > ${file_list} DEPENDS ${generator_script} ${ARGN} VERBATIM) endfunction(piglit_make_generated_tests custom_target generator_script) |