aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/python/CMakeLists.txt30
-rw-r--r--mpm/python/CMakeLists.txt10
-rw-r--r--tools/gr-usrptest/cmake/Modules/GrPython.cmake14
3 files changed, 20 insertions, 34 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
diff --git a/mpm/python/CMakeLists.txt b/mpm/python/CMakeLists.txt
index 260d3bab7..51aced18d 100644
--- a/mpm/python/CMakeLists.txt
+++ b/mpm/python/CMakeLists.txt
@@ -31,7 +31,7 @@ PYTHON_CHECK_MODULE(
PYTHON_CHECK_MODULE_VERSION(
"pyudev module"
- "pyudev"
+ "pyudev"
"pyudev.__version__"
${PYUDEV_MIN_VERSION}
HAVE_PYTHON_MODULE_PYUDEV
@@ -41,7 +41,7 @@ PYTHON_CHECK_MODULE_VERSION(
# attribute, so merely check for its presence.
PYTHON_CHECK_MODULE(
"pyroute2 module"
- "pyroute2"
+ "pyroute2"
"True"
HAVE_PYTHON_MODULE_PYROUTE2
)
@@ -101,10 +101,10 @@ add_custom_command(OUTPUT ${OUTPUT}
add_custom_target(usrp_mpm ALL DEPENDS ${OUTPUT} pyusrp_periphs)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
- "import sysconfig;\
+ "import os,sysconfig;\
platlib = sysconfig.get_path(name='platlib');\
- base = sysconfig.get_config_var('base');\
- print(platlib.replace(base, '').lstrip('/\\\\'))"
+ prefix = sysconfig.get_config_var('prefix');\
+ print(os.path.relpath(platlib, prefix));"
OUTPUT_VARIABLE USRP_MPM_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build/lib/usrp_mpm DESTINATION ${USRP_MPM_PYTHON_DIR})
diff --git a/tools/gr-usrptest/cmake/Modules/GrPython.cmake b/tools/gr-usrptest/cmake/Modules/GrPython.cmake
index fdd1aff61..22ac29d38 100644
--- a/tools/gr-usrptest/cmake/Modules/GrPython.cmake
+++ b/tools/gr-usrptest/cmake/Modules/GrPython.cmake
@@ -104,13 +104,13 @@ endmacro(GR_PYTHON_CHECK_MODULE)
# Sets the python installation directory GR_PYTHON_DIR
########################################################################
if(NOT DEFINED GR_PYTHON_DIR)
-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 GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
-)
+ 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 GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
endif()
file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)