summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorDouglas Anderson <danderson@ntia.doc.gov>2017-03-30 11:40:29 -0600
committerDouglas Anderson <douglas.j.anderson@gmail.com>2017-04-03 20:38:19 -0600
commit7c32a9220a2d12ed464669482d086415ded77221 (patch)
treeb247b333b5022dd1f621760a43e20743ade5bb23 /cmake
parent1ee3e3a1cb18f9e2df57983e615e8a5680515bc5 (diff)
modify GR_PYTHON_DIR code to handle prefix
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/GrPython.cmake8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake
index 326b2076f5..42d980494b 100644
--- a/cmake/Modules/GrPython.cmake
+++ b/cmake/Modules/GrPython.cmake
@@ -92,8 +92,12 @@ endmacro(GR_PYTHON_CHECK_MODULE)
########################################################################
if(NOT DEFINED GR_PYTHON_DIR)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
-import site
-print(site.getsitepackages()[0])
+import os
+import sys
+if os.name == 'posix':
+ print(os.path.join('lib', 'python' + sys.version[:3], 'dist-packages'))
+if os.name == 'nt':
+ print(os.path.join('Lib', 'site-packages'))
" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()