-
Notifications
You must be signed in to change notification settings - Fork 870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defer reporting of build failures in resolver #9098
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
use std::future::Future; | ||
use std::sync::Arc; | ||
|
||
use uv_configuration::BuildOptions; | ||
use uv_distribution::{ArchiveMetadata, DistributionDatabase}; | ||
|
@@ -46,6 +47,8 @@ pub enum MetadataResponse { | |
/// The source distribution has a `requires-python` requirement that is not met by the installed | ||
/// Python version (and static metadata is not available). | ||
RequiresPython(VersionSpecifiers, Version), | ||
/// The distribution could not be built or downloaded. | ||
Error(Box<Dist>, Arc<uv_distribution::Error>), | ||
} | ||
|
||
pub trait ResolverProvider { | ||
|
@@ -210,7 +213,10 @@ impl<'a, Context: BuildContext> ResolverProvider for DefaultResolverProvider<'a, | |
uv_distribution::Error::RequiresPython(requires_python, version) => { | ||
Ok(MetadataResponse::RequiresPython(requires_python, version)) | ||
} | ||
err => Err(err), | ||
err => Ok(MetadataResponse::Error( | ||
Box::new(dist.clone()), | ||
Arc::new(err), | ||
)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method now _never_returns an error. But I left it as a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM |
||
}, | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I can avoid this
Arc
... I need to be able to clone this, because it's stored in theOnceMap
, but then needs to be cloned to be returned as aResult
in the resolver. Anduv_distribution::Error
doesn't implementClone
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arc
inside an error is totally natural: https://github.com/BurntSushi/jiff/blob/16376c7175bca14a8ccb37a178bde92598af1a5f/src/error.rs#L47-L57The main alternative here, and one I would suggest if possible, is to make
uv_distribution::Error
embed anArc
internally so that it can implementClone
itself. Then you don't need to spreadArc
s out everywhere else.