#! /usr/bin/env python3 # -*- coding: utf-8 -*- """Get apt updates for `argos `.""" # apt # v1.0 # Tobias Schmidl # schtobia # Greps and displays system updates. # # python,aptdaemon,apt # https://gitlab.com/schtobia/argos-apt/blob/master/argos-apt.py import sys from apt import Cache __author__ = "Tobias Schmidl" __copyright__ = "Copyright 2021, Tobias Schmidl" __license__ = "MIT" __version__ = "1.0" __maintainer__ = "Tobias Schmidl" THEMES = { # Themes are from http://colorbrewer2.org/ "purple_green": ["#762a83", "#9970ab", "#c2a5cf", "#a6dba0", "#5aae61", "#1b7837"], "red_green": ["#d73027", "#fc8d59", "#fee08b", "#d9ef8b", "#91cf60", "#1a9850"], "original": ["#acacac", "#ff0101", "#cc673b", "#ce8458", "#6bbb15", "#0ed812"] } CURRENT_THEME = THEMES["red_green"] if __name__ == "__main__": try: from aptdaemon import client apt_client = client.AptClient() apt_client.update_cache(wait=True) except ImportError as err: # print(str(err), file=sys.stderr) pass cache = Cache() cache.open() update_list = [pkg for pkg in cache if pkg.is_upgradable] if len(update_list) == 0: print('apt: ✔\n----\nclean | font = monospace') sys.exit(0) else: print('apt: ✦ pending\n----') for pkg in update_list: print(pkg.name + ": " + pkg.installed.version + " → " + pkg.candidate.version + " | font = monospace")