Avoid reading stale .egg-info from mutable sources (#6714)

## Summary

In theory this problem already existed for `PKG-INFO`, but `egg-info`
would be more common, I think, since it's built in the source tree.

Closes https://github.com/astral-sh/uv/issues/6712.
This commit is contained in:
Charlie Marsh 2024-08-27 15:23:26 -04:00 committed by GitHub
parent a999303d2f
commit 14074f8775
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 88 additions and 0 deletions

View file

@ -1529,6 +1529,12 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
Err(err) => return Err(err),
}
// If the source distribution is a source tree, avoid reading `PKG-INFO` or `egg-info`,
// since they could be out-of-date.
if source.is_source_tree() {
return Ok(None);
}
// Attempt to read static metadata from the `PKG-INFO` file.
match read_pkg_info(source_root, subdirectory).await {
Ok(metadata) => {