summaryrefslogtreecommitdiff
path: root/trunk/src
diff options
context:
space:
mode:
authorkarltk <karltk@gentoo.org>2004-09-27 11:10:16 +0000
committerkarltk <karltk@gentoo.org>2004-09-27 11:10:16 +0000
commit075b83b34d11ffd263cc69311e60cd33f26f54a8 (patch)
treec93bcf7f00f547892e77441d7e9b95e0f1025d48 /trunk/src
parente3a447f30454a07dfc0b47170b75279694d02539 (diff)
downloadgentoolkit-075b83b34d11ffd263cc69311e60cd33f26f54a8.tar.gz
Added find_installed_packages
svn path=/; revision=138
Diffstat (limited to 'trunk/src')
-rw-r--r--trunk/src/gentoolkit/ChangeLog3
-rw-r--r--trunk/src/gentoolkit/gentoolkit.py14
2 files changed, 17 insertions, 0 deletions
diff --git a/trunk/src/gentoolkit/ChangeLog b/trunk/src/gentoolkit/ChangeLog
index dcb7a61..5ea8ae4 100644
--- a/trunk/src/gentoolkit/ChangeLog
+++ b/trunk/src/gentoolkit/ChangeLog
@@ -1,3 +1,6 @@
+2004-09-27: Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Added find_installed_packages
+
2004-09-08: Karl Trygve Kalleberg <karltk@gentoo.org>
* Reworked printing functions
diff --git a/trunk/src/gentoolkit/gentoolkit.py b/trunk/src/gentoolkit/gentoolkit.py
index a7f2f4d..50aad81 100644
--- a/trunk/src/gentoolkit/gentoolkit.py
+++ b/trunk/src/gentoolkit/gentoolkit.py
@@ -215,6 +215,20 @@ def find_packages(search_key, masked=False):
raise ValueError(e)
return [Package(x) for x in t]
+def find_installed_packages(search_key, masked=False):
+ """Returns a list of Package objects that matched the search key."""
+ try:
+ t = vartree.dbapi.match(search_key)
+ # catch the "amgigous package" Exception
+ except ValueError, e:
+ if type(e[0]) == types.ListType:
+ t=[]
+ for cp in e[0]:
+ t += vartree.dbapi.match(cp)
+ else:
+ raise ValueError(e)
+ return [Package(x) for x in t]
+
def find_best_match(search_key):
"""Returns a Package object for the best available installed candidate that
matched the search key. Doesn't handle virtuals perfectly"""