From dcad06c77ee5bc514d729d9a01c4d8a6f4fd5d21 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 19 Oct 2024 10:03:56 +0200 Subject: [PATCH] details about module search path on failure --- cmake/MakePythonWheel.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmake/MakePythonWheel.cmake b/cmake/MakePythonWheel.cmake index 4579bf2b5..805669646 100644 --- a/cmake/MakePythonWheel.cmake +++ b/cmake/MakePythonWheel.cmake @@ -9,7 +9,19 @@ function( MakeWheel python_module) cmake_parse_arguments(MAKEWHEEL "PRINT_HELP" "MODULE;VERSION;SUMMARY;DESCRIPTION;HOMEPAGE;AUTHOR;EMAIL;LICENCE" "REQUIRES" ${ARGN} ) set(version ${MAKEWHEEL_VERSION}) - execute_process(COMMAND ${Python3_EXECUTABLE} -c "import setuptools" ERROR_QUIET RESULT_VARIABLE has_setuptools) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c " +import sys +try: + import setuptools + sys.exit(0) +except ImportError as e: + print(f'{e}. Search paths:', file=sys.stderr) + for p in sys.path: print(f' {p}', file=sys.stderr) + sys.exit(1) +" + ERROR_QUIET RESULT_VARIABLE has_setuptools) + if(has_setuptools EQUAL "1") message(FATAL_ERROR "Python module `setuptools` required for correct wheel filename generation.") endif()