@@ -287,25 +287,26 @@ message(STATUS "Python version is ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR
287287set (OLD_PYTHON_SITE_PATH ${CMAKE_INSTALL_FULL_LIBDIR} /python${PYTHON_VERSION_MAJOR} .${PYTHON_VERSION_MINOR} /site-packages)
288288
289289# The PYTHON_SITE_PATH variable is used throughout for installation purposes.
290- # Note that some of the code (e.g. cadabra2-cli.cc) looks up this path based on the
291- # location of the binary; make sure to change the search logic there too to keep it
292- # compatible with what is done here.
293290if (PACKAGING_MODE AND IS_DEBIAN_PACKAGE)
294291 # Debian packages install all their Python things in 'dist-packages', not 'site-packages'.
295292 set (PYTHON_SITE_PATH ${CMAKE_INSTALL_PREFIX} /lib/python${PYTHON_VERSION_MAJOR} .${PYTHON_VERSION_MINOR} /dist-packages)
296- set (PYTHON_SITE_DIST "dist-packages" )
297- else ()
298- # For everyone else there is 'site-packages'. We get it from calling python, as otherwise
299- # we may be going wrong on e.g. Anaconda.
300- execute_process (
301- COMMAND ${PYTHON_EXECUTABLE} -c "import site; print(site.getsitepackages()[0])"
302- OUTPUT_VARIABLE PYTHON_SITE_PATH
303- OUTPUT_STRIP_TRAILING_WHITESPACE
304- )
305- # set(PYTHON_SITE_PATH ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
306- set (PYTHON_SITE_DIST "site-packages" )
293+ # set(PYTHON_SITE_DIST "dist-packages")
294+ else ()
295+ # The builder can override the path by setting it externally.
296+ if (NOT DEFINED PYTHON_SITE_PATH)
297+ # For everyone else there is 'site-packages' which we get from
298+ # calling into python's 'site' package (and hoping that the 0th
299+ # element is where we should be writing).
300+ execute_process (
301+ COMMAND ${PYTHON_EXECUTABLE} -c "import site; print(site.getsitepackages()[0])"
302+ OUTPUT_VARIABLE PYTHON_SITE_PATH
303+ OUTPUT_STRIP_TRAILING_WHITESPACE
304+ )
305+ # set(PYTHON_SITE_PATH ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
306+ # set(PYTHON_SITE_DIST "site-packages")
307+ endif ()
307308endif ()
308- message (STATUS "Installing Python module in ${PYTHON_SITE_PATH} " )
309+ message (STATUS "Installing Python modules in ${PYTHON_SITE_PATH} " )
309310# We need to give our Python module an abi-name extension
310311# so that it can be installed in a folder which does not
311312# contain the abi name. See
0 commit comments