]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake: drop WITH_PYTHON2 option
authorKefu Chai <kchai@redhat.com>
Wed, 18 Dec 2019 09:08:21 +0000 (17:08 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 19 Dec 2019 02:58:58 +0000 (10:58 +0800)
* drop WITH_PYTHON2 option
* print warning message if WITH_PYTHON3 is disabled
* drop MGR_PYTHON_VERSION option, as we don't support use different
  python version for python binding and ceph-mgr embedded python
  interpreter anymore. as before switching to python3-only build,
  we can build python3 and python2 python bindings, and ceph-mgr
  can use either of them. but after switching to python3-only
  build, ceph-mgr has to use whatever python version used to
  build python binding.
* move WITH_PYTHON3 option to $top_srcdir/CMakeLists.txt, as ceph-mgr
  and python binding will share this option.
* hardware ${PYTHON_VERSION} to 3
* hardware ${Python${PYTHON_VERSION}_VERSION_MAJOR} to 3
* only build boost library with python3
* s/Python_EXECUTABLE/Python3_EXECUTABLE/
* update the build scripts and packagings accordingly
* rename all cython${PYTHON_VERSION}_* targets to cython_*
* update distutils_install_module() so it does not take python_version
  parameter anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
23 files changed:
CMakeLists.txt
ceph.spec.in
cmake/modules/AddCephTest.cmake
cmake/modules/BuildBoost.cmake
cmake/modules/Distutils.cmake
cmake/modules/FindCython.cmake
debian/rules
do_cmake.sh
run-make-check.sh
src/CMakeLists.txt
src/ceph-crash.in
src/ceph-volume/CMakeLists.txt
src/ceph-volume/plugin/zfs/CMakeLists.txt
src/ceph.in
src/mgr/CMakeLists.txt
src/pybind/CMakeLists.txt
src/pybind/cephfs/CMakeLists.txt
src/pybind/mgr/dashboard/HACKING.rst
src/pybind/rados/CMakeLists.txt
src/pybind/rbd/CMakeLists.txt
src/python-common/CMakeLists.txt
src/test/CMakeLists.txt
src/tools/cephfs/CMakeLists.txt

index bab40cc4965d0dbd052c6e5e5471ef5315d06d55..981f81c207bb37f852dfeb40b4349f00607bfecb 100644 (file)
@@ -418,23 +418,26 @@ endif (WITH_RADOSGW)
 #option for CephFS
 option(WITH_CEPHFS "CephFS is enabled" ON)
 
-#option for Mgr
+# 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)
+  message(FATAL_ERROR "WITH_PYTHON3 should always be enabled")
+elseif(WITH_PYTHON3 MATCHES "^(1|ON|YES|TRUE|Y)$")
+  set(WITH_PYTHON3 "3")
+  message(NOTICE "Please specify a Python3 version instead of a BOOLEAN")
+elseif(NOT WITH_PYTHON3 STREQUAL "3")
+  set(find_python3_exact "EXACT")
+endif()
+find_package(Python3 ${WITH_PYTHON3} ${find_python3_exact} REQUIRED
+  COMPONENTS Interpreter Development)
+unset(find_python3_exact)
+
 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.
-  # FindPython thinks they belong to different families.
-  set(MGR_PYTHON_VERSION "2.7" CACHE
-    STRING "required version of python runtime for running mgr plugins. ")
-  if(NOT MGR_PYTHON_VERSION MATCHES "^[23]$")
-    set(find_python_exact "EXACT")
-  endif()
-  find_package(Python ${MGR_PYTHON_VERSION} ${find_python_exact} REQUIRED
-    COMPONENTS Interpreter Development)
-  unset(find_python_exact)
-  set(MGR_PYTHON_EXECUTABLE ${Python_EXECUTABLE})
-  set(MGR_PYTHON_LIBRARIES ${Python_LIBRARIES})
-  set(MGR_PYTHON_VERSION_MAJOR ${Python_VERSION_MAJOR})
-  set(MGR_PYTHON_VERSION_MINOR ${Python_VERSION_MINOR})
+  set(MGR_PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
+  set(MGR_PYTHON_LIBRARIES ${Python3_LIBRARIES})
+  set(MGR_PYTHON_VERSION_MAJOR ${Python3_VERSION_MAJOR})
+  set(MGR_PYTHON_VERSION_MINOR ${Python3_VERSION_MINOR})
   # Boost dependency check deferred to Boost section
 endif(WITH_MGR)
 
index 9a690df28fa6300fe8b376486fc0c7670b87ae5f..59d539ce3814fba3e0856443e7c1a159d74cb193 100644 (file)
@@ -1128,8 +1128,6 @@ ${CMAKE} .. \
     -DWITH_MANPAGE=ON \
     -DWITH_PYTHON3=%{python3_version} \
     -DWITH_MGR_DASHBOARD_FRONTEND=OFF \
-    -DWITH_PYTHON2=OFF \
-    -DMGR_PYTHON_VERSION=3 \
 %if 0%{without ceph_test_package}
     -DWITH_TESTS=OFF \
 %endif
index ace6053b1fdb4e7b6eeb6405be2b936aa6f43453..9e2f6463890ae847c3d932527fa051f67c43fdbb 100644 (file)
@@ -38,7 +38,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)
+      ${Python3_EXECUTABLE} ${gtest_parallel_source_dir}/gtest-parallel)
   endif()
 endif()
 
