diff options
| author | karltk <karltk@gentoo.org> | 2004-09-27 11:10:16 +0000 |
|---|---|---|
| committer | karltk <karltk@gentoo.org> | 2004-09-27 11:10:16 +0000 |
| commit | 075b83b34d11ffd263cc69311e60cd33f26f54a8 (patch) | |
| tree | c93bcf7f00f547892e77441d7e9b95e0f1025d48 /trunk/src | |
| parent | e3a447f30454a07dfc0b47170b75279694d02539 (diff) | |
| download | gentoolkit-075b83b34d11ffd263cc69311e60cd33f26f54a8.tar.gz | |
Added find_installed_packages
svn path=/; revision=138
Diffstat (limited to 'trunk/src')
| -rw-r--r-- | trunk/src/gentoolkit/ChangeLog | 3 | ||||
| -rw-r--r-- | trunk/src/gentoolkit/gentoolkit.py | 14 |
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""" |
