Respect --no-index with --find-links in pip sync (#2692)

## Summary

In `pip sync`, we weren't properly handling cases in which a package
_only_ existed in `--find-links` (e.g., the user passed `--offline` or
`--no-index`).

I plan to explore removing `Finder` entirely to avoid these mismatch
bugs between `pip sync` and other commands, but this is fine for now.

Closes https://github.com/astral-sh/uv/issues/2688.

## Test Plan

`cargo test`
This commit is contained in:
Charlie Marsh 2024-03-27 12:15:14 -04:00 committed by GitHub
parent 384355bb57
commit dc957d7322
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 137 additions and 5 deletions

View file

@ -23,6 +23,11 @@ impl Error {
*self.kind
}
/// Get a reference to the [`ErrorKind`] variant of this error.
pub fn kind(&self) -> &ErrorKind {
&self.kind
}
/// Create a new error from a JSON parsing error.
pub(crate) fn from_json_err(err: serde_json::Error, url: Url) -> Self {
ErrorKind::BadJson { source: err, url }.into()