@@ -62,12 +62,7 @@ function(add_tox_test name)
   else()
     set(tox_path ${CMAKE_CURRENT_SOURCE_DIR})
   endif()
-  if(WITH_PYTHON2)
-    list(APPEND tox_envs py27)
-  endif()
-  if(WITH_PYTHON3)
-    list(APPEND tox_envs py3)
-  endif()
+  list(APPEND tox_envs py3)
   if(DEFINED TOXTEST_TOX_ENVS)
     list(APPEND tox_envs ${TOXTEST_TOX_ENVS})
   endif()
@@ -75,7 +70,7 @@ function(add_tox_test name)
   find_package(Python REQUIRED)
   add_custom_command(
     OUTPUT ${venv_path}/bin/activate
-    COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python="${Python_EXECUTABLE}" ${venv_path}
+    COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python="${Python3_EXECUTABLE}" ${venv_path}
     WORKING_DIRECTORY ${tox_path}
     COMMENT "preparing venv for ${name}")
   add_custom_target(${name}-venv
index 34c37b284b9e8377026b34ad75ab61725be8e094..d1c0eba17d82bd2e19efffcd032a6bee90126f11 100644 (file)
@@ -109,15 +109,15 @@ function(do_build_boost version)
     " : ${CMAKE_CXX_COMPILER}"
     " ;\n")
   if(with_python_version)
