12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- From: Paul Zander <negril.nx+gentoo@gmail.com>
- python-2 is dead, don't check for it.
- diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake
- index a6aacb4..d893486 100644
- --- a/cmake/OpenCVDetectPython.cmake
- +++ b/cmake/OpenCVDetectPython.cmake
- @@ -85,11 +85,7 @@ if(NOT ${found})
- endif()
- ocv_clear_vars(PYTHONINTERP_FOUND PYTHON_EXECUTABLE PYTHON_VERSION_STRING PYTHON_VERSION_MAJOR PYTHON_VERSION_MINOR PYTHON_VERSION_PATCH)
- if(NOT CMAKE_VERSION VERSION_LESS "3.12")
- - if(_python_version_major STREQUAL "2")
- - set(__PYTHON_PREFIX Python2)
- - else()
- - set(__PYTHON_PREFIX Python3)
- - endif()
- + set(__PYTHON_PREFIX Python3)
- find_host_package(${__PYTHON_PREFIX} "${preferred_version}" COMPONENTS Interpreter)
- if(${__PYTHON_PREFIX}_EXECUTABLE)
- set(PYTHON_EXECUTABLE "${${__PYTHON_PREFIX}_EXECUTABLE}")
- @@ -208,9 +204,6 @@ if(NOT ${found})
- if(CMAKE_CROSSCOMPILING)
- message(STATUS "Cannot probe for Python/Numpy support (because we are cross-compiling OpenCV)")
- message(STATUS "If you want to enable Python/Numpy support, set the following variables:")
- - message(STATUS " PYTHON2_INCLUDE_PATH")
- - message(STATUS " PYTHON2_LIBRARIES (optional on Unix-like systems)")
- - message(STATUS " PYTHON2_NUMPY_INCLUDE_DIRS")
- message(STATUS " PYTHON3_INCLUDE_PATH")
- message(STATUS " PYTHON3_LIBRARIES (optional on Unix-like systems)")
- message(STATUS " PYTHON3_NUMPY_INCLUDE_DIRS")
- @@ -268,20 +261,6 @@ if(OPENCV_PYTHON_SKIP_DETECTION)
- return()
- endif()
-
- -ocv_check_environment_variables(OPENCV_ENABLE_PYTHON2)
- -ocv_check_environment_variables(PYTHON2_EXECUTABLE)
- -if((OPENCV_ENABLE_PYTHON2 OR PYTHON2_EXECUTABLE OR BUILD_opencv_python2)
- - AND NOT OPENCV_PYTHON2_SKIP_DETECTION
- -)
- - find_python("" "${MIN_VER_PYTHON2}" PYTHON2_LIBRARY PYTHON2_INCLUDE_DIR
- - PYTHON2INTERP_FOUND PYTHON2_EXECUTABLE PYTHON2_VERSION_STRING
- - PYTHON2_VERSION_MAJOR PYTHON2_VERSION_MINOR PYTHON2LIBS_FOUND
- - PYTHON2LIBS_VERSION_STRING PYTHON2_LIBRARIES PYTHON2_LIBRARY
- - PYTHON2_DEBUG_LIBRARIES PYTHON2_LIBRARY_DEBUG PYTHON2_INCLUDE_PATH
- - PYTHON2_INCLUDE_DIR PYTHON2_INCLUDE_DIR2 PYTHON2_PACKAGES_PATH
- - PYTHON2_NUMPY_INCLUDE_DIRS PYTHON2_NUMPY_VERSION)
- -endif()
- -
- option(OPENCV_PYTHON3_VERSION "Python3 version" "")
- find_python("${OPENCV_PYTHON3_VERSION}" "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR
- PYTHON3INTERP_FOUND PYTHON3_EXECUTABLE PYTHON3_VERSION_STRING
- @@ -294,12 +273,8 @@ find_python("${OPENCV_PYTHON3_VERSION}" "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYT
-
- if(PYTHON_DEFAULT_EXECUTABLE)
- set(PYTHON_DEFAULT_AVAILABLE "TRUE")
- -elseif(PYTHON2_EXECUTABLE AND PYTHON2INTERP_FOUND)
- - # Use Python 2 as default Python interpreter
- - set(PYTHON_DEFAULT_AVAILABLE "TRUE")
- - set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON2_EXECUTABLE}")
- elseif(PYTHON3_EXECUTABLE AND PYTHON3INTERP_FOUND)
- - # Use Python 3 as fallback Python interpreter (if there is no Python 2)
- + # Use Python 3 as Python interpreter (there is no Python 2)
- set(PYTHON_DEFAULT_AVAILABLE "TRUE")
- set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON3_EXECUTABLE}")
- endif()
|