def packages_to_graph(self, targets):
G = nx.DiGraph()
for package in targets:
G.add_node(package)
for dep_name in package.dependecies:
q = Query(dep_name)
dep_package = self._find_satisfier_in_set(targets, q)
if dep_package is None:
# Swallow the error, since this is expected in some cases
continue
# raise Exception(
# "Tried to make a graph out of packages that "
# "have unresolved dependencies: " + str(q)
# )
G.add_edge(package, dep_package)
return G
评论列表
文章目录