From: Kefu Chai Date: Mon, 22 Jul 2019 02:04:58 +0000 (+0800) Subject: cmake: use python2 by default X-Git-Tag: v15.1.0~2099^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=492efbd6948761a64b3a452850cfd700a614f7a9;p=ceph-ci.git cmake: use python2 by default and s/PYTHON_EXECUTABLE/Python_EXECUTABLE/ it's a regression introduced by 5e2bd7fc4dd6d137cf67336d568da5b0d568efca Signed-off-by: Kefu Chai --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5df2dc47eb2..b533465b9c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -497,7 +497,7 @@ option(WITH_CEPHFS "CephFS is enabled" ON) 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 diff --git a/cmake/modules/AddCephTest.cmake b/cmake/modules/AddCephTest.cmake index 8022dbb1d06..9d92ec54f34 100644 --- a/cmake/modules/AddCephTest.cmake +++ b/cmake/modules/AddCephTest.cmake @@ -37,7 +37,7 @@ if(WITH_GTEST_PARALLEL) 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 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c89b05c5106..d1334bda844 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -251,6 +251,17 @@ if(WITH_PYTHON2) 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") diff --git a/src/ceph-crash.in b/src/ceph-crash.in index 5bfb50c474b..676f767eea7 100755 --- a/src/ceph-crash.in +++ b/src/ceph-crash.in @@ -1,4 +1,4 @@ -#!@PYTHON_EXECUTABLE@ +#!@Python_EXECUTABLE@ # -*- mode:python -*- # vim: ts=4 sw=4 smarttab expandtab diff --git a/src/ceph.in b/src/ceph.in index 78529616820..6086c432d6d 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -1,4 +1,4 @@ -#!@PYTHON_EXECUTABLE@ +#!@Python_EXECUTABLE@ # -*- mode:python -*- # vim: ts=4 sw=4 smarttab expandtab # @@ -66,7 +66,7 @@ DEVMODEMSG = '*** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH * 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"