mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-26 21:11:14 -05:00
PkgInfo: add 'pkgsearch' support for FreeBSD, Linux Mint
This commit is contained in:
parent
d41178dd09
commit
f45cb0d5e7
@ -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 <h2>):
|
||||
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user