option(WITH_MGR "ceph-mgr is enabled" ON)
if(WITH_MGR)
# Please specify 3 or 3.[0-7] if you want to build with python3 support.
- # FindPyhonInterp and FindPythonLibs think they belong to different families.
+ # FindPython thinks they belong to different families.
set(MGR_PYTHON_VERSION "2.7" CACHE
STRING "minimal required version of python runtime for running mgr plugins. ")
find_package(Python ${MGR_PYTHON_VERSION} REQUIRED
add_dependencies(tests gtest-parallel_ext)
find_package(Python REQUIRED)
set(GTEST_PARALLEL_COMMAND
- ${PYTHON_EXECUTABLE} ${gtest_parallel_source_dir}/gtest-parallel)
+ ${Python_EXECUTABLE} ${gtest_parallel_source_dir}/gtest-parallel)
endif()
#sets uniform compiler flags and link libraries
else()
set(PY_BINDING_INFIX 3)
endif()
+# use python2 by default for python bindings, tools and tests, before
+# switching to python3
+# Python_EXECUTABLE` can be set by `find_package(Python ...)` also. and we do
+# call `find_package(Python ...)` in `ceph/CMakeLists.txt`. but we do so before
+# `add_subdirectory(src)` where `Python_EXECUTABLE` is set. so it's safe to
+# use this variable name and call `find_package(Python ...)`.
+if(WITH_PYTHON2)
+ set(Python_EXECUTABLE ${Python2_EXECUTABLE})
+else()
+ set(Python_EXECUTABLE ${Python3_EXECUTABLE})
+endif()
# sort out which allocator to use
if(ALLOCATOR STREQUAL "tcmalloc")
-#!@PYTHON_EXECUTABLE@
+#!@Python_EXECUTABLE@
# -*- mode:python -*-
# vim: ts=4 sw=4 smarttab expandtab
-#!@PYTHON_EXECUTABLE@
+#!@Python_EXECUTABLE@
# -*- mode:python -*-
# vim: ts=4 sw=4 smarttab expandtab
#
def respawn_in_path(lib_path, pybind_path, pythonlib_path, asan_lib_path):
execv_cmd = []
if 'CEPH_DBG' in os.environ:
- execv_cmd += ['@PYTHON_EXECUTABLE@', '-mpdb']
+ execv_cmd += ['@Python_EXECUTABLE@', '-mpdb']
if platform.system() == "Darwin":
lib_path_var = "DYLD_LIBRARY_PATH"