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
/// if true use "<range> depend on <...>"
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();
if let Some(segment) = segments.next() {
// 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 -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
× 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 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 -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
× 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 your workspace requires bar and foo, we can conclude that your workspace's requirements are unsatisfiable.
"###