From f45cb0d5e7537640190833b103614d0280b74a09 Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 4 Sep 2017 16:50:27 -0700 Subject: [PATCH] PkgInfo: add 'pkgsearch' support for FreeBSD, Linux Mint --- PkgInfo/plugin.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/PkgInfo/plugin.py b/PkgInfo/plugin.py index 6c87e50..cf1b569 100644 --- a/PkgInfo/plugin.py +++ b/PkgInfo/plugin.py @@ -425,10 +425,14 @@ class PkgInfo(callbacks.Plugin): versions = {} query = query.lower() + multi_results = [] for result in results: name = result.contents[0].string # Package name - if query == name: + if query in name and multi: + multi_results.append(name) + + elif query == name: # This feels like really messy code, but we have to find tags # relative to our results. # Ascend to find the section name (in

): @@ -446,6 +450,8 @@ class PkgInfo(callbacks.Plugin): # one in Backports, etc.) versions[section] = version + if multi: + return multi_results return (query, ', '.join('%s: %s' % (k, v) for k, v in versions.items()), 'Linux Mint %s' % release.title(), 'no description available', addr) @@ -458,6 +464,9 @@ class PkgInfo(callbacks.Plugin): data = utils.web.getUrl(url) soup = BeautifulSoup(data) + if multi: + return [dt.text for dt in soup.find_all('dt')] + for dt in soup.find_all('dt'): pkgname, pkgver = dt.text.rsplit('-', 1) self.log.debug('PkgInfo: got pkgname=%s pkgver=%s for freebsd_fetcher', pkgname, pkgver)