[llvm-branch-commits] [lldb] 60b7a2d - Revert "[lldb] Change Python site-packages path (#207771)"
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jul 7 00:06:02 PDT 2026
Author: Nikita Popov
Date: 2026-07-07T09:05:58+02:00
New Revision: 60b7a2dbadbd22e9dfc428d887c42fb37eb534fd
URL: https://github.com/llvm/llvm-project/commit/60b7a2dbadbd22e9dfc428d887c42fb37eb534fd
DIFF: https://github.com/llvm/llvm-project/commit/60b7a2dbadbd22e9dfc428d887c42fb37eb534fd.diff
LOG: Revert "[lldb] Change Python site-packages path (#207771)"
This reverts commit 8475e376043ddacc53b7062c71438ea4e2a082e0.
Added:
Modified:
lldb/bindings/python/get-python-config.py
Removed:
################################################################################
diff --git a/lldb/bindings/python/get-python-config.py b/lldb/bindings/python/get-python-config.py
index b2e54c3ee3773..5575f3a4c90bd 100755
--- a/lldb/bindings/python/get-python-config.py
+++ b/lldb/bindings/python/get-python-config.py
@@ -26,13 +26,25 @@ def main():
# LLDB_PYTHON_RELATIVE_PATH is the relative path from lldb's prefix
# to where lldb's python libraries will be installed.
#
- # This will always be lib/site-packages (or lib\site-packages).
- if os.name == "posix":
- print("lib/site-packages")
- elif os.name == "nt":
- print("Lib\\site-packages")
- else:
- raise
+ # The way we're going to compute this is to take the relative path from
+ # PYTHON'S prefix to where python libraries are supposed to be
+ # installed.
+ #
+ # The result is if LLDB and python are give the same prefix, then
+ # lldb's python lib will be put in the correct place for python to find it.
+ # If not, you'll have to use lldb -P or lldb -print-script-interpreter-info
+ # to figure out where it is.
+ try:
+ print(relpath_nodots(sysconfig.get_path("platlib"), sys.prefix))
+ except ValueError:
+ # Try to fall back to something reasonable if sysconfig's platlib
+ # is outside of sys.prefix
+ if os.name == "posix":
+ print("lib/python%d.%d/site-packages" % sys.version_info[:2])
+ elif os.name == "nt":
+ print("Lib\\site-packages")
+ else:
+ raise
elif args.variable_name == "LLDB_PYTHON_EXE_RELATIVE_PATH":
tried = list()
exe = sys.executable
More information about the llvm-branch-commits
mailing list