Skip to content

Commit b36a9c7

Browse files
author
Your Name
committed
Skip if there is no venv
1 parent 87456e4 commit b36a9c7

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/addon/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ if (NOT Python_Interpreter_FOUND)
33
return()
44
endif()
55

6+
# creating a virtual environment needs the venv and ensurepip modules - some
7+
# distributions ship them separately from the interpreter (e.g. the Debian/Ubuntu
8+
# python3-venv package)
9+
execute_process(COMMAND ${Python_EXECUTABLE} -c "import venv, ensurepip"
10+
RESULT_VARIABLE PYTHON_VENV_RESULT
11+
OUTPUT_QUIET
12+
ERROR_QUIET)
13+
if (NOT PYTHON_VENV_RESULT EQUAL 0)
14+
message(WARNING "Python venv module not available (e.g. install the python3-venv package) - skipping addon tests.")
15+
return()
16+
endif()
17+
618
set(VENV_DIR ${CMAKE_CURRENT_BINARY_DIR}/venv)
719
if (WIN32)
820
set(VENV_PYTHON ${VENV_DIR}/Scripts/python.exe)

0 commit comments

Comments
 (0)