diff options
author | Steven Koo <steven.koo@ni.com> | 2022-01-18 21:40:39 -0600 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-01-20 08:31:50 -0600 |
commit | 396ed0c8afeb948afe7dfa4b413a865b15a8b18a (patch) | |
tree | 583ce9262fb82e6f4327d7a47760e7869d6273a7 /host/python/CMakeLists.txt | |
parent | 2c7ce2dbf72414b64f8a477be614e23bc12f086d (diff) | |
download | uhd-396ed0c8afeb948afe7dfa4b413a865b15a8b18a.tar.gz uhd-396ed0c8afeb948afe7dfa4b413a865b15a8b18a.tar.bz2 uhd-396ed0c8afeb948afe7dfa4b413a865b15a8b18a.zip |
fixup! cmake: Replace distutils.sysconfig with sysconfig
The original commit incorrectly fails the build
uhd in the meta-ettus context. This uses prefix
instead to get the base path.
Signed-off-by: Steven Koo <steven.koo@ni.com>
Diffstat (limited to 'host/python/CMakeLists.txt')
-rw-r--r-- | host/python/CMakeLists.txt | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/host/python/CMakeLists.txt b/host/python/CMakeLists.txt index 14db8bc00..eacdb8fbf 100644 --- a/host/python/CMakeLists.txt +++ b/host/python/CMakeLists.txt @@ -162,31 +162,17 @@ else() # Otherwise, use sysconfig to determine the correct relative path for Python # packages, and install to our prefix if(NOT DEFINED UHD_PYTHON_DIR) - if(WIN32) - # CPack with NSIS generates an error when using install() - # with a DESTINATION that is an absolute path. Thus, specify - # a blank prefix, which returns only the Python library relative - # path, and use that in the install step below. - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c - "import sysconfig;\ - platlib = sysconfig.get_path(name='platlib');\ - base = sysconfig.get_config_var('base');\ - print(platlib.replace(base, '').lstrip('\\\\'));" - OUTPUT_VARIABLE UHD_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE - ) - else() - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c - "import sysconfig; import os.path; \ - platlib = sysconfig.get_path(name='platlib');\ - base = sysconfig.get_config_var('base');\ - print(os.path.join('${CMAKE_INSTALL_PREFIX}', platlib.replace(base, '').lstrip('/')));" - OUTPUT_VARIABLE UHD_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE - ) - endif(WIN32) + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c + "import os,sysconfig;\ + platlib = sysconfig.get_path(name='platlib');\ + prefix = sysconfig.get_config_var('prefix');\ + print(os.path.relpath(platlib, prefix));" + OUTPUT_VARIABLE UHD_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE + ) endif(NOT DEFINED UHD_PYTHON_DIR) file(TO_CMAKE_PATH ${UHD_PYTHON_DIR} UHD_PYTHON_DIR) - message(STATUS "Utilizing the python install directory: ${UHD_PYTHON_DIR}") + message(STATUS "Utilizing the python install directory: ${CMAKE_INSTALL_PREFIX}/${UHD_PYTHON_DIR}") # CMake will create an up-to-date copy of the entire Python module within # the build directory. Use sysconfig (above) to figure out the destination # path, and then we simply copy this module recursively into its final |