mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-05-01 07:51:08 -05:00
PkgInfo: be less case sensitive
This commit is contained in:
parent
07e64983ea
commit
2010866ff0
@ -98,11 +98,12 @@ class PkgInfo(callbacks.Plugin):
|
|||||||
" https://github.com/GLolol/SupyPlugins/blob/master/README.md"
|
" https://github.com/GLolol/SupyPlugins/blob/master/README.md"
|
||||||
"#pkginfo for instructions on how to install it.", Raise=True)
|
"#pkginfo for instructions on how to install it.", Raise=True)
|
||||||
# Guess the distro from the suite name
|
# Guess the distro from the suite name
|
||||||
|
pkg, suite, pkg = map(str.lower, (pkg, suite, pkg))
|
||||||
if suite.startswith(("oldstable","squeeze","wheezy","stable",
|
if suite.startswith(("oldstable","squeeze","wheezy","stable",
|
||||||
"jessie","testing","sid","unstable")):
|
"jessie","testing","sid","unstable")):
|
||||||
distro = "debian"
|
distro = "debian"
|
||||||
else: distro = "ubuntu"
|
else: distro = "ubuntu"
|
||||||
url = self.addrs[distro.lower()] + "{}/{}".format(suite.lower(), pkg.lower())
|
url = self.addrs[distro] + "{}/{}".format(suite, pkg)
|
||||||
try:
|
try:
|
||||||
fd = utils.web.getUrl(url).decode("utf-8")
|
fd = utils.web.getUrl(url).decode("utf-8")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -143,6 +144,7 @@ class PkgInfo(callbacks.Plugin):
|
|||||||
Looks up <package> in the Arch Linux package repositories.
|
Looks up <package> in the Arch Linux package repositories.
|
||||||
If --exact is given, will output only exact matches.
|
If --exact is given, will output only exact matches.
|
||||||
"""
|
"""
|
||||||
|
pkg = pkg.lower()
|
||||||
baseurl = 'https://www.archlinux.org/packages/search/json/?'
|
baseurl = 'https://www.archlinux.org/packages/search/json/?'
|
||||||
if 'exact' in dict(opts):
|
if 'exact' in dict(opts):
|
||||||
fd = utils.web.getUrl(baseurl + urlencode({'name':pkg}))
|
fd = utils.web.getUrl(baseurl + urlencode({'name':pkg}))
|
||||||
@ -169,6 +171,7 @@ class PkgInfo(callbacks.Plugin):
|
|||||||
"""<package>
|
"""<package>
|
||||||
|
|
||||||
Looks up <package> in the Arch Linux AUR."""
|
Looks up <package> in the Arch Linux AUR."""
|
||||||
|
pkg = pkg.lower()
|
||||||
baseurl = 'https://aur.archlinux.org/rpc.php?type=search&'
|
baseurl = 'https://aur.archlinux.org/rpc.php?type=search&'
|
||||||
fd = utils.web.getUrl(baseurl + urlencode({'arg':pkg}))
|
fd = utils.web.getUrl(baseurl + urlencode({'arg':pkg}))
|
||||||
data = json.loads(fd.decode("utf-8"))
|
data = json.loads(fd.decode("utf-8"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user