mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-29 06:51:10 -05:00
Add mintpkg command for parsing Linux Mint's repositories (still needs testing)
This commit is contained in:
parent
2c13c96a01
commit
080dbc0e79
@ -209,6 +209,39 @@ class PkgInfo(callbacks.Plugin):
|
|||||||
irc.reply(s)
|
irc.reply(s)
|
||||||
pkgsearch = wrap(pkgsearch, ['somethingWithoutSpaces', 'somethingWithoutSpaces'])
|
pkgsearch = wrap(pkgsearch, ['somethingWithoutSpaces', 'somethingWithoutSpaces'])
|
||||||
|
|
||||||
|
def mintpkg(self, irc, msg, args, release, query):
|
||||||
|
"""<release> <package>
|
||||||
|
|
||||||
|
Looks up <package> in Linux Mint's repositories."""
|
||||||
|
if not bs4Present:
|
||||||
|
irc.error("This command requires the Beautiful Soup 4 library. See"
|
||||||
|
" https://github.com/GLolol/SupyPlugins/blob/master/README.md"
|
||||||
|
"#pkginfo for instructions on how to install it.", Raise=True)
|
||||||
|
addr = 'http://packages.linuxmint.com/list.php?release=' + quote(release)
|
||||||
|
try:
|
||||||
|
fd = utils.web.getUrl(addr).decode("utf-8")
|
||||||
|
except Exception as e:
|
||||||
|
irc.error(str(e), Raise=True)
|
||||||
|
soup = BeautifulSoup(fd)
|
||||||
|
results = soup.find_all("td")
|
||||||
|
found = {}
|
||||||
|
for result in results:
|
||||||
|
name = result.contents[0].string
|
||||||
|
if query == name:
|
||||||
|
self.log.info(str(result.contents))
|
||||||
|
version, pkg = result.next_sibling.next_sibling.string, name
|
||||||
|
found[pkg] = version
|
||||||
|
self.log.info(str(found))
|
||||||
|
if found:
|
||||||
|
s = 'Found %s results: ' % len(found)
|
||||||
|
for x in found:
|
||||||
|
s += '%s \x02(%s)\x02, ' % (x, found[x])
|
||||||
|
s += 'View more at: %s' % addr
|
||||||
|
irc.reply(s)
|
||||||
|
else:
|
||||||
|
irc.error('No results found.')
|
||||||
|
mintpkg = wrap(mintpkg, ['somethingWithoutSpaces', 'somethingWithoutSpaces'])
|
||||||
|
|
||||||
Class = PkgInfo
|
Class = PkgInfo
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user