Skip to content

Commit dfe9bcd

Browse files
committed
Consult CMAKE_PREFIX_PATH only when VIRTUAL_ENV is empty
1 parent 6d33931 commit dfe9bcd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugins/python/src/pymodule.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ static bool initialize()
146146
// FIXME: Spack does not set PYTHONPATH or VIRTUAL_ENV, but it does set
147147
// CMAKE_PREFIX_PATH. Add site-packages directories from CMAKE_PREFIX_PATH
148148
// to sys.path so Python can find packages in Spack views.
149-
if (char const* cmake_prefix_path = std::getenv("CMAKE_PREFIX_PATH")) {
150-
add_cmake_prefix_paths_to_syspath(cmake_prefix_path);
149+
if (!std::getenv("VIRTUAL_ENV")) {
150+
if (char const* cmake_prefix_path = std::getenv("CMAKE_PREFIX_PATH")) {
151+
add_cmake_prefix_paths_to_syspath(cmake_prefix_path);
152+
}
151153
}
152154

153155
// load numpy (see also above, if already initialized)

0 commit comments

Comments
 (0)