@@ -40,6 +40,14 @@ def find_sdist(
4040 req : Requirement ,
4141 dist_version : str ,
4242) -> pathlib .Path | None :
43+ """Find an sdist archive in downloads_dir for the given requirement.
44+
45+ First checks for a plugin-provided exact filename. If no plugin match,
46+ tries four naming conventions (underscore-normalized, canonical, original,
47+ and dotted) with case-insensitive comparison to handle inconsistent
48+ sdist naming across the Python ecosystem. Case-insensitive globbing
49+ is not available before Python 3.12.
50+ """
4351 sdist_file_name = overrides .find_and_invoke (
4452 req .name ,
4553 "expected_source_archive_name" ,
@@ -95,6 +103,13 @@ def find_wheel(
95103 dist_version : str ,
96104 build_tag : BuildTag = (),
97105) -> pathlib .Path | None :
106+ """Find a wheel file in downloads_dir for the given requirement.
107+
108+ Tries four naming conventions (PEP 427 transformed, canonical, original,
109+ and dotted), each suffixed with the build tag when present. Uses
110+ case-insensitive ``startswith`` matching rather than exact base comparison
111+ because wheel filenames include platform/Python tags after the version.
112+ """
98113 filename_prefix = _dist_name_to_filename (req .name )
99114 canonical_name = canonicalize_name (req .name )
100115 # if build tag is 0 then we can ignore to handle non tagged wheels for backward compatibility
@@ -140,6 +155,15 @@ def find_source_dir(
140155 req : Requirement ,
141156 dist_version : str ,
142157) -> pathlib .Path | None :
158+ """Find the unpacked source directory for a requirement.
159+
160+ Tries three strategies in order:
161+ 1. Plugin override providing the exact directory name
162+ 2. Derive from the sdist archive name (strip extension), assuming the
163+ unpacked layout is ``<base>/<base>/`` (double-nested)
164+ 3. Fall back to four naming conventions with case-insensitive matching,
165+ returning ``<match>/<match>/`` (same double-nested convention)
166+ """
143167 sdir_name_func = overrides .find_override_method (
144168 req .name , "expected_source_directory_name"
145169 )
0 commit comments