Merge pull request #506 from jotasi/consistentUpdateBackends

Made updates method return types consistent and fixed bug in yaourt backend
This commit is contained in:
enkore 2017-01-11 12:31:03 +01:00 committed by GitHub
commit ecda539de1
2 changed files with 6 additions and 6 deletions

View File

@ -23,9 +23,9 @@ class AptGet(Backend):
command = "apt-get upgrade -s -o Dir::State::Lists=" + cache_dir command = "apt-get upgrade -s -o Dir::State::Lists=" + cache_dir
apt = run_through_shell(command.split()) apt = run_through_shell(command.split())
out = apt.out.splitlines() out = apt.out.splitlines(True)
out = [line[5:] for line in out if line.startswith("Inst ")] out = "".join([line[5:] for line in out if line.startswith("Inst ")])
return len(out), out return out.count("\n"), out
Backend = AptGet Backend = AptGet

View File

@ -14,8 +14,7 @@ class Yaourt(Backend):
status.register("updates", backends = \ status.register("updates", backends = \
[pacman.Pacman(), yaourt.Yaourt()]) [pacman.Pacman(), yaourt.Yaourt()])
If you want to count both pacman and aur packages with this module you can To count both pacman and aur packages, pass False in the constructor:
set the variable count_only_aur = False like this:
.. code-block:: python .. code-block:: python
@ -32,7 +31,8 @@ class Yaourt(Backend):
checkupdates = run_through_shell(command) checkupdates = run_through_shell(command)
out = checkupdates.out out = checkupdates.out
if(self.aur_only): if(self.aur_only):
out = [line for line in out if line.startswith("aur")] out = "".join([line for line in out.splitlines(True)
if line.startswith("aur")])
return out.count("\n"), out return out.count("\n"), out
Backend = Yaourt Backend = Yaourt