aptdaemon might not always be awailable

This commit is contained in:
Tobias Schmidl 2020-09-21 08:13:35 +02:00
parent 479057b7f5
commit 8f705ab8bc

View file

@ -11,7 +11,6 @@
# <bitbar.dependencies>python,aptdaemon,apt</bitbar.dependencies> # <bitbar.dependencies>python,aptdaemon,apt</bitbar.dependencies>
# <bitbar.abouturl>https://github.com/schtobia/argos-httping/blob/master/httping.py</bitbar.abouturl> # <bitbar.abouturl>https://github.com/schtobia/argos-httping/blob/master/httping.py</bitbar.abouturl>
from aptdaemon import client
from apt import Cache from apt import Cache
import sys import sys
@ -28,8 +27,13 @@ class Themes:
original = ["#acacac","#ff0101","#cc673b","#ce8458","#6bbb15","#0ed812"] original = ["#acacac","#ff0101","#cc673b","#ce8458","#6bbb15","#0ed812"]
selected_colors = red_green selected_colors = red_green
try:
from aptdaemon import client
apt_client = client.AptClient() apt_client = client.AptClient()
apt_client.update_cache(wait=True) apt_client.update_cache(wait=True)
except ImportError as err:
print(str(err), file=sys.stderr)
cache = Cache() cache = Cache()
cache.open() cache.open()
update_list = [pkg for pkg in cache if pkg.is_upgradable] update_list = [pkg for pkg in cache if pkg.is_upgradable]