summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-03-02 21:27:46 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-03-02 21:27:46 +0100
commit3cd0926203e1a6e7c8bd50a8195336c85daf9f25 (patch)
treedab2502fc327646e64e834e66cb4776ee3f38028
parent3f02f33cc7bd3546453d22d072131218d5cdc1d0 (diff)
downloadportato-3cd0926203e1a6e7c8bd50a8195336c85daf9f25.tar.gz
portato-3cd0926203e1a6e7c8bd50a8195336c85daf9f25.tar.bz2
portato-3cd0926203e1a6e7c8bd50a8195336c85daf9f25.zip
Fix search
Diffstat (limited to '')
-rw-r--r--portato/backend/portage/sets.py14
-rw-r--r--portato/gui/windows/main.py3
2 files changed, 14 insertions, 3 deletions
diff --git a/portato/backend/portage/sets.py b/portato/backend/portage/sets.py
index dd8257d..234047b 100644
--- a/portato/backend/portage/sets.py
+++ b/portato/backend/portage/sets.py
@@ -28,7 +28,7 @@ class Set(object):
def find (self, key, masked = False, with_version = True, only_cpv = False):
if key is None: key = ""
- is_regexp = key == "" or ("*" in key and key[0] not in ("*","=","<",">","~","!"))
+ is_regexp = key == "" or ("*" in key[1:] and key[0] not in ("=","<",">","~","!"))
try:
t = self.get_pkgs(key, is_regexp, masked, with_version, only_cpv)
@@ -99,9 +99,12 @@ class InstalledSet (Set):
if key:
t = filter(lambda x: re.search(key, x, re.I), t)
- return set(t)
else:
- return set(system.settings.vartree.dbapi.match(key))
+ t = system.settings.vartree.dbapi.match(key)
+ if not with_version:
+ t = itt.imap(portage.dep.dep_getkey, t)
+
+ return set(t)
class TreeSet (Set):
@@ -115,11 +118,16 @@ class TreeSet (Set):
if key:
t = filter(lambda x: re.search(key, x, re.I), t)
+ return set(t)
+
elif masked:
t = system.settings.porttree.dbapi.xmatch("match-all", key)
else:
t = system.settings.porttree.dbapi.match(key)
+ if not with_version:
+ t = itt.imap(portage.dep.dep_getkey, t)
+
return set(t)
class AllSet (Set):
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 793d1b6..5b3bf7e 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -1646,6 +1646,9 @@ class MainWindow (Window):
"""Do a search."""
text = entry.get_text()
if text != "":
+ if not "*" in text:
+ text = ".*%s.*" % text
+
packages = system.find_packages(text, with_version = False)
if packages == []: