mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-26 20:19:08 +00:00
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:
parent
a3c2a36422
commit
dd4b27bfbd
3 changed files with 8 additions and 10 deletions
|
@ -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.
|
||||
|
|
|
@ -11,8 +11,7 @@ use tracing::debug;
|
|||
use uv_cache::Cache;
|
||||
use uv_client::{Connectivity, FlatIndexClient, RegistryClientBuilder};
|
||||
use uv_configuration::{
|
||||
BuildOptions, Concurrency, Constraints, ExtrasSpecification, LowerBound, Reinstall,
|
||||
TrustedHost, Upgrade,
|
||||
Concurrency, Constraints, ExtrasSpecification, LowerBound, Reinstall, TrustedHost, Upgrade,
|
||||
};
|
||||
use uv_dispatch::BuildDispatch;
|
||||
use uv_distribution::DistributionDatabase;
|
||||
|
@ -531,7 +530,6 @@ async fn do_lock(
|
|||
interpreter,
|
||||
&requires_python,
|
||||
index_locations,
|
||||
build_options,
|
||||
upgrade,
|
||||
&options,
|
||||
&hasher,
|
||||
|
@ -714,7 +712,6 @@ impl ValidatedLock {
|
|||
interpreter: &Interpreter,
|
||||
requires_python: &RequiresPython,
|
||||
index_locations: &IndexLocations,
|
||||
build_options: &BuildOptions,
|
||||
upgrade: &Upgrade,
|
||||
options: &Options,
|
||||
hasher: &HashStrategy,
|
||||
|
@ -841,7 +838,6 @@ impl ValidatedLock {
|
|||
overrides,
|
||||
dependency_metadata,
|
||||
indexes,
|
||||
build_options,
|
||||
interpreter.tags()?,
|
||||
hasher,
|
||||
index,
|
||||
|
|
|
@ -1997,20 +1997,18 @@ fn no_install_project_no_build() -> Result<()> {
|
|||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
warning: Failed to validate existing lockfile: Distribution `project==0.1.0 @ editable+.` can't be installed because it is marked as `--no-build` but has no binary distribution
|
||||
Resolved 4 packages in [TIME]
|
||||
error: Distribution `project==0.1.0 @ editable+.` can't be installed because it is marked as `--no-build` but has no binary distribution
|
||||
"###);
|
||||
|
||||
// But it's fine to combine `--no-install-project` with `--no-build`. We shouldn't error, since
|
||||
// we aren't building the project.
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--no-install-project").arg("--no-build"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--no-install-project").arg("--no-build").arg("--locked"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
warning: Failed to validate existing lockfile: Distribution `project==0.1.0 @ editable+.` can't be installed because it is marked as `--no-build` but has no binary distribution
|
||||
Resolved 4 packages in [TIME]
|
||||
Prepared 3 packages in [TIME]
|
||||
Installed 3 packages in [TIME]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue