diff options
author | mattprost <matt.prost@ni.com> | 2022-06-15 12:47:35 -0500 |
---|---|---|
committer | skooNI <60897865+skooNI@users.noreply.github.com> | 2022-07-20 15:57:20 -0500 |
commit | f1917e661e8bc9802ac10b42c3080ffa0cf8892f (patch) | |
tree | ceadc1afe2ff81da9f857637d8326937ee280bcc /host/python | |
parent | e78962d8d03cbe5ede365b249c4da7ac2e8ffbdb (diff) | |
download | uhd-f1917e661e8bc9802ac10b42c3080ffa0cf8892f.tar.gz uhd-f1917e661e8bc9802ac10b42c3080ffa0cf8892f.tar.bz2 uhd-f1917e661e8bc9802ac10b42c3080ffa0cf8892f.zip |
python: cmake: Detect python virtual environments
This allows a UHD build to link to python modules installed in a virtual
environment such a venv or pyenv.
Signed-off-by: mattprost <matt.prost@ni.com>
Diffstat (limited to 'host/python')
-rw-r--r-- | host/python/CMakeLists.txt | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/host/python/CMakeLists.txt b/host/python/CMakeLists.txt index eacdb8fbf..8db002238 100644 --- a/host/python/CMakeLists.txt +++ b/host/python/CMakeLists.txt @@ -9,9 +9,9 @@ ######################################################################## PYTHON_CHECK_MODULE( - "virtualenv" + "virtual environment" "sys" - "hasattr(sys, 'real_prefix')" + "sys.prefix != sys.base_prefix" HAVE_PYTHON_VIRTUALENV ) @@ -156,6 +156,7 @@ add_custom_command(OUTPUT ${TIMESTAMP_FILE} add_custom_target(pyuhd_library ALL DEPENDS ${TIMESTAMP_FILE} pyuhd) if(HAVE_PYTHON_VIRTUALENV) + message(STATUS "python virtual environment detected.") # In virtualenvs, let setuptools do its thing install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} -q install --force)") else() |