Skip to content

Commit 2cbec6f

Browse files
authored
Merge pull request #2029 from stonebig/master
remove un-needed left spaces on wppm -r output
2 parents 334718e + 3898353 commit 2cbec6f

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

wppm/piptree.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -244,22 +244,22 @@ def up(self, ppw: str, extra: str = "", depth: int = 20, indent: int = 5, versio
244244
"""Generate upward dependency tree as formatted string."""
245245
pp = ppw[:-1] if ppw.endswith('!') else ppw
246246
ppend = "!" if ppw.endswith('!') else "" #show only downward limiting dependancies
247+
ppp = [pp] if pp in self.distro else ()
247248
if pp == ".":
248-
results = [aa for p in sorted(self.distro) if '[requires' in (aa:=self.up(p + ppend, extra, depth, indent, version_req, verbose))]
249-
return '\n'.join(filter(None, results))
250-
251-
if extra == ".":
252-
if pp in self.distro:
253-
extras = set(self.distro[pp]["provided"]).union(set(self.distro[pp]["provides"]))
254-
results = [self.up(pp + ppend, e, depth, indent, version_req, verbose=verbose) for e in sorted(extras)]
255-
return '\n'.join(filter(None, results))
256-
return ""
257-
258-
if pp not in self.distro:
259-
return ""
249+
ppp = [p for p in self.distro]
250+
results = []
251+
for p in sorted(ppp):
252+
if extra == ".":
253+
extras = set(self.distro[p]["provided"]).union(set(self.distro[p]["provides"]))
254+
for e in sorted(extras):
255+
a = self._get_dependency_tree(p, e, version_req, depth, verbose=verbose, upward=True)
256+
results += a if (len(a[0])>1 or ppend=="") else []
257+
else:
258+
a = self._get_dependency_tree(p, extra, version_req, depth, verbose=verbose, upward=True)
259+
results += a if (len(a[0])>1 or extra=="") else []
260260

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

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

0 commit comments

Comments
 (0)