Use hasher to compute resolution hash (#5495)

## Summary

Addressing one TODO. This should be more efficient.
This commit is contained in:
Charlie Marsh 2024-07-26 19:24:09 -04:00 committed by GitHub
parent e8d7c0cb58
commit 561625ed8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 78 additions and 69 deletions

View file

@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
use url::Url;
use cache_key::{digest, CanonicalUrl};
use cache_key::{cache_digest, CanonicalUrl};
use distribution_types::IndexUrl;
/// Cache wheels and their metadata, both from remote wheels and built from source distributions.
@ -30,19 +30,19 @@ impl<'a> WheelCache<'a> {
WheelCache::Index(IndexUrl::Pypi(_)) => WheelCacheKind::Pypi.root(),
WheelCache::Index(url) => WheelCacheKind::Index
.root()
.join(digest(&CanonicalUrl::new(url))),
.join(cache_digest(&CanonicalUrl::new(url))),
WheelCache::Url(url) => WheelCacheKind::Url
.root()
.join(digest(&CanonicalUrl::new(url))),
.join(cache_digest(&CanonicalUrl::new(url))),
WheelCache::Path(url) => WheelCacheKind::Path
.root()
.join(digest(&CanonicalUrl::new(url))),
.join(cache_digest(&CanonicalUrl::new(url))),
WheelCache::Editable(url) => WheelCacheKind::Editable
.root()
.join(digest(&CanonicalUrl::new(url))),
.join(cache_digest(&CanonicalUrl::new(url))),
WheelCache::Git(url, sha) => WheelCacheKind::Git
.root()
.join(digest(&CanonicalUrl::new(url)))
.join(cache_digest(&CanonicalUrl::new(url)))
.join(sha),
}
}