diff options
-rw-r--r-- | CMakeLists.txt | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ae801e..ca89b6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,10 +72,15 @@ if (NOT DISABLE_PYTHON) if (NOT DEFINED PCILIB_PYTHON_SITEDIR) execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "import site; print (site.PREFIXES[-1])" OUTPUT_VARIABLE PYTHON_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE) file (TO_CMAKE_PATH "${PYTHON_PREFIX}" PYTHON_PREFIX) - execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "import site; print (site.getsitepackages()[0])" OUTPUT_VARIABLE PYTHON_SITE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) + +# execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "import site; print (site.getsitepackages()[0])" OUTPUT_VARIABLE PYTHON_SITE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) +# file (TO_CMAKE_PATH "${PYTHON_SITE_DIR}" PYTHON_SITE_DIR) +# string (REGEX REPLACE "^${PYTHON_PREFIX}/" "${CMAKE_INSTALL_PREFIX}/" PYTHON_SITE_DIR "${PYTHON_SITE_DIR}") + + execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "import site; list = [dir for dir in site.getsitepackages() if dir.startswith('${CMAKE_INSTALL_PREFIX}')]; liblist = [dir for dir in list if dir.startswith('${CMAKE_INSTALL_PREFIX}/lib')]; print liblist[0] if liblist else list[0] if list else site.getsitepackages()[0]" OUTPUT_VARIABLE PYTHON_SITE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) + message(${PYTHON_SITE_DIR}) file (TO_CMAKE_PATH "${PYTHON_SITE_DIR}" PYTHON_SITE_DIR) - string (REGEX REPLACE "^${PYTHON_PREFIX}/" "${CMAKE_INSTALL_PREFIX}/" PYTHON_SITE_DIR "${PYTHON_SITE_DIR}") set(PCILIB_PYTHON_SITEDIR ${PYTHON_SITE_DIR} CACHE PATH "path to install python module") endif (NOT DEFINED PCILIB_PYTHON_SITEDIR) |