-    find_package(Python ${with_python_version} QUIET REQUIRED
+    find_package(Python3 ${with_python_version} QUIET REQUIRED
       COMPONENTS Development)
-    string(REPLACE ";" " " python_includes "${Python_INCLUDE_DIRS}")
+    string(REPLACE ";" " " python3_includes "${Python3_INCLUDE_DIRS}")
     file(APPEND ${user_config}
       "using python"
       " : ${with_python_version}"
-      " : ${Python_EXECUTABLE}"
-      " : ${python_includes}"
-      " : ${Python_LIBRARIES}"
+      " : ${Python3_EXECUTABLE}"
+      " : ${python3_includes}"
+      " : ${Python3_LIBRARIES}"
       " ;\n")
   endif()
   list(APPEND b2 --user-config=${user_config})
index 3275fa51174566baa545990a710eb0a99f019ed8..b47d14b1465abd8efd09ae3f45d1704f5c72a52e 100644 (file)
@@ -15,12 +15,7 @@ function(distutils_install_module name)
     add_custom_target(${name}-clone ALL
       DEPENDS ${py_clone})
   endif()
-  cmake_parse_arguments(DU "" "INSTALL_SCRIPT;PYTHON_VERSION" "" ${ARGN})
-  if(DU_PYTHON_VERSION)
-    set(python_version ${DU_PYTHON_VERSION})
-  else()
-    set(python_version 3)
-  endif()
+  cmake_parse_arguments(DU "" "INSTALL_SCRIPT" "" ${ARGN})
   install(CODE "
     set(options --prefix=${CMAKE_INSTALL_PREFIX})
     if(DEFINED ENV{DESTDIR})
@@ -35,12 +30,12 @@ function(distutils_install_module name)
       endif()
     endif()
     execute_process(
-    COMMAND ${Python${python_version}_EXECUTABLE}
+    COMMAND ${Python3_EXECUTABLE}
         setup.py install \${options}
     WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}\")")
 endfunction(distutils_install_module)
 
-function(distutils_add_cython_module target name src python_version)
+function(distutils_add_cython_module target name src)
   get_property(compiler_launcher GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
   get_property(link_launcher GLOBAL PROPERTY RULE_LAUNCH_LINK)
   # When using ccache, CMAKE_C_COMPILER is ccache executable absolute path
@@ -64,12 +59,8 @@ function(distutils_add_cython_module target name src python_version)
   set(PY_CXX ${compiler_launcher} ${CMAKE_CXX_COMPILER} ${cxx_compiler_arg1})
   set(PY_LDSHARED ${link_launcher} ${CMAKE_C_COMPILER} ${c_compiler_arg1} "-shared")
 
-  if(${Python${python_version}_VERSION_MAJOR} STREQUAL "2")
-    set(suffix_var "SO")
-  else()
-    set(suffix_var "EXT_SUFFIX")
-  endif()
-  execute_process(COMMAND "${Python${python_version}_EXECUTABLE}" -c
+  set(suffix_var "EXT_SUFFIX")
+  execute_process(COMMAND "${Python3_EXECUTABLE}" -c
     "from distutils import sysconfig; print(sysconfig.get_config_var('${suffix_var}'))"
     RESULT_VARIABLE result
     OUTPUT_VARIABLE ext_suffix
@@ -91,7 +82,7 @@ function(distutils_add_cython_module target name src python_version)
     LDFLAGS=-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
     CYTHON_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR}
     CEPH_LIBDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-    ${Python${python_version}_EXECUTABLE} ${setup_py}
+    ${Python3_EXECUTABLE} ${setup_py}
     build --verbose --build-base ${CYTHON_MODULE_DIR}
     --build-platlib ${output_dir}
     MAIN_DEPENDENCY ${src}
@@ -101,7 +92,7 @@ function(distutils_add_cython_module target name src python_version)
     DEPENDS ${output_dir}/${name}${ext_suffix})
 endfunction(distutils_add_cython_module)
 
-function(distutils_install_cython_module name python_version)
+function(distutils_install_cython_module name)
   get_property(compiler_launcher GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
   get_property(link_launcher GLOBAL PROPERTY RULE_LAUNCH_LINK)
   set(PY_CC "${compiler_launcher} ${CMAKE_C_COMPILER}")
@@ -127,7 +118,7 @@ function(distutils_install_cython_module name python_version)
     endif()
     execute_process(
        COMMAND
-           ${Python${python_version}_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py
+           ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py
            build --verbose --build-base ${CYTHON_MODULE_DIR}
            --build-platlib ${CYTHON_MODULE_DIR}/lib.${Python${python_version}_VERSION_MAJOR}
            build_ext --cython-c-in-temp --build-temp ${CMAKE_CURRENT_BINARY_DIR} --cython-include-dirs ${PROJECT_SOURCE_DIR}/src/pybind/rados
index f4407e7f96fb4e971324d92a76b2ee573f71ce5a..8eb9e42f402818555205b5933e56da4d09cfd4ac 100644 (file)
@@ -4,7 +4,7 @@
 
 # Try to run Cython, to make sure it works:
 execute_process(
-  COMMAND ${Python${PYTHON_VERSION}_EXECUTABLE} -m cython --version
+  COMMAND ${Python3_EXECUTABLE} -m cython --version
   RESULT_VARIABLE cython_result
   ERROR_VARIABLE cython_output)
 if(cython_result EQUAL 0)
index de5f14ace1029af06f99eb2156a49b113d117d8d..84529306bf0da33b6151995ffd825e67b8ac9980 100755 (executable)
@@ -19,7 +19,7 @@ endif
 
 extraopts += -DWITH_OCF=ON -DWITH_LTTNG=ON
 extraopts += -DWITH_MGR_DASHBOARD_FRONTEND=OFF
-extraopts += -DWITH_PYTHON3=3 -DWITH_PYTHON2=OFF -DMGR_PYTHON_VERSION=3
+extraopts += -DWITH_PYTHON3=3
 extraopts += -DWITH_CEPHFS_JAVA=ON
 extraopts += -DWITH_CEPHFS_SHELL=ON
 extraopts += -DWITH_SYSTEMD=ON -DCEPH_SYSTEMD_ENV_DIR=/etc/default
index 2f6e5bbb82ed11803f396f615f98b90464573d81..12ab5377f873ae156515a5d57e778a40865ac0de 100755 (executable)
@@ -42,7 +42,7 @@ else
 fi
 
 if [[ "$PYBUILD" =~ ^3(\..*)?$ ]] ; then
-    ARGS+=" -DWITH_PYTHON2=OFF -DWITH_PYTHON3=${PYBUILD} -DMGR_PYTHON_VERSION=${PYBUILD}"
+    ARGS+=" -DWITH_PYTHON3=${PYBUILD}"
 fi
 
 if type ccache > /dev/null 2>&1 ; then
index 2763af0456957be03a7aac70b8c1872332e01bb4..4a022fec982bc69ae8a982467d5de73907d755ec 100755 (executable)
@@ -54,7 +54,7 @@ function main() {
     fi
     FOR_MAKE_CHECK=1 prepare
     # Init defaults after deps are installed.
-    configure "-DWITH_GTEST_PARALLEL=ON -DWITH_FIO=ON -DWITH_SEASTAR=ON -DWITH_CEPHFS_SHELL=ON -DWITH_SPDK=ON -DENABLE_GIT_VERSION=OFF $@"
+    configure " -DWITH_PYTHON3=3 -DWITH_GTEST_PARALLEL=ON -DWITH_FIO=ON -DWITH_SEASTAR=ON -DWITH_CEPHFS_SHELL=ON -DWITH_SPDK=ON -DENABLE_GIT_VERSION=OFF $@"
     build tests && echo "make check: successful run on $(git rev-parse HEAD)"
     run
 }
index 08c9b094c70573783e44f1179db139373fe83759..bb22331d38e1b6ef100fe01de1064c934d834654 100644 (file)
@@ -218,42 +218,9 @@ if(WITH_CEPHFS_JAVA)
 endif()
 
 # Python stuff
-option(WITH_PYTHON2 "build python2 bindings" ON)
+option(WITH_PYTHON2 "build python2 bindings" OFF)
 if(WITH_PYTHON2)
-  find_package(Python2 REQUIRED
-    COMPONENTS Interpreter Development)
-endif()
-
-set(WITH_PYTHON3 "OFF" CACHE STRING "build python3 bindings with specified python3 version")
-if(WITH_PYTHON3)
-  if(WITH_PYTHON3 MATCHES "^(1|ON|YES|TRUE|Y)$")
-    set(WITH_PYTHON3 "3")
-  endif()
-  if(NOT WITH_PYTHON3 STREQUAL "3")
-    set(find_python3_exact "EXACT")
-  endif()
-  find_package(Python3 ${WITH_PYTHON3} ${find_python3_exact} REQUIRED
-    COMPONENTS Interpreter Development)
-  unset(find_python3_exact)
-endif()
-
-# the major version of the python bindings as a dependency of other
-# targets
-if(WITH_PYTHON2)
-  set(PY_BINDING_INFIX 2)
-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})
+  message(FATAL_ERROR "Python 2 is not supported anymore")
 endif()
 
 # sort out which allocator to use
@@ -787,17 +754,17 @@ add_custom_target(vstart-base DEPENDS
     monmaptool
     crushtool
     rados
-    cython${PY_BINDING_INFIX}_rados)
+    cython_rados)
 if (WITH_MGR)
   add_dependencies(vstart-base ceph-mgr)
 endif()
 
 add_custom_target(vstart DEPENDS vstart-base)
-if (WITH_RBD)
-  add_dependencies(vstart cython${PY_BINDING_INFIX}_rbd)
+if(WITH_RBD)
+  add_dependencies(vstart cython_rbd)
 endif()
 if (WITH_CEPHFS)
-  add_dependencies(vstart ceph-mds cephfs cython${PY_BINDING_INFIX}_cephfs)
+  add_dependencies(vstart ceph-mds cephfs cython_cephfs)
 endif()
 if(WITH_RADOSGW)
   add_dependencies(vstart radosgw radosgw-admin)
@@ -819,7 +786,7 @@ endif()
 add_custom_target(cephfs_testing DEPENDS
     vstart
     rados
-    cython${PY_BINDING_INFIX}_modules
+    cython_modules
     cephfs
     cls_cephfs
     ceph-fuse
index 21f83c81defe9699fcedc3b752709e826f4a8c3c..587f40b76a6af3b7d098bc1b0e26ab444ac904aa 100755 (executable)
@@ -1,4 +1,4 @@
-#!@Python_EXECUTABLE@
+#!@Python3_EXECUTABLE@
 # -*- mode:python -*-
 # vim: ts=4 sw=4 smarttab expandtab
 
index d1217a915c85f2f1547bf3b178e4ee4db131f50b..4224499c4749840311b2e5a1a8c0decc015788c1 100644 (file)
@@ -1,15 +1,8 @@
 
 include(Distutils)
 
-if(WITH_PYTHON2)
-  set(python_version_major 2)
-else()
-  set(python_version_major 3)
-endif()
-
 distutils_install_module(ceph_volume
-  INSTALL_SCRIPT ${CMAKE_INSTALL_FULL_SBINDIR}
-  PYTHON_VERSION ${python_version_major})
+  INSTALL_SCRIPT ${CMAKE_INSTALL_FULL_SBINDIR})
 
 if(FREEBSD)
   add_subdirectory(plugin/zfs)
index cafb7382e77ae62bd0f7372093225ed794bf1ed8..da10f46fd09adc0f942c911aa048ab84c8fc511f 100644 (file)
@@ -1,4 +1,3 @@
 
 distutils_install_module(ceph_volume_zfs
-  INSTALL_SCRIPT ${CMAKE_INSTALL_FULL_SBINDIR}
-  PYTHON_VERSION ${python_version})
+  INSTALL_SCRIPT ${CMAKE_INSTALL_FULL_SBINDIR})
index 70119d50a04464a2d195b8ab837144017647a662..0da8aa1e81eb732e5b3d8648365bed35c9f04e22 100755 (executable)
@@ -1,4 +1,4 @@
-#!@Python_EXECUTABLE@
+#!@Python3_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 += ['@Python3_EXECUTABLE@', '-mpdb']
 
     if platform.system() == "Darwin":
         lib_path_var = "DYLD_LIBRARY_PATH"
index 101db6ed88956fef3228e9e297c853a21796a9e4..f6f9e73d433d9d82ca9c3c7fc2a8beef27755b9b 100644 (file)
@@ -30,12 +30,11 @@ if(WITH_MGR)
     mgr_commands.cc
     $<TARGET_OBJECTS:mgr_cap_obj>)
   add_executable(ceph-mgr ${mgr_srcs})
