Author: tedwoodward
Date: 2026-07-06T17:49:31-05:00
New Revision: 8475e376043ddacc53b7062c71438ea4e2a082e0

URL: 
https://github.com/llvm/llvm-project/commit/8475e376043ddacc53b7062c71438ea4e2a082e0
DIFF: 
https://github.com/llvm/llvm-project/commit/8475e376043ddacc53b7062c71438ea4e2a082e0.diff

LOG: [lldb] Change Python site-packages path (#207771)

On POSIX systems, traditionally the lldb Python module is in
lib/pythonx.x/site-packages. We only ever have 1 Python in a given
build, so we don't need to specify the version.

On Windows, we've always had the Python module in lib\site-packages.

Change the behavior on POSIX to match the Windows behavior, and put the
lldb Python module in lib/site-packages.

---------

Co-authored-by: Ted Woodward <[email protected]>

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 5575f3a4c90bd..b2e54c3ee3773 100755
--- a/lldb/bindings/python/get-python-config.py
+++ b/lldb/bindings/python/get-python-config.py
@@ -26,25 +26,13 @@ def main():
         # LLDB_PYTHON_RELATIVE_PATH is the relative path from lldb's prefix
         # to where lldb's python libraries will be installed.
         #
-        # 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
+        # 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
     elif args.variable_name == "LLDB_PYTHON_EXE_RELATIVE_PATH":
         tried = list()
         exe = sys.executable


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to