From: Richard Si <sichard26@gmail.com>
Date: Tue, 21 Jul 2026 05:38:28 -0400
Subject: Use os.path.commonpath over commonprefix (#345)

commonprefix was deprecated in Python 3.15 as it does a
character-by-character check which is 99% likely to be not what you
actually want.

commonpath does the sane thing of returning only valid paths (aka
respecting the directory structure).
---
 src/installer/_core.py   | 2 +-
 src/installer/sources.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Index: python-installer/src/installer/_core.py
===================================================================
--- python-installer.orig/src/installer/_core.py
+++ python-installer/src/installer/_core.py
@@ -42,7 +42,7 @@ def _determine_scheme(
     data_dir = source.data_dir
 
     # If it's in not `{distribution}-{version}.data`, then it's in root_scheme.
-    if posixpath.commonprefix([data_dir, path]) != data_dir:
+    if posixpath.commonpath([data_dir, path]) != data_dir:
         return root_scheme, path
 
     # Figure out which scheme this goes to.
Index: python-installer/src/installer/sources.py
===================================================================
--- python-installer.orig/src/installer/sources.py
+++ python-installer/src/installer/sources.py
@@ -220,7 +220,7 @@ class WheelFile(WheelSource):
             name[len(base) + 1 :]
             for name in self._zipfile.namelist()
             if name[-1:] != "/"
-            if base == posixpath.commonprefix([name, base])
+            if base == posixpath.commonpath([name, base])
         ]
 
     def read_dist_info(self, filename: str) -> str:
@@ -259,7 +259,7 @@ class WheelFile(WheelSource):
 
             record_args = record_mapping.pop(item.filename, None)
 
-            if self.dist_info_dir == posixpath.commonprefix(
+            if self.dist_info_dir == posixpath.commonpath(
                 [self.dist_info_dir, item.filename]
             ) and item.filename.split("/")[-1] in ("RECORD.p7s", "RECORD.jws"):
                 # both are for digital signatures, and not mentioned in RECORD
