Respect --find-links in lock and sync (#4183)

## Summary

We already respect this command-line argument, I just forgot to wire it
up to the resolver.
This commit is contained in:
Charlie Marsh 2024-06-09 18:42:52 -07:00 committed by GitHub
parent 7ef362d93c
commit 04717e1a92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 4 deletions

View file

@ -3,7 +3,7 @@ use anstream::eprint;
use distribution_types::{IndexLocations, UnresolvedRequirementSpecification};
use install_wheel_rs::linker::LinkMode;
use uv_cache::Cache;
use uv_client::RegistryClientBuilder;
use uv_client::{FlatIndexClient, RegistryClientBuilder};
use uv_configuration::{
Concurrency, ConfigSettings, ExtrasSpecification, NoBinary, NoBuild, PreviewMode, Reinstall,
SetupPyStrategy, Upgrade,
@ -155,7 +155,6 @@ pub(super) async fn do_lock(
let concurrency = Concurrency::default();
let config_settings = ConfigSettings::default();
let extras = ExtrasSpecification::default();
let flat_index = FlatIndex::default();
let in_flight = InFlight::default();
let index = InMemoryIndex::default();
let link_mode = LinkMode::default();
@ -167,6 +166,13 @@ pub(super) async fn do_lock(
let hasher = HashStrategy::Generate;
let options = OptionsBuilder::new().exclude_newer(exclude_newer).build();
// Resolve the flat indexes from `--find-links`.
let flat_index = {
let client = FlatIndexClient::new(&client, cache);
let entries = client.fetch(index_locations.flat_index()).await?;
FlatIndex::from_entries(entries, tags, &hasher, &no_build, &no_binary)
};
// If an existing lockfile exists, build up a set of preferences.
let LockedRequirements { preferences, git } = read_lockfile(workspace, &upgrade).await?;

View file

@ -45,6 +45,9 @@ pub(crate) enum ProjectError {
#[error(transparent)]
Tags(#[from] platform_tags::TagsError),
#[error(transparent)]
FlatIndex(#[from] uv_client::FlatIndexError),
#[error(transparent)]
Lock(#[from] uv_resolver::LockError),

View file

@ -3,7 +3,7 @@ use anyhow::Result;
use distribution_types::IndexLocations;
use install_wheel_rs::linker::LinkMode;
use uv_cache::Cache;
use uv_client::RegistryClientBuilder;
use uv_client::{FlatIndexClient, RegistryClientBuilder};
use uv_configuration::{
Concurrency, ConfigSettings, ExtrasSpecification, NoBinary, NoBuild, PreviewMode, Reinstall,
SetupPyStrategy,
@ -116,7 +116,6 @@ pub(super) async fn do_sync(
let concurrency = Concurrency::default();
let config_settings = ConfigSettings::default();
let dry_run = false;
let flat_index = FlatIndex::default();
let git = GitResolver::default();
let hasher = HashStrategy::default();
let in_flight = InFlight::default();
@ -127,6 +126,13 @@ pub(super) async fn do_sync(
let reinstall = Reinstall::default();
let setup_py = SetupPyStrategy::default();
// Resolve the flat indexes from `--find-links`.
let flat_index = {
let client = FlatIndexClient::new(&client, cache);
let entries = client.fetch(index_locations.flat_index()).await?;
FlatIndex::from_entries(entries, tags, &hasher, &no_build, &no_binary)
};
// Create a build dispatch.
let build_dispatch = BuildDispatch::new(
&client,