From 7dbc1688b550510b6777acbbbcfea8e02ba34ed2 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 18 Jun 2024 08:07:49 -0700 Subject: [PATCH] [lldb] Extend Python interpreter workaround to Xcode Python (attempt #2.5) The Python interpreter in Xcode cannot be copied because of a relative RPATH. Our workaround would just use that Python interpreter directly when it detects this. For the reasons explained in my previous commit, that doesn't work in a virtual environment. Address this case by creating a symlink to the "real" interpreter in the virtual environment. --- lldb/test/API/lit.cfg.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py index 6d45508ccb916d..96520c7c826246 100644 --- a/lldb/test/API/lit.cfg.py +++ b/lldb/test/API/lit.cfg.py @@ -99,10 +99,11 @@ def find_python_interpreter(): except subprocess.CalledProcessError: # The copied Python didn't work. Assume we're dealing with the Python # interpreter in Xcode. Given that this is not a system binary SIP - # won't prevent us form injecting the interceptors so we get away with - # not copying the executable. + # won't prevent us form injecting the interceptors, but when running in + # a virtual environment, we can't use it directly. Create a symlink + # instead. os.remove(copied_python) - return real_python + os.symlink(real_python, copied_python) # The copied Python works. return copied_python