[modules/pacman] quotes
This commit is contained in:
parent
543def72ee
commit
2586e4e78c
1 changed files with 8 additions and 8 deletions
|
@ -3,7 +3,7 @@
|
||||||
"""Displays update information per repository for pacman.
|
"""Displays update information per repository for pacman.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
* pacman.sum: If you prefere displaying updates with a single digit (defaults to "False")
|
* pacman.sum: If you prefere displaying updates with a single digit (defaults to 'False')
|
||||||
|
|
||||||
Requires the following executables:
|
Requires the following executables:
|
||||||
* fakeroot
|
* fakeroot
|
||||||
|
@ -20,13 +20,13 @@ import bumblebee.engine
|
||||||
|
|
||||||
#list of repositories.
|
#list of repositories.
|
||||||
#the last one should always be other
|
#the last one should always be other
|
||||||
repos = ["core", "extra", "community", "multilib", "testing", "other"]
|
repos = ['core', 'extra', 'community', 'multilib', 'testing', 'other']
|
||||||
|
|
||||||
def get_pacman_info(widget, path):
|
def get_pacman_info(widget, path):
|
||||||
try:
|
try:
|
||||||
cmd = "{}/../../bin/pacman-updates".format(path)
|
cmd = '{}/../../bin/pacman-updates'.format(path)
|
||||||
if not os.path.exists(cmd):
|
if not os.path.exists(cmd):
|
||||||
cmd = "/usr/share/bumblebee-status/bin/pacman-update"
|
cmd = '/usr/share/bumblebee-status/bin/pacman-update'
|
||||||
result = bumblebee.util.execute(cmd)
|
result = bumblebee.util.execute(cmd)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -34,9 +34,9 @@ def get_pacman_info(widget, path):
|
||||||
count = len(repos)*[0]
|
count = len(repos)*[0]
|
||||||
|
|
||||||
for line in result.splitlines():
|
for line in result.splitlines():
|
||||||
if line.startswith(("http", "rsync")):
|
if line.startswith(('http', 'rsync')):
|
||||||
for i in range(len(repos)-1):
|
for i in range(len(repos)-1):
|
||||||
if "/" + repos[i] + "/" in line:
|
if '/' + repos[i] + '/' in line:
|
||||||
count[i] += 1
|
count[i] += 1
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
@ -54,7 +54,7 @@ class Module(bumblebee.engine.Module):
|
||||||
self._count = 0
|
self._count = 0
|
||||||
|
|
||||||
def updates(self, widget):
|
def updates(self, widget):
|
||||||
if bumblebee.util.asbool(self.parameter("sum")):
|
if bumblebee.util.asbool(self.parameter('sum')):
|
||||||
return str(sum(map(lambda x: widget.get(x, 0), repos)))
|
return str(sum(map(lambda x: widget.get(x, 0), repos)))
|
||||||
return '/'.join(map(lambda x: str(widget.get(x, 0)), repos))
|
return '/'.join(map(lambda x: str(widget.get(x, 0)), repos))
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class Module(bumblebee.engine.Module):
|
||||||
weightedCount = sum(map(lambda x: (len(repos)-x[0]) * widget.get(x[1], 0), enumerate(repos)))
|
weightedCount = sum(map(lambda x: (len(repos)-x[0]) * widget.get(x[1], 0), enumerate(repos)))
|
||||||
|
|
||||||
if weightedCount < 10:
|
if weightedCount < 10:
|
||||||
return "good"
|
return 'good'
|
||||||
|
|
||||||
return self.threshold_state(weightedCount, 100, 150)
|
return self.threshold_state(weightedCount, 100, 150)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue