Start printing before all descriptions are loaded

This commit is contained in:
Midgard 2020-07-12 12:42:12 +02:00
parent ef51e93127
commit de5ba7a533
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -115,8 +115,7 @@ def description_from_ebuild(path):
def ebuild_info(path, repos): def ebuild_info(path, repos):
m = re.fullmatch(r"(.+)/([^/]+)/([^/]+)/\3-([^/]+)\.ebuild", path) m = re.fullmatch(r"(.+)/([^/]+)/([^/]+)/\3-([^/]+)\.ebuild", path)
if not m: assert m, path
print(path)
PN = f"{m.group(2)}/{m.group(3)}" PN = f"{m.group(2)}/{m.group(3)}"
PV = f"{m.group(4)}" PV = f"{m.group(4)}"
@ -129,9 +128,15 @@ def ebuild_info(path, repos):
"repo": first((name for name, path in repos if path == m.group(1))), "repo": first((name for name, path in repos if path == m.group(1))),
"repo_path": m.group(1), "repo_path": m.group(1),
"ebuild_path": path, "ebuild_path": path,
"description": description_from_ebuild(path), }
"installed": os.path.exists(f"/var/db/pkg/{PN}-{PV}"),
} if m else None
def ebuild_extra_info(info):
return {
**info,
"description": description_from_ebuild(info["ebuild_path"]),
"installed": os.path.exists(f"/var/db/pkg/{info['P']}"),
}
# Formatting # Formatting
@ -187,7 +192,8 @@ def main(argv):
for x in data: for x in data:
print(format_item( print(format_item(
x, longest_cat=longest_cat, longest_namever=longest_namever, default_repo=default ebuild_extra_info(x),
longest_cat=longest_cat, longest_namever=longest_namever, default_repo=default
)) ))
return 0 return 0