Skip to content

Commit

Permalink
Respect --find-links in lock
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jun 10, 2024
1 parent 7ef362d commit 0eb4847
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
10 changes: 8 additions & 2 deletions crates/uv/src/commands/project/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand All @@ -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?;

Expand Down
3 changes: 3 additions & 0 deletions crates/uv/src/commands/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down
10 changes: 8 additions & 2 deletions crates/uv/src/commands/project/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand All @@ -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,
Expand Down

0 comments on commit 0eb4847

Please sign in to comment.