kou commented on code in PR #43606: URL: https://github.com/apache/arrow/pull/43606#discussion_r1712490057
########## cpp/cmake_modules/UseCython.cmake: ########## @@ -184,4 +184,24 @@ function(cython_add_module _name pyx_target_name generated_files) add_dependencies(${_name} ${pyx_target_name}) endfunction() +execute_process(COMMAND ${PYTHON_EXECUTABLE} -m cython --version + OUTPUT_VARIABLE CYTHON_version_output + ERROR_VARIABLE CYTHON_version_error + RESULT_VARIABLE CYTHON_version_result + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE) +if(NOT ${CYTHON_version_result} EQUAL 0) + set(_error_msg "Command \"${PYTHON_EXECUTABLE} -m cython --version\" failed with") + set(_error_msg "${_error_msg} output:\n${CYTHON_version_error}") + message(SEND_ERROR "${_error_msg}") +else() + if("${CYTHON_version_output}" MATCHES "^[Cc]ython version ([^,]+)") + set(CYTHON_VERSION "${CMAKE_MATCH_1}") + else() + if("${CYTHON_version_error}" MATCHES "^[Cc]ython version ([^,]+)") + set(CYTHON_VERSION "${CMAKE_MATCH_1}") + endif() + endif() +endif() Review Comment: > However, we'll still need CMake code to get the Python version I think that we can use `Python_VERSION` defined by CMake's `FindPython.cmake` instead of getting it by ourselves: https://cmake.org/cmake/help/latest/module/FindPython.html#result-variables > Replacing the `set(CYTHON_VERSION "")` with an error message does not look like an additional maintenance burden, does it? The following is my concern of it: https://github.com/apache/arrow/pull/43606#discussion_r1709715060 > If Cython changes `cython --version format`, PyArrow build will be failed with the latest Cython until we release a new PyArrow version with the latest Cython support. (FYI: I don't object strict version detection if there are people who will maintain it. If nobody will not do it, I'll do it.) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org