Simplified pacman
and cower
backends.
Fixed bug in `aptget` backend.
This commit is contained in:
parent
3496a7bae5
commit
96ef3656c8
@ -63,7 +63,6 @@ class Updates(IntervalModule):
|
|||||||
def init(self):
|
def init(self):
|
||||||
if not isinstance(self.backends, list):
|
if not isinstance(self.backends, list):
|
||||||
self.backends = [self.backends]
|
self.backends = [self.backends]
|
||||||
return
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not internet():
|
if not internet():
|
||||||
@ -88,4 +87,3 @@ class Updates(IntervalModule):
|
|||||||
"full_text": formatp(self.format, **fdict).strip(),
|
"full_text": formatp(self.format, **fdict).strip(),
|
||||||
"color": self.color,
|
"color": self.color,
|
||||||
}
|
}
|
||||||
return
|
|
||||||
|
@ -19,9 +19,9 @@ class AptGet(Backend):
|
|||||||
os.mkdir(cache_dir)
|
os.mkdir(cache_dir)
|
||||||
|
|
||||||
command = "apt-get update -o Dir::State::Lists=" + cache_dir
|
command = "apt-get update -o Dir::State::Lists=" + cache_dir
|
||||||
run_through_shell(command)
|
run_through_shell(command.split())
|
||||||
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)
|
apt = run_through_shell(command.split())
|
||||||
|
|
||||||
update_count = 0
|
update_count = 0
|
||||||
for line in apt.out.split("\n"):
|
for line in apt.out.split("\n"):
|
||||||
|
@ -13,8 +13,6 @@ class Cower(Backend):
|
|||||||
def updates(self):
|
def updates(self):
|
||||||
command = ["cower", "-u"]
|
command = ["cower", "-u"]
|
||||||
cower = run_through_shell(command)
|
cower = run_through_shell(command)
|
||||||
out = cower.out.strip()
|
return cower.out.count('\n')
|
||||||
|
|
||||||
return len(out.split("\n")) if len(out) > 0 else 0
|
|
||||||
|
|
||||||
Backend = Cower
|
Backend = Cower
|
||||||
|
@ -12,8 +12,6 @@ class Pacman(Backend):
|
|||||||
def updates(self):
|
def updates(self):
|
||||||
command = ["checkupdates"]
|
command = ["checkupdates"]
|
||||||
checkupdates = run_through_shell(command)
|
checkupdates = run_through_shell(command)
|
||||||
out = checkupdates.out.strip()
|
return checkupdates.out.count('\n')
|
||||||
|
|
||||||
return len(out.split("\n")) if len(out) > 0 else 0
|
|
||||||
|
|
||||||
Backend = Pacman
|
Backend = Pacman
|
||||||
|
Loading…
Reference in New Issue
Block a user