Add handling for formatting `UnusableVersions` incompatibility

This commit is contained in:
Zanie 2023-12-12 17:16:21 -06:00
parent 4fb2e0955e
commit 844dd0a14e
3 changed files with 21 additions and 2 deletions

2
Cargo.lock generated
View File

@ -2229,7 +2229,7 @@ dependencies = [
[[package]]
name = "pubgrub"
version = "0.2.1"
source = "git+https://github.com/zanieb/pubgrub?rev=a1d584a5e506b8f0a600269373190c4a35b298d5#a1d584a5e506b8f0a600269373190c4a35b298d5"
source = "git+https://github.com/zanieb/pubgrub?rev=92a14f37192aa5cc5d48efe901546c7f7b4810b7#92a14f37192aa5cc5d48efe901546c7f7b4810b7"
dependencies = [
"indexmap 2.1.0",
"log",

View File

@ -51,7 +51,7 @@ once_cell = { version = "1.18.0" }
petgraph = { version = "0.6.4" }
platform-info = { version = "2.0.2" }
plist = { version = "1.6.0" }
pubgrub = { git = "https://github.com/zanieb/pubgrub", rev = "a1d584a5e506b8f0a600269373190c4a35b298d5" }
pubgrub = { git = "https://github.com/zanieb/pubgrub", rev = "92a14f37192aa5cc5d48efe901546c7f7b4810b7" }
pyo3 = { version = "0.20.0" }
pyo3-log = { version = "0.9.0"}
pyproject-toml = { version = "0.8.0" }

View File

@ -33,6 +33,25 @@ impl ReportFormatter<PubGrubPackage, Range<PubGrubVersion>> for PubGrubReportFor
format!("dependencies of {package} at version {set} are unavailable")
}
}
External::UnusableVersions(package, set, reason) => {
if let Some(reason) = reason {
if matches!(package, PubGrubPackage::Root(_)) {
format!("{package} is unusable: {reason}")
} else {
if set == &Range::full() {
format!("all versions of {package} are unusable: {reason}")
} else {
format!("{package}{set} is unusable: {reason}",)
}
}
} else {
if set == &Range::full() {
format!("all versions of {package} are unusable")
} else {
format!("{package}{set} is unusable")
}
}
}
External::UnusableDependencies(package, set, reason) => {
if let Some(reason) = reason {
if matches!(package, PubGrubPackage::Root(_)) {