summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2016-03-22 14:44:52 +0100
committerSuren A. Chilingaryan <csa@suren.me>2016-03-22 14:44:52 +0100
commitc40aef870ebb105c3c3ded77e3b3f818b03b9983 (patch)
tree0adb5b99ef515149bde5ecc5a9dc1a450ecf819c
parent142a1a83472d4dde6e7fdc58a46c6800505f44ab (diff)
downloadpcitool-c40aef870ebb105c3c3ded77e3b3f818b03b9983.tar.gz
pcitool-c40aef870ebb105c3c3ded77e3b3f818b03b9983.tar.bz2
pcitool-c40aef870ebb105c3c3ded77e3b3f818b03b9983.tar.xz
pcitool-c40aef870ebb105c3c3ded77e3b3f818b03b9983.zip
Better detection of Python site-dir
-rw-r--r--CMakeLists.txt9
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)