rendering 'info' list fields | better AUR 'optional deps' presentation

This commit is contained in:
Vinicius Moreira
2019-09-20 15:37:10 -03:00
parent b72590287d
commit 57e17c79d8
2 changed files with 12 additions and 2 deletions

View File

@@ -3,6 +3,8 @@ from typing import List, Set
from bauh.commons.system import run_cmd, new_subprocess, new_root_subprocess, SystemProcess
RE_DEPS = re.compile(r'[\w\-_]+:[\s\w_\-\.]+\s+\[\w+\]')
def is_enabled() -> bool:
try:
@@ -48,12 +50,15 @@ def get_info_dict(pkg_name: str) -> dict:
if info_list:
info_dict = {}
for info_data in info_list:
attr = info_data[0].lower()
attr = info_data[0].lower().strip()
info_dict[attr] = info_data[1] if '\n' not in info_data[1] else ' '.join([l.strip() for l in info_data[1].split('\n')])
if info_dict[attr] == 'None':
info_dict[attr] = None
if attr == 'optional deps' and info_dict[attr]:
info_dict[attr] = RE_DEPS.findall(info_dict[attr])
return info_dict