Commit 9600aa45 authored by Dylan Baker's avatar Dylan Baker Committed by Dylan Baker

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: default avatarDylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Jose Fonseca's avatarJose Fonseca <jfonseca@vmware.com>
parent ee8579b4
......@@ -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
)
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment