Skip to content

Commit

Permalink
Show unsatisfied requirements in view (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb authored Dec 13, 2023
1 parent ad488c7 commit e7b061a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/packse/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand All @@ -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)

Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/test_scenarios.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
requires-does-not-exist-6ea3a390
└── a-1.0.0
└── requires b
└── unsatisfied


''',
Expand Down

0 comments on commit e7b061a

Please sign in to comment.