-  target_include_directories(ceph-mgr SYSTEM PRIVATE "${Python_INCLUDE_DIRS}")
   target_link_libraries(ceph-mgr
     osdc client heap_profiler
     global-static ceph-common
     Boost::python${MGR_PYTHON_VERSION_MAJOR}${MGR_PYTHON_VERSION_MINOR}
-    ${MGR_PYTHON_LIBRARIES} ${CMAKE_DL_LIBS} ${GSSAPI_LIBRARIES})
+    Python3::Python ${CMAKE_DL_LIBS} ${GSSAPI_LIBRARIES})
   set_target_properties(ceph-mgr PROPERTIES
     POSITION_INDEPENDENT_CODE ${EXE_LINKER_USE_PIE})
   install(TARGETS ceph-mgr DESTINATION bin)
index 83496953b30981c14a8d9ab92bcf3e55a6a034c4..86fcc6becade7d3f2766bd0cf9b330b1882f7d5d 100644 (file)
@@ -2,70 +2,49 @@ include(Distutils)
 
 set(CYTHON_MODULE_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cython_modules)
 
-# Keep the default version last
-if(WITH_PYTHON3)
-  list(APPEND py_vers 3)
+find_package(Cython REQUIRED)
+
+add_subdirectory(rados)
+add_custom_target(cython_modules ALL
+  DEPENDS cython_rados)
+
+if(WITH_RBD)
+  add_subdirectory(rbd)
+  add_dependencies(cython_modules cython_rbd)
 endif()
