Allow --no-build to validate lock (#9024)

## Summary

Just as we don't enforce tag compliance, we shouldn't enforce
`--no-build` when validating the lockfile. If we end up building from
source, the distribution database will correctly error.

Closes https://github.com/astral-sh/uv/issues/9016.
This commit is contained in:
Charlie Marsh 2024-11-11 14:02:37 -05:00 committed by GitHub
parent a3c2a36422
commit dd4b27bfbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 10 deletions

View file

@ -974,7 +974,6 @@ impl Lock {
overrides: &[Requirement],
dependency_metadata: &DependencyMetadata,
indexes: Option<&IndexLocations>,
build_options: &BuildOptions,
tags: &Tags,
hasher: &HashStrategy,
index: &InMemoryIndex,
@ -1183,8 +1182,13 @@ impl Lock {
// Get the metadata for the distribution.
let dist = package.to_dist(
workspace.install_path(),
// When validating, it's okay to use wheels that don't match the current platform.
TagPolicy::Preferred(tags),
build_options,
// When validating, it's okay to use (e.g.) a source distribution with `--no-build`.
// We're just trying to determine whether the lockfile is up-to-date. If we end
// up needing to build a source distribution in order to do so, below, we'll error
// there.
&BuildOptions::default(),
)?;
// Fetch the metadata for the distribution.