def __init__(self): PackageInfo.__init__(self) self._cache = None self._ready = False self._timeout_id = None # setup monitor watch for install/remove changes self.apt_finished_stamp = Gio.File.new_for_path( self.APT_FINISHED_STAMP) self.apt_finished_monitor = self.apt_finished_stamp.monitor_file( 0, None) self.apt_finished_monitor.connect("changed", self._on_apt_finished_stamp_changed) # this is fast, so ok self._language_packages = self._read_language_pkgs() # query the totalize on install using aptdaemon try: self.aptd_client = AptClient() except Exception as e: self.aptd_client = None logging.error("Can not get aptdaemon client: '%s', no " "size information will be available " % e) self._aptd_trans = None
def __init__(self, replacement): GObject.GObject.__init__(self) self.replacement = replacement self.apt_client = AptClient()
def __init__(self): super(PackageInstaller, self).__init__() self._client = AptClient()
def run(t): if WITH_GUI: dia = AptProgressDialog(t) dia.run() dia.destroy() else: t.run() if __name__ == "__main__": #logging.basicConfig(level=logging.DEBUG) context = GObject.main_context_default() c = AptClient() for i in range(100): print "inst: 3dchess" t = c.install_packages(["3dchess"], exit_handler=exit_handler) run(t) active += 1 print "inst: 2vcard" t = c.install_packages(["2vcard"], exit_handler=exit_handler) run(t) active += 1 print "rm: 3dchess 2vcard" t = c.remove_packages(["3dchess", "2vcard"], exit_handler=exit_handler) run(t)
#!/usr/bin/python import aptdaemon, sys, gettext from aptdaemon.client import AptClient # i18n gettext.install("mintinstall", "/usr/share/linuxmint/locale") if len(sys.argv) == 3: operation = sys.argv[1] package = sys.argv[2] aptd_client = AptClient() if operation == "install": transaction = aptd_client.install_packages([package]) transaction.set_meta_data(mintinstall_label=_("Installing %s") % package) elif operation == "remove": transaction = aptd_client.remove_packages([package]) transaction.set_meta_data(mintinstall_label=_("Removing %s") % package) else: print "Invalid operation: %s" % operation sys.exit(1) transaction.set_meta_data(mintinstall_pkgname=package) transaction.run()
def __init__(self): self.apt_client = AptClient() self.apt_transaction = None self.packages = [] self.loop = None
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2016 Johnathan "Shaggytwodope" Jenkins <*****@*****.**> # # Distributed under terms of the GPL2 license. import sys from gi.repository import GLib from aptdaemon.client import AptClient loop = GLib.MainLoop() aptclient = AptClient() def on_finished_update(trans, exit): if exit == "exit-success": print("successful cache update") loop.quit() sys.exit(0) else: print("error updating cache") sys.exit(1) return True def do_update(): trans_update = aptclient.update_cache() trans_update.connect("finished", on_finished_update) trans_update.run()