mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
Compare virtual members when invalidating lockfile (#6754)
## Summary Whether a package is itself virtual isn't captured in the package metadata, so we have to compare the sources. Closes https://github.com/astral-sh/uv/issues/6749.
This commit is contained in:
parent
1309f24c43
commit
6a8da7dff8
3 changed files with 295 additions and 1 deletions
|
@ -751,6 +751,22 @@ impl Lock {
|
|||
}
|
||||
}
|
||||
|
||||
// Validate that the member sources have not changed (e.g., switched from packaged to
|
||||
// virtual).
|
||||
{
|
||||
for (name, member) in workspace.packages() {
|
||||
let expected = !member.pyproject_toml().is_package();
|
||||
let actual = self
|
||||
.find_by_name(name)
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|package| matches!(package.id.source, Source::Virtual(_)));
|
||||
if actual.map_or(true, |actual| actual != expected) {
|
||||
return Ok(SatisfiesResult::MismatchedSources(name.clone(), expected));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate that the lockfile was generated with the same requirements.
|
||||
{
|
||||
let expected: BTreeSet<_> = requirements
|
||||
|
@ -1030,6 +1046,8 @@ pub enum SatisfiesResult<'lock> {
|
|||
Satisfied,
|
||||
/// The lockfile uses a different set of workspace members.
|
||||
MismatchedMembers(BTreeSet<PackageName>, &'lock BTreeSet<PackageName>),
|
||||
/// The lockfile uses a different set of sources for its workspace members.
|
||||
MismatchedSources(PackageName, bool),
|
||||
/// The lockfile uses a different set of requirements.
|
||||
MismatchedRequirements(BTreeSet<Requirement>, BTreeSet<Requirement>),
|
||||
/// The lockfile uses a different set of constraints.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue