diff options
author | Necoro <> | 2007-11-14 17:29:13 +0000 |
---|---|---|
committer | Necoro <> | 2007-11-14 17:29:13 +0000 |
commit | 6429fc12061f1a26d50d1e89250cef8ccb829f60 (patch) | |
tree | e14bee720fb058fc633bcd91741ee2512c0e0f36 /portato/backend/catapult/system.py | |
parent | 1c9de74334d5c7f9209291bb02661f67ca737cc1 (diff) | |
download | portato-6429fc12061f1a26d50d1e89250cef8ccb829f60.tar.gz portato-6429fc12061f1a26d50d1e89250cef8ccb829f60.tar.bz2 portato-6429fc12061f1a26d50d1e89250cef8ccb829f60.zip |
r553@Devoty: necoro | 2007-11-14 18:26:50 +0100
new catapult find API
Diffstat (limited to '')
-rw-r--r-- | portato/backend/catapult/system.py | 71 |
1 files changed, 43 insertions, 28 deletions
diff --git a/portato/backend/catapult/system.py b/portato/backend/catapult/system.py index 4ba9726..da54d07 100644 --- a/portato/backend/catapult/system.py +++ b/portato/backend/catapult/system.py @@ -28,7 +28,7 @@ class CatapultSystem (SystemInterface): self.bus = dbus.SessionBus() # get the system - so = self.bus.get_object("org.gentoo.catapult.portage", "/org/gentoo/catapult/System") + so = self.bus.get_object("org.gentoo.catapult.portage", "/org/gentoo/catapult/System", follow_name_owner_changes = True) self.proxy = dbus.Interface(so, "org.gentoo.catapult.System") def geneticize_list (self, list_of_packages, only_cpv = False): @@ -68,54 +68,67 @@ class CatapultSystem (SystemInterface): return str(p) def find_packages (self, search_key, masked = False, only_cpv = False): - return self.geneticize_list(self.proxy.find_packages(search_key, masked), only_cpv) + return self.geneticize_list(self.proxy.find_packages(search_key, "all", masked, True), only_cpv) def find_installed_packages (self, search_key, masked = False, only_cpv = False): - return self.geneticize_list(self.proxy.find_installed_packages(search_key, masked), only_cpv) + return self.geneticize_list(self.proxy.find_packages(search_key, "installed", masked, True), only_cpv) def find_system_packages (self, only_cpv = False): - - result = self.proxy.find_system_packages() - if only_cpv: - return result - else: - return tuple(map(self.geneticize_list, result)) +# result = self.proxy.find_system_packages() +# if only_cpv: +# return result +# else: +# return tuple(map(self.geneticize_list, result)) + return (self.geneticize_list(self.proxy.find_packages(search_key, "system", False, True), only_cpv), []) def find_world_packages (self, only_cpv = False): - result = self.proxy.find_world_packages() - if only_cpv: - return result - else: - return tuple(map(self.geneticize_list, result)) +# result = self.proxy.find_world_packages() +# if only_cpv: +# return result +# else: +# return tuple(map(self.geneticize_list, result)) + return (self.geneticize_list(self.proxy.find_packages(search_key, "world", False, True), only_cpv), []) def find_all_installed_packages (self, name = None, withVersion = True, only_cpv = False): if not name: - name = "" - return self.geneticize_list(self.proxy.find_all_installed_packages(name, withVersion), (not withVersion) or only_cpv) + name = ".*" + else: + name = ".*%s.*" % name + return self.geneticize_list(self.proxy.find_packages(name, "installed", True, withVersion), (not withVersion) or only_cpv) def find_all_uninstalled_packages (self, name = None, only_cpv = False): if not name: - name = "" - return self.geneticize_list(self.proxy.find_all_uninstalled_packages(name), only_cpv) + name = ".*" + else: + name = ".*%s.*" % name + return self.geneticize_list(self.proxy.find_packages(name, "uninstalled", True, withVersion), (not withVersion) or only_cpv) def find_all_packages (self, name = None, withVersion = True, only_cpv = False): if not name: - name = "" - return self.geneticize_list(self.proxy.find_all_packages(name, withVersion), (not withVersion) or only_cpv) + name = ".*" + else: + name = ".*%s.*" % name + return self.geneticize_list(self.proxy.find_packages(name, "all", True, withVersion), (not withVersion) or only_cpv) def find_all_world_packages (self, name = None, only_cpv = False): if not name: - name = "" - return self.geneticize_list(self.proxy.find_all_world_packages(name), only_cpv) + name = ".*" + else: + name = ".*%s.*" % name + return self.geneticize_list(self.proxy.find_packages(name, "world", True, True), (not withVersion) or only_cpv) def find_all_system_packages (self, name = None, only_cpv = False): if not name: - name = "" - return self.geneticize_list(self.proxy.find_all_system_packages(name), only_cpv) + name = ".*" + else: + name = ".*%s.*" % name + return self.geneticize_list(self.proxy.find_packages(name, "system", True, True), (not withVersion) or only_cpv) def list_categories (self, name = None): if not name: - name = "" + name = ".*" + else: + name = ".*%s.*" % name return [str(x) for x in self.proxy.list_categories(name)] def sort_package_list(self, pkglist): @@ -137,10 +150,10 @@ class CatapultSystem (SystemInterface): e.set() raise ex - self.proxy.update_world(newuse, deep, {}, reply_handler = wait, error_handler = error) + self.proxy.update_world(newuse, deep, {}, reply_handler = wait, error_handler = error, timeout = 300) e.wait() return ret - # return [(CatapultPackage(x), CatapultPackage(y)) for x,y in self.proxy.update_world(newuse, deep, {})] + # return [(CatapultPackage(x), CatapultPackage(y)) for x,y in self.proxy.update_world(newuse, deep, {}, timeout = 300)] def get_updated_packages (self): return self.geneticize_list(self.proxy.get_updated_packages()) @@ -187,4 +200,6 @@ class CatapultSystem (SystemInterface): return [str(x) for x in self.proxy.get_unmerge_option()] def get_environment (self): - return self.proxy.get_environment() + env = self.proxy.get_environment() + env.update(TERM = "xterm") # emulate terminal :) + return env |