Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow multiple matching solvables in print-reldeps #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions depchase
Original file line number Diff line number Diff line change
Expand Up @@ -479,17 +479,21 @@ def print_reldeps(ctx, pkg):
sel = pool.select(pkg, solv.Selection.SELECTION_NAME)
assert not sel.isempty(), "Package can't be found"
found = sel.solvables()
assert len(found) == 1, "More matching solvables were found, {}".format(found)
s = found[0]

reldep2str = {solv.SOLVABLE_REQUIRES: "requires",
solv.SOLVABLE_RECOMMENDS: "recommends",
solv.SOLVABLE_SUGGESTS: "suggests",
solv.SOLVABLE_SUPPLEMENTS: "supplements",
solv.SOLVABLE_ENHANCES: "enhances"}
for reltype, relstr in reldep2str.items():
for dep in s.lookup_deparray(reltype):
print("{}: {}".format(relstr, dep))

for i, s in enumerate(found):
if len(found) > 1:
if (i > 0):
print()
print("Solution #{}:".format(i + 1))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will make things non-parseable...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and it's actually not solution in any way ;)

for reltype, relstr in reldep2str.items():
for dep in s.lookup_deparray(reltype):
print("{}: {}".format(relstr, dep))

if __name__ == "__main__":
cli(obj={})