From 13ccf8895cbde1b8235a30812b52de2ad1d28418 Mon Sep 17 00:00:00 2001 From: Jonathan Tammo Siebert Date: Sun, 18 Dec 2016 15:00:59 +0100 Subject: [PATCH] Made updates method return types consistent Changed the return types of aptget and yaourt to (int, string) from (int, list) to ensure consistency across all update backends and fixing the desktop notification for available updates. --- i3pystatus/updates/aptget.py | 6 +++--- i3pystatus/updates/yaourt.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/i3pystatus/updates/aptget.py b/i3pystatus/updates/aptget.py index 936d265..9938300 100644 --- a/i3pystatus/updates/aptget.py +++ b/i3pystatus/updates/aptget.py @@ -23,9 +23,9 @@ class AptGet(Backend): command = "apt-get upgrade -s -o Dir::State::Lists=" + cache_dir apt = run_through_shell(command.split()) - out = apt.out.splitlines() - out = [line[5:] for line in out if line.startswith("Inst ")] - return len(out), out + out = apt.out.splitlines(True) + out = "".join([line[5:] for line in out if line.startswith("Inst ")]) + return out.count("\n"), out Backend = AptGet diff --git a/i3pystatus/updates/yaourt.py b/i3pystatus/updates/yaourt.py index 9489a42..8855f31 100644 --- a/i3pystatus/updates/yaourt.py +++ b/i3pystatus/updates/yaourt.py @@ -14,8 +14,7 @@ class Yaourt(Backend): status.register("updates", backends = \ [pacman.Pacman(), yaourt.Yaourt()]) - If you want to count both pacman and aur packages with this module you can - set the variable count_only_aur = False like this: + To count both pacman and aur packages, pass False in the constructor: .. code-block:: python @@ -32,7 +31,8 @@ class Yaourt(Backend): checkupdates = run_through_shell(command) out = checkupdates.out 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 Backend = Yaourt