]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake: use specified python3 version if any
authorKefu Chai <kchai@redhat.com>
Thu, 4 Apr 2019 03:37:00 +0000 (11:37 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 4 Apr 2019 05:30:48 +0000 (13:30 +0800)
use might have multiple python3 installed, some of them has/have all
dependencies installed and is good enough for building Ceph. we should
not always use the latest python installed in the system and complain that
there is missing dependencies, even if user has installed all the
python3 dependencies for the older python3.

put in other words, if user only installs cython module for python3.4, but
she has both python3.6 and python3.4 in her system. we should not force
her to uninstall python3.6 for installing Ceph.

this change also aligns with MGR_PYTHON_VERSION. i am not applying the
same change to WITH_PYTHON2, because python2 is already stablized. and distros
are not likely to release new python2 releases.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/CMakeLists.txt

index d356eb7fc2ce7f8d78a14229a5c43449150744db..93a5ccc7e6b1943912283e1df33e7c703ac00962 100644 (file)
@@ -223,10 +223,13 @@ if(WITH_PYTHON2)
   find_package(PythonLibs 2 REQUIRED)
 endif()
 
-option(WITH_PYTHON3 "build python3 bindings" OFF)
+set(WITH_PYTHON3 "OFF" CACHE STRING "build python3 bindings with specified python3 version")
 if(WITH_PYTHON3)
-  find_package(Python3Interp 3 REQUIRED)
-  find_package(Python3Libs 3 REQUIRED)
+  if(WITH_PYTHON3 MATCHES "^(1|ON|YES|TRUE|Y)$")
+    set(WITH_PYTHON3 "3")
+  endif()
+  find_package(Python3Interp ${WITH_PYTHON3} REQUIRED)
+  find_package(Python3Libs ${WITH_PYTHON3} REQUIRED)
 endif()
 
 # the major version of the python bindings as a dependency of other