find_wheel() constructs four candidate name prefixes in a set and uses startswith to match wheel filenames. It returns the first match without validating the build tag -- the caller (_look_for_existing_wheel) re-parses the filename to verify.
The naming guesses (PEP 427 transformed, canonical, original, dotted) are useful for find_sdists as they are needed because upstream sdist archives have inconsistent naming that fromager does not control. However, find_wheel only searches wheels_build/ and wheels_downloads/, both populated by fromager with well-formed PEP 427 filenames produced by the build backend and wheel pack. The guesses are unnecessary.
Additional issues with the current implementation:
set iteration order is undefined, so the implied name convention priority is not guaranteed
If multiple wheels exist with different build tags, the first match is returned without validation; the caller rejects it and the correct wheel is never tried. This could be issue for build_tag_hook feature where wheel with suffixed and unsuffixed build_tags may coexist.
Comments referencing Python < 3.12 case-insensitive globbing workarounds are dead code since requires-python >= 3.12
Proposal
Replace the prefix matching with parse_wheel_filename() + canonicalize_name() and validate the build tag inside the finder. Signature unchanged. _look_for_existing_wheel can then drop its redundant build tag re-check.tag
find_wheel() constructs four candidate name prefixes in a set and uses startswith to match wheel filenames. It returns the first match without validating the build tag -- the caller (_look_for_existing_wheel) re-parses the filename to verify.
The naming guesses (PEP 427 transformed, canonical, original, dotted) are useful for find_sdists as they are needed because upstream sdist archives have inconsistent naming that fromager does not control. However, find_wheel only searches wheels_build/ and wheels_downloads/, both populated by fromager with well-formed PEP 427 filenames produced by the build backend and wheel pack. The guesses are unnecessary.
Additional issues with the current implementation:
set iteration order is undefined, so the implied name convention priority is not guaranteed
If multiple wheels exist with different build tags, the first match is returned without validation; the caller rejects it and the correct wheel is never tried. This could be issue for build_tag_hook feature where wheel with suffixed and unsuffixed build_tags may coexist.
Comments referencing Python < 3.12 case-insensitive globbing workarounds are dead code since requires-python >= 3.12
Proposal
Replace the prefix matching with parse_wheel_filename() + canonicalize_name() and validate the build tag inside the finder. Signature unchanged. _look_for_existing_wheel can then drop its redundant build tag re-check.tag