mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-27 13:31:10 -05:00
PkgInfo: 'pkg' command dependency parsing (accessible via 'pkg <distro> <package> --depends/--recommends/--suggests)
This commit is contained in:
parent
0458246385
commit
0538b5600e
@ -117,10 +117,12 @@ class PkgInfo(callbacks.Plugin):
|
|||||||
self.log.debug("PkgInfo: No results found for URL %s" % url)
|
self.log.debug("PkgInfo: No results found for URL %s" % url)
|
||||||
|
|
||||||
def package(self, irc, msg, args, release, pkg, opts):
|
def package(self, irc, msg, args, release, pkg, opts):
|
||||||
"""<release> <package>
|
"""<release> <package> [--{depends|recommends|suggests}]
|
||||||
|
|
||||||
Fetches information for <package> from Debian or Ubuntu's repositories.
|
Fetches information for <package> from Debian or Ubuntu's repositories.
|
||||||
<release> is the codename/release name (e.g. 'trusty', 'squeeze').
|
<release> is the codename/release name (e.g. 'trusty', 'squeeze'). If
|
||||||
|
--depends, --recommends, or --suggests is given, fetches dependency info
|
||||||
|
for <package>.
|
||||||
For Arch Linux packages, please use 'archpkg' and 'archaur' instead."""
|
For Arch Linux packages, please use 'archpkg' and 'archaur' instead."""
|
||||||
pkg = pkg.lower()
|
pkg = pkg.lower()
|
||||||
distro = self._getDistro(release)
|
distro = self._getDistro(release)
|
||||||
@ -152,18 +154,21 @@ class PkgInfo(callbacks.Plugin):
|
|||||||
keyw = keyws[lookup]
|
keyw = keyws[lookup]
|
||||||
res = []
|
res = []
|
||||||
for item in items:
|
for item in items:
|
||||||
name = item.a.text
|
try:
|
||||||
if item.text.startswith("or") and keyw in \
|
name = item.a.text
|
||||||
item.find_previous_siblings("dt")[0].span.text:
|
if item.text.startswith("or") and keyw in \
|
||||||
res[-1] = "%s or \x02%s\x02" % (res[-1], name)
|
item.find_previous_siblings("dt")[0].span.text:
|
||||||
elif keyw in item.span.text:
|
res[-1] = "%s or \x02%s\x02" % (res[-1], name)
|
||||||
res.append("\x02%s\x02" % name)
|
elif keyw in item.span.text:
|
||||||
|
res.append("\x02%s\x02" % name)
|
||||||
|
except AttributeError as e:
|
||||||
|
continue
|
||||||
if res:
|
if res:
|
||||||
s = ("Package \x02%s\x02 %s the following: %s" % (pkg, lookup,
|
s = format("Package \x02%s\x02 %s: %L, View more at %u", pkg, lookup,
|
||||||
', '.join(res)))
|
res, url)
|
||||||
irc.reply(s)
|
irc.reply(s)
|
||||||
else:
|
else:
|
||||||
irc.error("%s doesn't seem to %s on anything." % (pkg, lookup[:-1]))
|
irc.error("%s doesn't seem to have any %s." % (pkg, lookup))
|
||||||
return
|
return
|
||||||
desc = soup.find('meta', attrs={"name":"Description"})["content"]
|
desc = soup.find('meta', attrs={"name":"Description"})["content"]
|
||||||
# Get package information from the meta tags
|
# Get package information from the meta tags
|
||||||
@ -188,7 +193,7 @@ class PkgInfo(callbacks.Plugin):
|
|||||||
such package exists. Supported entries for <distribution>
|
such package exists. Supported entries for <distribution>
|
||||||
include 'debian', 'ubuntu', 'derivatives', and 'all'. If
|
include 'debian', 'ubuntu', 'derivatives', and 'all'. If
|
||||||
--source is given, search for packages by source package
|
--source is given, search for packages by source package
|
||||||
name. If --reverse or --reversed is given, show the newest package versions
|
name. If --reverse is given, show the newest package versions
|
||||||
first."""
|
first."""
|
||||||
pkg, distro = map(str.lower, (pkg, distro))
|
pkg, distro = map(str.lower, (pkg, distro))
|
||||||
supported = ("debian", "ubuntu", "derivatives", "all")
|
supported = ("debian", "ubuntu", "derivatives", "all")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user