-if(WITH_PYTHON2)
-  list(APPEND py_vers 2)
+if(WITH_CEPHFS)
+  add_subdirectory(cephfs)
+  add_dependencies(cython_modules cython_cephfs)
 endif()
-if(NOT py_vers)
-  message(FATAL_ERROR "No Python binding enabled. Please enable WITH_PYTHON2 and/or WITH_PYTHON3.")
+if(WITH_RADOSGW)
+  add_subdirectory(rgw)
+  add_dependencies(cython_modules cython_rgw)
 endif()
 
-foreach(python_version ${py_vers})
-  set(PYTHON_VERSION ${python_version})
-
-  find_package(Cython REQUIRED)
-
-  add_subdirectory(rados rados${PYTHON_VERSION})
-  add_custom_target(cython${PYTHON_VERSION}_modules ALL
-    DEPENDS cython${PYTHON_VERSION}_rados)
-
-  if(WITH_RBD)
-    add_subdirectory(rbd rbd${PYTHON_VERSION})
-    add_dependencies(cython${PYTHON_VERSION}_modules cython${PYTHON_VERSION}_rbd)
-  endif()
-  if(WITH_CEPHFS)
-    add_subdirectory(cephfs cephfs${PYTHON_VERSION})
-    add_dependencies(cython${PYTHON_VERSION}_modules cython${PYTHON_VERSION}_cephfs)
-  endif()
-  if(WITH_RADOSGW)
-    add_subdirectory(rgw rgw${PYTHON_VERSION})
-    add_dependencies(cython${PYTHON_VERSION}_modules cython${PYTHON_VERSION}_rgw)
-  endif()
-
-  # if CMAKE_INSTALL_PREFIX is an empty string, must replace
-  # it with "/" to make PYTHON_INSTALL_TEMPLATE an absolute path to be
-  # consistent with all other installation paths.
-  if(CMAKE_INSTALL_PREFIX)
-    set(PYTHON_INSTALL_TEMPLATE "${CMAKE_INSTALL_PREFIX}")
-  else(CMAKE_INSTALL_PREFIX)
-    set(PYTHON_INSTALL_TEMPLATE "/")
-  endif(CMAKE_INSTALL_PREFIX)
+# if CMAKE_INSTALL_PREFIX is an empty string, must replace
+# it with "/" to make PYTHON_INSTALL_TEMPLATE an absolute path to be
+# consistent with all other installation paths.
+if(CMAKE_INSTALL_PREFIX)
+  set(PYTHON_INSTALL_TEMPLATE "${CMAKE_INSTALL_PREFIX}")
+else(CMAKE_INSTALL_PREFIX)
+  set(PYTHON_INSTALL_TEMPLATE "/")
+endif(CMAKE_INSTALL_PREFIX)
 
