From c5bef548740ccfcc58aebc881063f17b29559cd0 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 11 Nov 2024 13:53:21 -0800 Subject: [PATCH] Prepend to PYTHONPATH in tests (#2673) Preserve the existing PYTHONPATH by prepending instead of replacing. Signed-off-by: Steve Peters (cherry picked from commit 0d346dee5e8da0c73a0aba2925d7d6abbde67af3) --- python/CMakeLists.txt | 2 +- test/integration/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 3069e98752..550d17e778 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -122,7 +122,7 @@ if (BUILD_TESTING) endif() set(_env_vars) - list(APPEND _env_vars "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/python/") + list(APPEND _env_vars "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/python/:$ENV{PYTHONPATH}") list(APPEND _env_vars "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:$ENV{LD_LIBRARY_PATH}") set_tests_properties(${test} PROPERTIES ENVIRONMENT "${_env_vars}") diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index fe614d8666..6304e97999 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -247,5 +247,5 @@ endif() if (TARGET INTEGRATION_python_system_loader) set_tests_properties(INTEGRATION_python_system_loader PROPERTIES - ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/python/") + ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/python/:$ENV{PYTHONPATH}") endif()