fix: not checking provided package names when checking if a giving optional dependency is installed

This commit is contained in:
Vinicius Moreira
2019-09-19 16:49:07 -03:00
parent 94031588b0
commit 51ce8723d7
2 changed files with 6 additions and 2 deletions

View File

@@ -407,8 +407,7 @@ class ArchManager(SoftwareManager):
if not odeps:
return True
installed = pacman.list_installed()
to_install = {d for d in odeps if d not in installed}
to_install = {d for d in odeps if not pacman.check_installed(d)}
if not to_install:
return True

View File

@@ -61,6 +61,11 @@ def list_installed() -> Set[str]:
return {out.decode().strip() for out in new_subprocess(['pacman', '-Qq']).stdout if out}
def check_installed(pkg: str) -> bool:
res = run_cmd('pacman -Qq ' + pkg, print_error=False)
return bool(res)
def list_and_map_installed() -> dict: # returns a dict with with package names as keys and versions as values
installed = new_subprocess(['pacman', '-Qq']).stdout # retrieving all installed package names
allinfo = new_subprocess(['pacman', '-Qi'], stdin=installed).stdout # retrieving all installed packages info