-  execute_process(
-    COMMAND
-    ${Python${PYTHON_VERSION}_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(prefix='${PYTHON_INSTALL_TEMPLATE}'))"
-    OUTPUT_VARIABLE "PYTHON${PYTHON_VERSION}_INSTDIR"
-    OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(
+  COMMAND
+  ${Python3_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(prefix='${PYTHON_INSTALL_TEMPLATE}'))"
+  OUTPUT_VARIABLE "PYTHON3_INSTDIR"
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
 
-  install(FILES
-    ${CMAKE_CURRENT_SOURCE_DIR}/ceph_argparse.py
-    ${CMAKE_CURRENT_SOURCE_DIR}/ceph_daemon.py
-    ${CMAKE_CURRENT_SOURCE_DIR}/ceph_volume_client.py
-    DESTINATION ${PYTHON${PYTHON_VERSION}_INSTDIR})
-endforeach()
+install(FILES
+  ${CMAKE_CURRENT_SOURCE_DIR}/ceph_argparse.py
+  ${CMAKE_CURRENT_SOURCE_DIR}/ceph_daemon.py
+  ${CMAKE_CURRENT_SOURCE_DIR}/ceph_volume_client.py
+  DESTINATION ${PYTHON3_INSTDIR})
 
 if(WITH_MGR)
-  if(NOT WITH_PYTHON2 AND MGR_PYTHON_VERSION_MAJOR EQUAL 2)
-    message(FATAL_ERROR "mgr plugins require python2 binding")
-  elseif(NOT WITH_PYTHON3 AND MGR_PYTHON_VERSION_MAJOR EQUAL 3)
-    message(FATAL_ERROR "mgr plugins require python3 binding")
-  endif()
-
   execute_process(
-    COMMAND ${Python${PYTHON_VERSION}_EXECUTABLE} -c "import ssl; print('.'.join(map(str,ssl.OPENSSL_VERSION_INFO[0:3])))"
+    COMMAND ${Python3_EXECUTABLE} -c "import ssl; print('.'.join(map(str,ssl.OPENSSL_VERSION_INFO[0:3])))"
     RESULT_VARIABLE PYSSL_RESULT
     OUTPUT_VARIABLE PYSSL_VER
     ERROR_QUIET)
index 61cf8b4a9ff3cecde712a070aa6a8cde13b8c106..bd1ed3d55160c423fbb273a509e5217e3b856c2e 100644 (file)
@@ -1,7 +1,5 @@
-distutils_add_cython_module(cython${PYTHON_VERSION}_cephfs
+distutils_add_cython_module(cython_cephfs
   cephfs
-  ${CMAKE_CURRENT_SOURCE_DIR}/cephfs.pyx
-  ${PYTHON_VERSION})
-add_dependencies(cython${PYTHON_VERSION}_cephfs cephfs)
-distutils_install_cython_module(cython${PYTHON_VERSION}_cephfs
-  ${PYTHON_VERSION})
+  ${CMAKE_CURRENT_SOURCE_DIR}/cephfs.pyx)
+add_dependencies(cython_cephfs cephfs)
+distutils_install_cython_module(cython_cephfs)
index da41e8c17b4a48a7f71760a3d713ffad11724e15..c567f4c545bddc07e86972a1de9c44e7f1bb33b2 100644 (file)
@@ -741,7 +741,7 @@ To run the tests, run ``src/script/run_tox.sh`` in the dashboard directory (wher
   $ ../../../script/run_tox.sh --tox-env py3,lint,check
 
   ## Run Python 3 arbitrary command (e.g. 1 single test):
-  $ WITH_PYTHON2=OFF ../../../script/run_tox.sh --tox-env py3 "" tests/test_rgw_client.py::RgwClientTest::test_ssl_verify
+  $ ../../../script/run_tox.sh --tox-env py3 "" tests/test_rgw_client.py::RgwClientTest::test_ssl_verify
 
 You can also run tox instead of ``run_tox.sh``::
 
index b16d3513b55b0fdf637632d4dc8db915fa913a29..0cd19d03174599fff98d172714bd57f73047a5fb 100644 (file)
@@ -1,7 +1,5 @@
-distutils_add_cython_module(cython${PYTHON_VERSION}_rados
+distutils_add_cython_module(cython_rados
   rados
-  ${CMAKE_CURRENT_SOURCE_DIR}/rados.pyx
-  ${PYTHON_VERSION})
-add_dependencies(cython${PYTHON_VERSION}_rados rados)
-distutils_install_cython_module(cython${PYTHON_VERSION}_rados
-  ${PYTHON_VERSION})
+  ${CMAKE_CURRENT_SOURCE_DIR}/rados.pyx)
+add_dependencies(cython_rados rados)
+distutils_install_cython_module(cython_rados)
index f7d3bb4deb96e3ea52880ca97d503fc6945b0a2d..93123234ca8bb7ffb10a36619108297df668eb11 100644 (file)
@@ -1,7 +1,5 @@
-distutils_add_cython_module(cython${PYTHON_VERSION}_rbd
+distutils_add_cython_module(cython_rbd
   rbd
-  ${CMAKE_CURRENT_SOURCE_DIR}/rbd.pyx
-  ${PYTHON_VERSION})
-add_dependencies(cython${PYTHON_VERSION}_rbd librbd)
-distutils_install_cython_module(cython${PYTHON_VERSION}_rbd
-  ${PYTHON_VERSION})
+  ${CMAKE_CURRENT_SOURCE_DIR}/rbd.pyx)
+add_dependencies(cython_rbd librbd)
+distutils_install_cython_module(cython_rbd)
index 01d3bc582b3d57d57c29a9d46127acc7c62eaf80..e2a248e375d218989096d8402c5537e20e931307 100644 (file)
@@ -1,15 +1,5 @@
-if(WITH_PYTHON3)
-  list(APPEND py_vers 3)
-endif()
-if(WITH_PYTHON2)
-  list(APPEND py_vers 2)
-endif()
-
 include(Distutils)
-foreach(python_version ${py_vers})
-  distutils_install_module(ceph
-    PYTHON_VERSION ${python_version})
-endforeach()
+distutils_install_module(ceph)
 
 if(WITH_TESTS)
   include(AddCephTest)
index 49bd36dbb446ebaca05a57fb18bf7855c59e1625..b19c73da73902c466715efe50c269ea1b2fc1315 100644 (file)
@@ -509,7 +509,7 @@ add_dependencies(tests
   ceph_test_objectstore
   ceph_erasure_code_non_regression
   ceph_erasure_code
-  cython${PY_BINDING_INFIX}_modules)
+  cython_modules)
 if (WITH_CEPHFS)
   add_dependencies(tests ceph-mds)
 endif()
index d934ea414910897f6696f81f403ac2898991db5b..f980f35f5ff1de9ac0800b8b045aeb89a286df5e 100644 (file)
@@ -44,8 +44,7 @@ if(WITH_CEPHFS_SHELL)
     message(WARNING "Please enable WITH_PYTHON3 for cephfs-shell")
   else()
     include(Distutils)
-    distutils_install_module(cephfs-shell
-      PYTHON_VERSION 3)
+    distutils_install_module(cephfs-shell)
   endif()
   if(WITH_TESTS)
     include(AddCephTest)