mirror of
https://github.com/ceph/ceph
synced 2025-04-11 04:02:04 +00:00
cmake: drop WITH_PYTHON2 option
* 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>
This commit is contained in:
parent
47d0e1e16d
commit
5fc657b40d
CMakeLists.txtceph.spec.in
cmake/modules
debian
do_cmake.shrun-make-check.shsrc
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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})
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
2
debian/rules
vendored
2
debian/rules
vendored
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!@Python_EXECUTABLE@
|
||||
#!@Python3_EXECUTABLE@
|
||||
# -*- mode:python -*-
|
||||
# vim: ts=4 sw=4 smarttab expandtab
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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})
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
|
@ -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})
|
||||
# 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)
|
||||
|
||||
find_package(Cython REQUIRED)
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
@ -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)
|
||||
|
@ -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``::
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user