Skip to content

Commit

Permalink
Fix #170: correct problems with get_required_dists.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsajip committed Jul 9, 2022
1 parent dde0c83 commit 0f4e0f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions distlib/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1314,18 +1314,19 @@ def get_required_dists(dists, dist):
:param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested
in finding the dependencies.
"""
if dist not in dists:
raise DistlibException('given distribution %r is not a member '
'of the list' % dist.name)
graph = make_graph(dists)

req = [] # required distributions
req = set() # required distributions
todo = graph.adjacency_list[dist] # list of nodes we should inspect

while todo:
d = todo.pop()[0]
req.append(d)
req.add(d)
for pred in graph.adjacency_list[d]:
if pred not in req:
todo.append(pred)
Expand Down

0 comments on commit 0f4e0f9

Please sign in to comment.