Skip to content

Commit

Permalink
CMakeLists.txt: Allow overriding PYTHON_INSTALL_DIR
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
evan-goode committed Sep 23, 2024
1 parent f458ab6 commit c31aff5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c31aff5

Please sign in to comment.