From dafaa397d3323e08f6fa4dd4d78ba9d9b48c99cf Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Wed, 20 Mar 2024 09:30:12 +0100 Subject: [PATCH] Remove distutils usage to detect numpy include dirs Allow to remove this cmake warning on macos: -- Found PythonLibs: /opt/homebrew/Frameworks/Python.framework/Versions/3.12/lib/libpython3.12.dylib (found suitable exact version "3.12.1") Traceback (most recent call last): File "", line 1, in AttributeError: module 'numpy.distutils' has no attribute 'misc_util' --- cmake/VISPDetectPython.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/VISPDetectPython.cmake b/cmake/VISPDetectPython.cmake index 7601715c3c..f5ac45b910 100644 --- a/cmake/VISPDetectPython.cmake +++ b/cmake/VISPDetectPython.cmake @@ -209,11 +209,10 @@ if(NOT ${found}) message(STATUS " PYTHON3_NUMPY_INCLUDE_DIRS") else() # Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy - execute_process(COMMAND "${_executable}" -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print(os.pathsep.join(numpy.distutils.misc_util.get_numpy_include_dirs()))" + execute_process(COMMAND "${_executable}" -c "import numpy; print(numpy.get_include())" RESULT_VARIABLE _numpy_process OUTPUT_VARIABLE _numpy_include_dirs OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT _numpy_process EQUAL 0) unset(_numpy_include_dirs) endif()