From e7b061a03075d5aa8fdc89e0eeedf57f724101a5 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 13 Dec 2023 16:21:48 -0600 Subject: [PATCH] Show unsatisfied requirements in `view` (#5) --- src/packse/view.py | 7 +++++++ tests/__snapshots__/test_scenarios.ambr | 1 + 2 files changed, 8 insertions(+) diff --git a/src/packse/view.py b/src/packse/view.py index ad29eeec..b91a1bb8 100644 --- a/src/packse/view.py +++ b/src/packse/view.py @@ -57,10 +57,12 @@ def render_package_versions( versions = scenario.packages[package].versions pointers = [tee] * (len(versions) - 1) + [last] + satisfied = False for pointer, version in zip(pointers, versions): if for_requirement and not for_requirement.specifier.contains(version): continue + satisfied = True message = "satisfied by " if for_requirement else "" yield prefix + pointer + message + f"{package}-{version}" @@ -69,6 +71,9 @@ def render_package_versions( package, version, prefix=prefix + extension ) + if for_requirement and not satisfied: + yield prefix + last + "unsatisfied" + def render_requirements_for(package: str, version: str, prefix: str = ""): requirements = list(scenario.packages[package].versions[version].requires) @@ -84,6 +89,8 @@ def render_requirements_for(package: str, version: str, prefix: str = ""): prefix=prefix + extension, for_requirement=parsed_requirement, ) + else: + yield prefix + space + last + "unsatisfied" for line in render_package_versions(scenario.root): buffer += line + "\n" diff --git a/tests/__snapshots__/test_scenarios.ambr b/tests/__snapshots__/test_scenarios.ambr index 7c4904c9..b8178034 100644 --- a/tests/__snapshots__/test_scenarios.ambr +++ b/tests/__snapshots__/test_scenarios.ambr @@ -76,6 +76,7 @@ requires-does-not-exist-6ea3a390 └── a-1.0.0 └── requires b + └── unsatisfied ''',