Not all lines after the second are updates.
There are 14 here: ``` Last metadata expiration check: 1:16:29 ago on Sat Apr 9 01:14:36 2016. google-chrome-stable.x86_64 49.0.2623.112-1 google-chrome kernel.x86_64 4.4.6-301.fc23 updates kernel-core.x86_64 4.4.6-301.fc23 updates kernel-debug-devel.x86_64 4.4.6-301.fc23 updates kernel-devel.x86_64 4.4.6-301.fc23 updates kernel-headers.x86_64 4.4.6-301.fc23 updates kernel-modules.x86_64 4.4.6-301.fc23 updates kernel-modules-extra.x86_64 4.4.6-301.fc23 updates openssh.x86_64 7.2p2-2.fc23 updates openssh-askpass.x86_64 7.2p2-2.fc23 updates openssh-clients.x86_64 7.2p2-2.fc23 updates openssh-server.x86_64 7.2p2-2.fc23 updates webkitgtk3.x86_64 2.4.10-2.fc23 updates Obsoleting Packages kernel-headers.x86_64 4.4.6-301.fc23 updates kernel-headers.x86_64 4.4.6-300.fc23 @updates ```
This commit is contained in:
parent
c33a798b86
commit
52ef0e07df
@ -1,5 +1,6 @@
|
|||||||
from i3pystatus.core.command import run_through_shell
|
from i3pystatus.core.command import run_through_shell
|
||||||
from i3pystatus.updates import Backend
|
from i3pystatus.updates import Backend
|
||||||
|
from re import split
|
||||||
|
|
||||||
|
|
||||||
class Dnf(Backend):
|
class Dnf(Backend):
|
||||||
@ -16,7 +17,9 @@ class Dnf(Backend):
|
|||||||
|
|
||||||
update_count = 0
|
update_count = 0
|
||||||
if dnf.rc == 100:
|
if dnf.rc == 100:
|
||||||
update_count = len(dnf.out.split("\n")[2:-1])
|
lines = dnf.out.splitlines()[2:]
|
||||||
|
lines = [l for l in lines if len(split("\s{2,}", l.rstrip())) == 3]
|
||||||
|
update_count = len(lines)
|
||||||
return update_count
|
return update_count
|
||||||
|
|
||||||
Backend = Dnf
|
Backend = Dnf
|
||||||
|
Loading…
Reference in New Issue
Block a user