From 904332c7ba8b66877b8ca56e43ed2e5cfdbc661b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 28 Oct 2010 10:26:12 -0700 Subject: uhd: added to python module check macro, move check to lib dir --- host/config/Python.cmake | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'host/config/Python.cmake') diff --git a/host/config/Python.cmake b/host/config/Python.cmake index 55ef6acca..a5080fc40 100644 --- a/host/config/Python.cmake +++ b/host/config/Python.cmake @@ -24,26 +24,23 @@ IF(NOT PYTHONINTERP_FOUND) MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.") ENDIF(NOT PYTHONINTERP_FOUND) -MACRO(PYTHON_CHECK_MODULE module have) - MESSAGE(STATUS "Checking for python module ${module}") +MACRO(PYTHON_CHECK_MODULE desc mod cmd have) + MESSAGE(STATUS "Python checking for ${desc}") EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "import ${module}" + COMMAND ${PYTHON_EXECUTABLE} -c " +######################################### +try: import ${mod} +except: exit(-1) +try: assert ${cmd} +except: exit(-1) +#########################################" RESULT_VARIABLE ${have} ) IF(${have} EQUAL 0) - MESSAGE(STATUS "Checking for python module ${module} - found") + MESSAGE(STATUS "Python checking for ${desc} - found") SET(${have} TRUE) ELSE(${have} EQUAL 0) - MESSAGE(STATUS "Checking for python module ${module} - not found") + MESSAGE(STATUS "Python checking for ${desc} - not found") SET(${have} FALSE) ENDIF(${have} EQUAL 0) ENDMACRO(PYTHON_CHECK_MODULE) - -######################################################################## -# Check Modules -######################################################################## -PYTHON_CHECK_MODULE("Cheetah" HAVE_PYTHON_MODULE_CHEETAH) - -IF(NOT HAVE_PYTHON_MODULE_CHEETAH) - MESSAGE(FATAL_ERROR "Error: Cheetah Templates required by the build system.") -ENDIF(NOT HAVE_PYTHON_MODULE_CHEETAH) -- cgit v1.2.3 From 9d50dea1c2f884835b606ccaa1444e5de96926cb Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 5 Nov 2010 16:09:49 -0700 Subject: uhd: dont check for python interp if PYTHON_EXECUTABLE specified --- host/config/Python.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'host/config/Python.cmake') diff --git a/host/config/Python.cmake b/host/config/Python.cmake index a5080fc40..95cdb4479 100644 --- a/host/config/Python.cmake +++ b/host/config/Python.cmake @@ -18,11 +18,13 @@ ######################################################################## # Setup Python ######################################################################## -INCLUDE(FindPythonInterp) +IF(NOT DEFINED PYTHON_EXECUTABLE) + INCLUDE(FindPythonInterp) -IF(NOT PYTHONINTERP_FOUND) - MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.") -ENDIF(NOT PYTHONINTERP_FOUND) + IF(NOT PYTHONINTERP_FOUND) + MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.") + ENDIF(NOT PYTHONINTERP_FOUND) +ENDIF(NOT DEFINED PYTHON_EXECUTABLE) MACRO(PYTHON_CHECK_MODULE desc mod cmd have) MESSAGE(STATUS "Python checking for ${desc}") -- cgit v1.2.3