summaryrefslogtreecommitdiffstats
path: root/cmake/modules/Distutils.cmake
diff options
context:
space:
mode:
authorKefu Chai <tchaikov@gmail.com>2022-04-16 03:10:20 +0200
committerKefu Chai <tchaikov@gmail.com>2022-04-16 03:15:03 +0200
commite2babdfae8c99f39f99a7c8a8f966299b2e62b19 (patch)
treee4d305be92dc1917919fff954cf9f7cac3a2aa3d /cmake/modules/Distutils.cmake
parentMerge pull request #45765 from m-ildefons/1196785-cephadm-status-trace (diff)
downloadceph-e2babdfae8c99f39f99a7c8a8f966299b2e62b19.tar.xz
ceph-e2babdfae8c99f39f99a7c8a8f966299b2e62b19.zip
cmake/modules: always use the python3 specified in command line
if another python3 with higher version is found by find_package(Python3), the cmake's install script would just install the python modules/extensions into that python3's dist-package directory, and the packaging script would fail to find these artifacts when trying to package them. so we need to ensure that the install directories for python modeules/extensions are always "versioned" with WITH_PYTHON3 cmake option. Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Diffstat (limited to 'cmake/modules/Distutils.cmake')
-rw-r--r--cmake/modules/Distutils.cmake11
1 files changed, 11 insertions, 0 deletions
diff --git a/cmake/modules/Distutils.cmake b/cmake/modules/Distutils.cmake
index 1d954c3a51f..d3aff02cd51 100644
--- a/cmake/modules/Distutils.cmake
+++ b/cmake/modules/Distutils.cmake
@@ -1,5 +1,16 @@
include(CMakeParseArguments)
+# ensure that we are using the exact python version specified by
+# 'WITH_PYTHON3', in case some included 3rd party libraries call
+# 'find_package(Python3 ...) without specifying the exact version number. if
+# 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}
+ QUIET
+ REQUIRED
+ COMPONENTS Interpreter)
+
function(distutils_install_module name)
set(py_srcs setup.py README.rst requirements.txt test-requirements.txt bin ${name})
foreach(src ${py_srcs})