[Lldb-commits] [lldb] 7dbc168 - [lldb] Extend Python interpreter workaround to Xcode Python (attempt #2.5)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 18 08:12:16 PDT 2024


Author: Jonas Devlieghere
Date: 2024-06-18T08:12:11-07:00
New Revision: 7dbc1688b550510b6777acbbbcfea8e02ba34ed2

URL: https://github.com/llvm/llvm-project/commit/7dbc1688b550510b6777acbbbcfea8e02ba34ed2
DIFF: https://github.com/llvm/llvm-project/commit/7dbc1688b550510b6777acbbbcfea8e02ba34ed2.diff

LOG: [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.

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 6d45508ccb916..96520c7c82624 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


        


More information about the lldb-commits mailing list