Update notifications for pacman, cower, yaourt.
These modules are also runnable directly from terminal.
This commit is contained in:
parent
ae1274d5d3
commit
9d907732f1
@ -13,6 +13,12 @@ class Cower(Backend):
|
||||
def updates(self):
|
||||
command = ["cower", "-u"]
|
||||
cower = run_through_shell(command)
|
||||
return cower.out.count('\n')
|
||||
return cower.out.count('\n'), cower.out
|
||||
|
||||
Backend = Cower
|
||||
|
||||
if __name__ == "__main__":
|
||||
"""
|
||||
Call this module directly; Print the update count and notification body.
|
||||
"""
|
||||
print("Updates: {}\n\n{}".format(*Backend().updates))
|
||||
|
@ -35,5 +35,4 @@ if __name__ == "__main__":
|
||||
"""
|
||||
Call this module directly; Print the update count and notification body.
|
||||
"""
|
||||
dnf = Dnf()
|
||||
print("Updates: {}\n\n{}".format(*dnf.updates))
|
||||
print("Updates: {}\n\n{}".format(*Backend().updates))
|
||||
|
@ -12,6 +12,12 @@ class Pacman(Backend):
|
||||
def updates(self):
|
||||
command = ["checkupdates"]
|
||||
checkupdates = run_through_shell(command)
|
||||
return checkupdates.out.count('\n')
|
||||
return checkupdates.out.count("\n"), checkupdates.out
|
||||
|
||||
Backend = Pacman
|
||||
|
||||
if __name__ == "__main__":
|
||||
"""
|
||||
Call this module directly; Print the update count and notification body.
|
||||
"""
|
||||
print("Updates: {}\n\n{}".format(*Backend().updates))
|
||||
|
@ -25,8 +25,15 @@ class Yaourt(Backend):
|
||||
def updates(self):
|
||||
command = ["yaourt", "-Qua"]
|
||||
checkupdates = run_through_shell(command)
|
||||
out = checkupdates.out
|
||||
if(self.aur_only):
|
||||
return len(re.findall("^aur/", checkupdates.out, flags=re.M))
|
||||
return checkupdates.out.count("\n")
|
||||
out = [line for line in out if line.startswith("aur")]
|
||||
return out.count("\n"), out
|
||||
|
||||
Backend = Yaourt
|
||||
|
||||
if __name__ == "__main__":
|
||||
"""
|
||||
Call this module directly; Print the update count and notification body.
|
||||
"""
|
||||
print("Updates: {}\n\n{}".format(*Backend().updates))
|
||||
|
Loading…
Reference in New Issue
Block a user