mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Use puffin_cache::digest
in another site (#289)
This commit is contained in:
parent
0c9e975f75
commit
2ee555df7b
3 changed files with 1 additions and 11 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2100,11 +2100,9 @@ name = "puffin-distribution"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"hex",
|
|
||||||
"pep440_rs 0.3.12",
|
"pep440_rs 0.3.12",
|
||||||
"puffin-cache",
|
"puffin-cache",
|
||||||
"puffin-package",
|
"puffin-package",
|
||||||
"sha2",
|
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,4 @@ puffin-cache = { path = "../puffin-cache" }
|
||||||
puffin-package = { path = "../puffin-package" }
|
puffin-package = { path = "../puffin-package" }
|
||||||
|
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
hex = { workspace = true }
|
|
||||||
sha2 = { workspace = true }
|
|
||||||
url = { workspace = true }
|
url = { workspace = true }
|
||||||
|
|
|
@ -3,7 +3,6 @@ use std::path::{Path, PathBuf};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use sha2::{Digest, Sha256};
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use pep440_rs::Version;
|
use pep440_rs::Version;
|
||||||
|
@ -358,12 +357,7 @@ impl<'a> RemoteDistributionRef<'a> {
|
||||||
Self::Registry(name, version, _) => {
|
Self::Registry(name, version, _) => {
|
||||||
format!("{}-{}", DistInfoName::from(*name), version)
|
format!("{}-{}", DistInfoName::from(*name), version)
|
||||||
}
|
}
|
||||||
Self::Url(_name, url) => {
|
Self::Url(_name, url) => puffin_cache::digest(&CanonicalUrl::new(url)),
|
||||||
let mut hasher = Sha256::new();
|
|
||||||
hasher.update(url.as_str().as_bytes());
|
|
||||||
let result = hasher.finalize();
|
|
||||||
hex::encode(result)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue