]> SALOME platform Git repositories - tools/configuration.git/commitdiff
Salome HOME
Python3 porting: find python with CMake-3.3 version.
authorrnv <rnv@opencascade.com>
Wed, 24 May 2017 07:33:40 +0000 (10:33 +0300)
committerrnv <rnv@opencascade.com>
Wed, 24 May 2017 07:33:40 +0000 (10:33 +0300)
cmake/FindSalomePythonInterp.cmake
cmake/SalomeMacros.cmake

index 23f229d23738db7ab5250ff673f21504a861da2b..44e0ec6ae4488558084841be365528f34347bbf8 100644 (file)
@@ -36,6 +36,11 @@ IF(EXISTS "${PYTHON_ROOT_DIR}" AND (NOT PYTHONINTERP_ROOT_DIR))
   MESSAGE(STATUS "Setting PYTHONINTERP_ROOT_DIR to: ${PYTHON_ROOT_DIR}")
   SET(PYTHONINTERP_ROOT_DIR "${PYTHON_ROOT_DIR}" CACHE PATH "Path to PythonInterp directory")
 ENDIF()
+
+# python 3
+SET(PythonInterp_FIND_VERSION 3)
+SET(PythonInterp_FIND_VERSION_MAJOR 3)
+
 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(PythonInterp PYTHON_EXECUTABLE 1)
 
 IF(SALOMEPYTHONINTERP_FOUND) 
index d2791b609acffac2f3d70c068a44f80bb75398b2..d1cefe1c4ca6655a6740cec51cfb2ec8d1e68e6d 100644 (file)
@@ -970,10 +970,17 @@ ENDMACRO(SALOME_CONFIGURE_PREPARE)
 # version 2.7.12+ and the interp is 2.7.12 ...
 #
 MACRO(SALOME_EXTRACT_VERSION version_string major minor patch)
-  IF(${version_string} MATCHES "[0-9]+[^0-9]*\\.[0-9]+[^0-9]*\\.[0-9]+[^0-9]*")
-    STRING(REGEX REPLACE "^([0-9]+)[^0-9]*\\.[0-9]+[^0-9]*\\.[0-9]+[^0-9]*" "\\1" ${major} "${version_string}")
-    STRING(REGEX REPLACE "^[0-9]+[^0-9]*\\.([0-9]+)[^0-9]*\\.[0-9]+[^0-9]*" "\\1" ${minor} "${version_string}")
-    STRING(REGEX REPLACE "^[0-9]+[^0-9]*\\.[0-9]+[^0-9]*\\.([0-9]+)[^0-9]*" "\\1" ${patch} "${version_string}")
+  IF(${version_string} MATCHES "[0-9]+[^0-9]*\\.[0-9]+[^0-9]*\\.*[0-9]*[^0-9]*")
+    STRING(REGEX REPLACE "^([0-9]+)[^0-9]*\\.[0-9]+[^0-9]*\\.*[0-9]*[^0-9]*" "\\1" ${major} "${version_string}")
+    STRING(REGEX REPLACE "^[0-9]+[^0-9]*\\.([0-9]+)[^0-9]*\\.*[0-9]*[^0-9]*" "\\1" ${minor} "${version_string}")
+
+    IF(${version_string} MATCHES "[0-9]+[^0-9]*\\.[0-9]+[^0-9]*\\.[0-9]+[^0-9]*")
+        # X.Y.Z format (python 3.5.2 ...)
+        STRING(REGEX REPLACE "^[0-9]+[^0-9]*\\.[0-9]+[^0-9]*\\.([0-9]+)[^0-9]*" "\\1" ${patch} "${version_string}")
+    ELSE()
+        # X.Y format (python 3.5 ...)
+        SET(${patch} "0")
+    ENDIF()
   ELSE()
     MESSAGE("MACRO(SALOME_EXTRACT_VERSION ${version_string} ${major} ${minor} ${patch}")
     MESSAGE(FATAL_ERROR "Problem parsing version string, I can't parse it properly.")