From 8369cddf5852cead5731c1746a73b1331c8f65ca Mon Sep 17 00:00:00 2001 From: Tobias Schmidl Date: Mon, 21 Sep 2020 08:13:28 +0200 Subject: [PATCH] Added initial version --- apt.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 apt.py diff --git a/apt.py b/apt.py new file mode 100755 index 0000000..db22508 --- /dev/null +++ b/apt.py @@ -0,0 +1,43 @@ +#! /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://github.com/schtobia/argos-httping/blob/master/httping.py + +from aptdaemon import client +import apt +import sys + +__author__ = "Tobias Schmidl" +__copyright__ = "Copyright 2018, Tobias Schmidl" +__license__ = "MIT" +__version__ = "0.0.1" +__maintainer__ = "Tobias Schmidl" + +class 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"] + selected_colors = red_green + +apt_client = client.AptClient() +apt_client.update_cache(wait=True) +cache = apt.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") +