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],
|
overrides: &[Requirement],
|
||||||
dependency_metadata: &DependencyMetadata,
|
dependency_metadata: &DependencyMetadata,
|
||||||
indexes: Option<&IndexLocations>,
|
indexes: Option<&IndexLocations>,
|
||||||
build_options: &BuildOptions,
|
|
||||||
tags: &Tags,
|
tags: &Tags,
|
||||||
hasher: &HashStrategy,
|
hasher: &HashStrategy,
|
||||||
index: &InMemoryIndex,
|
index: &InMemoryIndex,
|
||||||
|
@ -1183,8 +1182,13 @@ impl Lock {
|
||||||
// Get the metadata for the distribution.
|
// Get the metadata for the distribution.
|
||||||
let dist = package.to_dist(
|
let dist = package.to_dist(
|
||||||
workspace.install_path(),
|
workspace.install_path(),
|
||||||
|
// When validating, it's okay to use wheels that don't match the current platform.
|
||||||
TagPolicy::Preferred(tags),
|
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.
|
// Fetch the metadata for the distribution.
|
||||||
|
|
|
@ -11,8 +11,7 @@ use tracing::debug;
|
||||||
use uv_cache::Cache;
|
use uv_cache::Cache;
|
||||||
use uv_client::{Connectivity, FlatIndexClient, RegistryClientBuilder};
|
use uv_client::{Connectivity, FlatIndexClient, RegistryClientBuilder};
|
||||||
use uv_configuration::{
|
use uv_configuration::{
|
||||||
BuildOptions, Concurrency, Constraints, ExtrasSpecification, LowerBound, Reinstall,
|
Concurrency, Constraints, ExtrasSpecification, LowerBound, Reinstall, TrustedHost, Upgrade,
|
||||||
TrustedHost, Upgrade,
|
|
||||||
};
|
};
|
||||||
use uv_dispatch::BuildDispatch;
|
use uv_dispatch::BuildDispatch;
|
||||||
use uv_distribution::DistributionDatabase;
|
use uv_distribution::DistributionDatabase;
|
||||||
|
@ -531,7 +530,6 @@ async fn do_lock(
|
||||||
interpreter,
|
interpreter,
|
||||||
&requires_python,
|
&requires_python,
|
||||||
index_locations,
|
index_locations,
|
||||||
build_options,
|
|
||||||
upgrade,
|
upgrade,
|
||||||
&options,
|
&options,
|
||||||
&hasher,
|
&hasher,
|
||||||
|
@ -714,7 +712,6 @@ impl ValidatedLock {
|
||||||
interpreter: &Interpreter,
|
interpreter: &Interpreter,
|
||||||
requires_python: &RequiresPython,
|
requires_python: &RequiresPython,
|
||||||
index_locations: &IndexLocations,
|
index_locations: &IndexLocations,
|
||||||
build_options: &BuildOptions,
|
|
||||||
upgrade: &Upgrade,
|
upgrade: &Upgrade,
|
||||||
options: &Options,
|
options: &Options,
|
||||||
hasher: &HashStrategy,
|
hasher: &HashStrategy,
|
||||||
|
@ -841,7 +838,6 @@ impl ValidatedLock {
|
||||||
overrides,
|
overrides,
|
||||||
dependency_metadata,
|
dependency_metadata,
|
||||||
indexes,
|
indexes,
|
||||||
build_options,
|
|
||||||
interpreter.tags()?,
|
interpreter.tags()?,
|
||||||
hasher,
|
hasher,
|
||||||
index,
|
index,
|
||||||
|
|
|
@ -1997,20 +1997,18 @@ fn no_install_project_no_build() -> Result<()> {
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- 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]
|
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
|
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
|
// But it's fine to combine `--no-install-project` with `--no-build`. We shouldn't error, since
|
||||||
// we aren't building the project.
|
// 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
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- 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]
|
Resolved 4 packages in [TIME]
|
||||||
Prepared 3 packages in [TIME]
|
Prepared 3 packages in [TIME]
|
||||||
Installed 3 packages in [TIME]
|
Installed 3 packages in [TIME]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue