Update notifications for pacman, cower, yaourt.

These modules are also runnable directly from terminal.
This commit is contained in:
ncoop 2016-06-21 15:49:56 -07:00
parent ae1274d5d3
commit 9d907732f1
4 changed files with 24 additions and 6 deletions

View File

@ -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))

View File

@ -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))

View File

@ -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))

View File

@ -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))