uv/crates/distribution-filename/src
Severen Redwood f8bda467fa
Lift requirement that .egg-info filenames must include version (#6179)
## Summary

PR #4533 introduced (almost) spec compliant parsing of `.egg-info`
filenames, but added the overly strict requirement that the distribution
version must be present. This causes various `uv pip` operations to fail
in environments where there are `.egg-info` files without a version
component, so loosen this check by making the version component optional
and reading the version from the egg metadata when it is not present.

As an example of the issue, running `uv pip list` on my system currently
results in
```
error: Failed to read metadata from: `/usr/lib/python3.12/site-packages/PySide6.egg-info`
  Caused by: The `.egg-info` filename "PySide6.egg-info" is missing a version
```
whereas regular `pip list` succeeds:
```
$ pip list | rg -S pyside
PySide6                   6.7.2
```

## Test Plan

This has been tested by altering the `.egg-info` filename tests as
needed and ensuring the full test suite passes locally.
2024-08-18 13:04:40 -04:00
..
snapshots Represent build tag as u64 (#4253) 2024-06-11 21:40:08 +00:00
build_tag.rs Represent build tag as u64 (#4253) 2024-06-11 21:40:08 +00:00
egg.rs Lift requirement that .egg-info filenames must include version (#6179) 2024-08-18 13:04:40 -04:00
extension.rs Enforce extension validity at parse time (#5888) 2024-08-08 21:39:47 -04:00
lib.rs Enforce extension validity at parse time (#5888) 2024-08-08 21:39:47 -04:00
source_dist.rs Enforce extension validity at parse time (#5888) 2024-08-08 21:39:47 -04:00
wheel.rs Match wheel tags against Requires-Python major-minor (#5289) 2024-07-22 14:33:53 +00:00