From 70392d37c572ee94ff7a72e35e02f11404c532fd Mon Sep 17 00:00:00 2001 From: Jaroslav Skarvada Date: Mon, 23 Apr 2012 10:51:36 -0700 Subject: cmake: fix pygtk check failure with no X session This change makes python module checking more robust by preventing cmake failure when unexpected exceptions occur. --- cmake/Modules/GrPython.cmake | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'cmake/Modules') diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake index eff9cbcdc..14f2b29cd 100644 --- a/cmake/Modules/GrPython.cmake +++ b/cmake/Modules/GrPython.cmake @@ -76,12 +76,11 @@ macro(GR_PYTHON_CHECK_MODULE desc mod cmd have) execute_process( COMMAND ${PYTHON_EXECUTABLE} -c " ######################################### -try: import ${mod} -except: - try: ${mod} - except: exit(-1) -try: assert ${cmd} -except: exit(-1) +try: + import ${mod} + assert ${cmd} +except ImportError, AssertionError: exit(-1) +except: pass #########################################" RESULT_VARIABLE ${have} ) -- cgit