mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-27 05:21:10 -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 = {}
|
versions = {}
|
||||||
query = query.lower()
|
query = query.lower()
|
||||||
|
|
||||||
|
multi_results = []
|
||||||
for result in results:
|
for result in results:
|
||||||
name = result.contents[0].string # Package name
|
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
|
# This feels like really messy code, but we have to find tags
|
||||||
# relative to our results.
|
# relative to our results.
|
||||||
# Ascend to find the section name (in <h2>):
|
# Ascend to find the section name (in <h2>):
|
||||||
@ -446,6 +450,8 @@ class PkgInfo(callbacks.Plugin):
|
|||||||
# one in Backports, etc.)
|
# one in Backports, etc.)
|
||||||
versions[section] = version
|
versions[section] = version
|
||||||
|
|
||||||
|
if multi:
|
||||||
|
return multi_results
|
||||||
return (query, ', '.join('%s: %s' % (k, v) for k, v in versions.items()),
|
return (query, ', '.join('%s: %s' % (k, v) for k, v in versions.items()),
|
||||||
'Linux Mint %s' % release.title(), 'no description available', addr)
|
'Linux Mint %s' % release.title(), 'no description available', addr)
|
||||||
|
|
||||||
@ -458,6 +464,9 @@ class PkgInfo(callbacks.Plugin):
|
|||||||
data = utils.web.getUrl(url)
|
data = utils.web.getUrl(url)
|
||||||
soup = BeautifulSoup(data)
|
soup = BeautifulSoup(data)
|
||||||
|
|
||||||
|
if multi:
|
||||||
|
return [dt.text for dt in soup.find_all('dt')]
|
||||||
|
|
||||||
for dt in soup.find_all('dt'):
|
for dt in soup.find_all('dt'):
|
||||||
pkgname, pkgver = dt.text.rsplit('-', 1)
|
pkgname, pkgver = dt.text.rsplit('-', 1)
|
||||||
self.log.debug('PkgInfo: got pkgname=%s pkgver=%s for freebsd_fetcher', pkgname, pkgver)
|
self.log.debug('PkgInfo: got pkgname=%s pkgver=%s for freebsd_fetcher', pkgname, pkgver)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user