From fb5f40339b1e41767477490158b2d7f0e3f4b042 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 27 Apr 2023 11:20:41 +0200 Subject: [PATCH 1/2] changed: only search for Development.Module if not building embedded python the embedding headers are not available on the manylinux2014 containers used to build the pypi packages. since this is anyways more correct fix it this way --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae969304b..7cc8d24b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -218,8 +218,10 @@ if (OPM_ENABLE_PYTHON) endif() # We always need to search for Development as we use # pybind11_add_module even if don't embed Python - find_package(Python3 REQUIRED COMPONENTS Interpreter Development) - if (OPM_ENABLE_EMBEDDED_PYTHON) + if (NOT OPM_ENABLE_EMBEDDED_PYTHON) + find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) + else() + find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Embed Development.Module) get_target_property(_lib_path Python3::Python IMPORTED_LOCATION) set(PYTHON_LIBRARY ${_lib_path}) set(PYTHON_LIBRARIES {PYTHON_LIBRARY}) From 7cd35f44773a73a4d3cbc4108012d8dca05b6036 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 27 Apr 2023 11:22:29 +0200 Subject: [PATCH 2/2] fixed: setuptools are no longer required to build the python bindings only required if building packages for pypi, which is done separately from the main buildsystem. --- CMakeLists.txt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cc8d24b9..6468fe5c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,17 +228,6 @@ if (OPM_ENABLE_PYTHON) list(APPEND opm-common_LIBRARIES ${PYTHON_LIBRARY}) set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS}) endif() - # Make sure we fail gracefully here without setuptool - execute_process(COMMAND ${Python3_EXECUTABLE} -c "import setuptools" - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - ERROR_VARIABLE SETUPTOOL_ERROR OUTPUT_VARIABLE SETUPTOOL_OUT - RESULT_VARIABLE SETUPTOOL_RESULT) - if(SETUPTOOL_RESULT GREATER 0) - message(WARNING "Trying to test setuptools resulted in error message: ${SETUPTOOL_ERROR}") - message(SEND_ERROR "To build the python bindings you need to install setuptool. " - "Either use \"apt-get install python3-setuptools\" (on Debian/Ubuntu) " - "or \"pip install setuptools\"") - endif() if(Python3_VERSION_MINOR LESS 3) # Python native namespace packages requires python >= 3.3 message(SEND_ERROR "OPM requires python >= 3.3 but only version ${Python3_VERSION} was found")