Skip to content
Merged
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
28 changes: 14 additions & 14 deletions wppm/piptree.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,22 +244,22 @@ def up(self, ppw: str, extra: str = "", depth: int = 20, indent: int = 5, versio
"""Generate upward dependency tree as formatted string."""
pp = ppw[:-1] if ppw.endswith('!') else ppw
ppend = "!" if ppw.endswith('!') else "" #show only downward limiting dependancies
ppp = [pp] if pp in self.distro else ()
if pp == ".":
results = [aa for p in sorted(self.distro) if '[requires' in (aa:=self.up(p + ppend, extra, depth, indent, version_req, verbose))]
return '\n'.join(filter(None, results))

if extra == ".":
if pp in self.distro:
extras = set(self.distro[pp]["provided"]).union(set(self.distro[pp]["provides"]))
results = [self.up(pp + ppend, e, depth, indent, version_req, verbose=verbose) for e in sorted(extras)]
return '\n'.join(filter(None, results))
return ""

if pp not in self.distro:
return ""
ppp = [p for p in self.distro]
results = []
for p in sorted(ppp):
if extra == ".":
extras = set(self.distro[p]["provided"]).union(set(self.distro[p]["provides"]))
for e in sorted(extras):
a = self._get_dependency_tree(p, e, version_req, depth, verbose=verbose, upward=True)
results += a if (len(a[0])>1 or ppend=="") else []
else:
a = self._get_dependency_tree(p, extra, version_req, depth, verbose=verbose, upward=True)
results += a if (len(a[0])>1 or extra=="") else []

rawtext = json.dumps(self._get_dependency_tree(pp, extra, version_req, depth, verbose=verbose, upward=True), indent=indent)
lines = [l for l in rawtext.split("\n") if len(l.strip()) > 2 and ( ppend=="" or not "[requires:" in l)]
rawtext = json.dumps(results, indent=indent)
lines = [l[2*indent:] for l in rawtext.split("\n") if len(l.strip()) > 2 and ( ppend=="" or not "[requires:" in l)]
return "\n".join(filter(None, lines)).replace('"', "").replace('[requires :', '[requires:')

def description(self, pp: str) -> None:
Expand Down