Avoid displaying "failed to download" on build failures for local source distributions (#6075)

Especially with workspace members (e.g., [this new test
case](https://github.com/astral-sh/uv/pull/6073/files#diff-273076013b4f5a8139defd5dcd24f5d1eb91c0266dceb4448fdeddceb79f7738R1377-R1379)),
I find it very confusing that we say we failed to download these
distributions.
This commit is contained in:
Zanie Blue 2024-08-14 17:27:55 -05:00 committed by GitHub
parent dc67023677
commit 359f39ca0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 25 additions and 23 deletions

View file

@ -46,8 +46,8 @@ pub enum Error {
CacheEncode(#[from] rmp_serde::encode::Error),
// Build error
#[error("Failed to build: `{0}`")]
Build(String, #[source] anyhow::Error),
#[error(transparent)]
Build(anyhow::Error),
#[error("Failed to build editable: `{0}`")]
BuildEditable(String, #[source] anyhow::Error),
#[error("Built wheel has an invalid filename")]

View file

@ -1464,10 +1464,10 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
},
)
.await
.map_err(|err| Error::Build(source.to_string(), err))?
.map_err(Error::Build)?
.wheel(cache_shard)
.await
.map_err(|err| Error::Build(source.to_string(), err))?;
.map_err(Error::Build)?;
// Read the metadata from the wheel.
let filename = WheelFilename::from_str(&disk_filename)?;
@ -1555,13 +1555,10 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
},
)
.await
.map_err(|err| Error::Build(source.to_string(), err))?;
.map_err(Error::Build)?;
// Build the metadata.
let dist_info = builder
.metadata()
.await
.map_err(|err| Error::Build(source.to_string(), err))?;
let dist_info = builder.metadata().await.map_err(Error::Build)?;
let Some(dist_info) = dist_info else {
return Ok(None);
};