Use the proper singular form for workspace member dependencies in resolver errors (#6128)

This commit is contained in:
Zanie Blue 2024-08-15 16:08:41 -05:00 committed by GitHub
parent db33497974
commit fb6b3ff410
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -1058,6 +1058,15 @@ impl PackageRange<'_> {
/// be singular or plural e.g. if false use "<range> depends on <...>" and /// be singular or plural e.g. if false use "<range> depends on <...>" and
/// if true use "<range> depend on <...>" /// if true use "<range> depend on <...>"
fn plural(&self) -> bool { fn plural(&self) -> bool {
// If a workspace member, always use the singular form (otherwise, it'd be "all versions of")
if self
.formatter
.and_then(|formatter| formatter.format_workspace_member(self.package))
.is_some()
{
return false;
}
let mut segments = self.range.iter(); let mut segments = self.range.iter();
if let Some(segment) = segments.next() { if let Some(segment) = segments.next() {
// A single unbounded compatibility segment is always plural ("all versions of"). // A single unbounded compatibility segment is always plural ("all versions of").

View File

@ -1381,7 +1381,7 @@ fn workspace_unsatisfiable_member_dependencies_conflicting_extra() -> Result<()>
----- stderr ----- ----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12] Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
× No solution found when resolving dependencies: × No solution found when resolving dependencies:
Because only bar is available and bar depends on anyio==4.2.0, we can conclude that bar depend on anyio==4.2.0. Because only bar is available and bar depends on anyio==4.2.0, we can conclude that bar depends on anyio==4.2.0.
And because foo depends on anyio==4.1.0, we can conclude that foo and bar are incompatible. And because foo depends on anyio==4.1.0, we can conclude that foo and bar are incompatible.
And because your workspace requires bar and foo, we can conclude that your workspace's requirements are unsatisfiable. And because your workspace requires bar and foo, we can conclude that your workspace's requirements are unsatisfiable.
"### "###
@ -1440,7 +1440,7 @@ fn workspace_unsatisfiable_member_dependencies_conflicting_dev() -> Result<()> {
----- stderr ----- ----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12] Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
× No solution found when resolving dependencies: × No solution found when resolving dependencies:
Because bar depends on bar and bar depends on anyio==4.2.0, we can conclude that bar depend on anyio==4.2.0. Because bar depends on bar and bar depends on anyio==4.2.0, we can conclude that bar depends on anyio==4.2.0.
And because foo depends on anyio==4.1.0, we can conclude that bar and foo are incompatible. And because foo depends on anyio==4.1.0, we can conclude that bar and foo are incompatible.
And because your workspace requires bar and foo, we can conclude that your workspace's requirements are unsatisfiable. And because your workspace requires bar and foo, we can conclude that your workspace's requirements are unsatisfiable.
"### "###