From c31aff5e4c9a34ec333fceeeb770f09501d486d3 Mon Sep 17 00:00:00 2001 From: Evan Goode Date: Mon, 23 Sep 2024 22:55:16 +0000 Subject: [PATCH] CMakeLists.txt: Allow overriding PYTHON_INSTALL_DIR Useful for testing. The dnf-plugins-core RPM installs Python modules to /usr/lib/python3.XX/site-packages whereas a `make install` will by default install files to /usr/local/lib/python3.XX/site-packages. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a54e2c6e..6ec8c492 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,9 @@ ELSE () MESSAGE (FATAL_ERROR "Invalid PYTHON_DESIRED value: " ${PYTHON_DESIRED}) ENDIF() -EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from sysconfig import get_path; stdout.write(get_path('purelib'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR) +IF (not PYTHON_INSTALL_DIR) + EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from sysconfig import get_path; stdout.write(get_path('purelib'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR) +ENDIF() MESSAGE(STATUS "Python install dir is ${PYTHON_INSTALL_DIR}") SET (SYSCONFDIR /etc)