]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake/modules: use exact version of python3 when finding cython 45967/head
authorKefu Chai <tchaikov@gmail.com>
Wed, 20 Apr 2022 22:31:21 +0000 (06:31 +0800)
committerKefu Chai <tchaikov@gmail.com>
Thu, 21 Apr 2022 23:12:48 +0000 (07:12 +0800)
* CMakeLists.txt:
    always pass "EXACT" to find_package(Python3).
    because per cmake document, "EXACT" only takes effect when
    <Package>_FIND_VERSION_COUNT is greater than 1, where <Package>
    is "Python3". see also cmake/modules/FindPython/Support.cmake
* cmake/modules/AddCephTest.cmake:
    drop redundant find_package(Python3) calls. since Python3 is
    a mandatory requirement for building Ceph, we only need a
    single call of find_package(Python3..) in the top of the source
    tree. the only possible case to repeat it is to ensure that we
    have the correct version of Python3 used in following CMake
    script. but there is no need to repeat it if we just want to
    ensure that we have a python3 interpretor in place.
* cmake/modules/Distutils.cmake:
    always pass "EXACT" to find_package(Python3).
    we should always pass EXACT to find_package() when finding python3,
    this is a follow-up of e2babdfae8c99f39f99a7c8a8f966299b2e62b19

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
(cherry picked from commit ea4ae6d2f17ae8dcfb3d6f215d53b3f82a99270d)

Conflicts:
cmake/modules/AddCephTest.cmake: trivial resolutions

CMakeLists.txt
cmake/modules/AddCephTest.cmake
cmake/modules/Distutils.cmake

index 12672dbccfe74a2cded7e7d032411bf243c2a48d..d8b6e0038f2b95fba9933cde2c48d0d5218fa640 100644 (file)
@@ -474,12 +474,8 @@ option(WITH_CEPHFS "CephFS is enabled" ON)
 if(NOT WIN32)
 # Please specify 3.[0-7] if you want to build with a certain version of python3.
 set(WITH_PYTHON3 "3" CACHE STRING "build with specified python3 version")
-if(NOT WITH_PYTHON3 STREQUAL "3")
-  set(find_python3_exact "EXACT")
-endif()
-find_package(Python3 ${WITH_PYTHON3} ${find_python3_exact} REQUIRED
+find_package(Python3 ${WITH_PYTHON3} EXACT REQUIRED
   COMPONENTS Interpreter Development)
-unset(find_python3_exact)
 
 option(WITH_MGR "ceph-mgr is enabled" ON)
 if(WITH_MGR)
index d26d003c779b7b8c565f0d80f1004b556913af5b..cd661be16c91dd2e481a579030c7392d56bed9d9 100644 (file)
@@ -37,7 +37,6 @@ if(WITH_GTEST_PARALLEL)
       BUILD_COMMAND ""
       INSTALL_COMMAND "")
     add_dependencies(tests gtest-parallel_ext)
-    find_package(Python3 QUIET REQUIRED)
     set(GTEST_PARALLEL_COMMAND
       ${Python3_EXECUTABLE} ${gtest_parallel_source_dir}/gtest-parallel)
   endif()
@@ -69,7 +68,6 @@ function(add_tox_test name)
     list(APPEND tox_envs py3)
   endif()
   string(REPLACE ";" "," tox_envs "${tox_envs}")
-  find_package(Python3 QUIET REQUIRED)
   add_custom_command(
     OUTPUT ${venv_path}/bin/activate
     COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python="${Python3_EXECUTABLE}" ${venv_path}
index f93c12609bb0ebd5cf945a19bf3b8cc7c07f73be..01a6fc500c8670f5550d6a88310be1fd50df558c 100644 (file)
@@ -6,7 +6,7 @@ include(CMakeParseArguments)
 # the building host happens to have a higher version of python3, that version
 # would be picked up instead by find_package(Python3). and that is not want we
 # expect.
-find_package(Python3 ${WITH_PYTHON3}
+find_package(Python3 ${WITH_PYTHON3} EXACT
   QUIET
   REQUIRED
   COMPONENTS Interpreter)