Skip to content

Commit 7dbc168

Browse files
committed
[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.
1 parent 3eb4128 commit 7dbc168

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lldb/test/API/lit.cfg.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,11 @@ def find_python_interpreter():
9999
except subprocess.CalledProcessError:
100100
# The copied Python didn't work. Assume we're dealing with the Python
101101
# interpreter in Xcode. Given that this is not a system binary SIP
102-
# won't prevent us form injecting the interceptors so we get away with
103-
# not copying the executable.
102+
# won't prevent us form injecting the interceptors, but when running in
103+
# a virtual environment, we can't use it directly. Create a symlink
104+
# instead.
104105
os.remove(copied_python)
105-
return real_python
106+
os.symlink(real_python, copied_python)
106107

107108
# The copied Python works.
108109
return copied_python

0 commit comments

Comments
 (0)