Author: Jonas Devlieghere Date: 2024-06-17T15:15:28-07:00 New Revision: 0041582b6ca137ad04e26985a87a1ae45fb0f0bb
URL: https://github.com/llvm/llvm-project/commit/0041582b6ca137ad04e26985a87a1ae45fb0f0bb DIFF: https://github.com/llvm/llvm-project/commit/0041582b6ca137ad04e26985a87a1ae45fb0f0bb.diff LOG: [lldb] Fix Python interpreter workaround (attempt #2) On macOS, to make DYLD_INSERT_LIBRARIES and the Python shim work together, we have a workaroud that copies the "real" Python interpreter into the build directory. This doesn't work when running in a virtual environment, as the copied interpreter cannot find the packages installed in the virtual environment relative to itself. Address this issue by copying the Python interpreter into the virtual environment's `bin` folder, rather than the build folder, when the test suite detects that it's being run inside a virtual environment. I'm not thrilled about this solution because it puts a file outside the build directory. However, given virtual environments are considered disposable, this seems reasonable. Added: Modified: lldb/test/API/lit.cfg.py Removed: ################################################################################ diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py index 48c5f49e78e01..6d45508ccb916 100644 --- a/lldb/test/API/lit.cfg.py +++ b/lldb/test/API/lit.cfg.py @@ -63,13 +63,14 @@ def find_python_interpreter(): if "DYLD_INSERT_LIBRARIES" not in config.environment: return None - # If we're running in a virtual environment, we already have a copy of the - # Python executable. + # If we're running in a virtual environment, we have to copy Python into + # the virtual environment for it to work. if sys.prefix != sys.base_prefix: - return None + copied_python = os.path.join(sys.prefix, "bin", "copied-python") + else: + copied_python = os.path.join(config.lldb_build_directory, "copied-python") # Avoid doing any work if we already copied the binary. - copied_python = os.path.join(config.lldb_build_directory, "copied-python") if os.path.isfile(copied_python): return copied_python _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits