Skip to content

Commit

Permalink
[lldb] Extend Python interpreter workaround to Xcode Python (attempt r…
Browse files Browse the repository at this point in the history
…ust-lang#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.
  • Loading branch information
JDevlieghere committed Jun 18, 2024
1 parent 3eb4128 commit 7dbc168
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lldb/test/API/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7dbc168

Please sign in to comment.