From bbff2884473f8eed2de0b40d50586bb45c9a6680 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 26 Aug 2015 13:07:37 +0300 Subject: [PATCH] fix build with python3 only --- cmake/OpenCVDetectPython.cmake | 9 +++++++-- modules/java/generator/gen_java.py | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake index 4bca7bd932..7f93d3458a 100644 --- a/cmake/OpenCVDetectPython.cmake +++ b/cmake/OpenCVDetectPython.cmake @@ -232,8 +232,13 @@ find_python(3.4 "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR PYTHON3_INCLUDE_DIR PYTHON3_INCLUDE_DIR2 PYTHON3_PACKAGES_PATH PYTHON3_NUMPY_INCLUDE_DIRS PYTHON3_NUMPY_VERSION) -# Use Python 2 as default Python interpreter -if(PYTHON2INTERP_FOUND) + +if(PYTHON_DEFAULT_EXECUTABLE) + set(PYTHON_DEFAULT_AVAILABLE "TRUE") +elseif(PYTHON2INTERP_FOUND) # Use Python 2 as default Python interpreter set(PYTHON_DEFAULT_AVAILABLE "TRUE") set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON2_EXECUTABLE}") +elseif(PYTHON3INTERP_FOUND) # Use Python 2 as fallback Python interpreter (if there is no Python 2) + set(PYTHON_DEFAULT_AVAILABLE "TRUE") + set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON3_EXECUTABLE}") endif() diff --git a/modules/java/generator/gen_java.py b/modules/java/generator/gen_java.py index bfb585bf8f..649059d285 100755 --- a/modules/java/generator/gen_java.py +++ b/modules/java/generator/gen_java.py @@ -924,6 +924,10 @@ class FuncInfo(GeneralInfo): def __repr__(self): return Template("FUNC <$ctype $namespace.$classpath.$name $args>").substitute(**self.__dict__) + def __lt__(self, other): + return self.__repr__() < other.__repr__() + + class JavaWrapperGenerator(object): def __init__(self): self.clear()