diff --git a/Encyclopedia/__init__.py b/Encyclopedia/__init__.py index 430cc34..cd8b0fe 100644 --- a/Encyclopedia/__init__.py +++ b/Encyclopedia/__init__.py @@ -24,7 +24,7 @@ import supybot import supybot.world as world from importlib import reload -__version__ = "3.5.1" +__version__ = "3.5.2" __author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@gmail.com") __contributors__ = { supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Author'], diff --git a/Encyclopedia/plugin.py b/Encyclopedia/plugin.py index ca8a886..b05294a 100644 --- a/Encyclopedia/plugin.py +++ b/Encyclopedia/plugin.py @@ -204,7 +204,7 @@ class Encyclopedia(callbacks.Plugin): remove = wrap(remove, ['otherUser']) def editors(self, irc, msg, args): - """Takes no arguments + """takes no arguments Lists all the users who are in the list of editors. """ @@ -212,7 +212,7 @@ class Encyclopedia(callbacks.Plugin): editors = wrap(editors) def moderators(self, irc, msg, args): - """Takes no arguments + """takes no arguments Lists all the users who can add users to the list of editors. """ diff --git a/Encyclopedia/test.py b/Encyclopedia/test.py index d311e52..e058453 100644 --- a/Encyclopedia/test.py +++ b/Encyclopedia/test.py @@ -107,6 +107,3 @@ class EncyclopediaTestCase(ChannelPluginTestCase): 'In test, user said: test-#ubuntu-se is blah') finally: world.testing = True - - -# vim:set shiftwidth=4 softtabstop=4 tabstop=4 expandtab textwidth=100: diff --git a/PackageInfo/__init__.py b/PackageInfo/__init__.py index 2933d59..4dc30a9 100644 --- a/PackageInfo/__init__.py +++ b/PackageInfo/__init__.py @@ -22,7 +22,7 @@ import supybot import supybot.world as world from importlib import reload -__version__ = "2.1.1" +__version__ = "2.2.0" __author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@gmail.com") __contributors__ = { supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Concept'], @@ -44,6 +44,3 @@ if world.testing: Class = plugin.Class configure = config.configure - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/PackageInfo/config.py b/PackageInfo/config.py index 5b05212..be98674 100644 --- a/PackageInfo/config.py +++ b/PackageInfo/config.py @@ -38,8 +38,7 @@ deb-src deb http://security.debian.org/ %s/updates main contrib non-free """ % (release, release) from supybot.questions import output, expect, something, yn - import subprocess - import os + import os, subprocess def anything(prompt, default=None): """Because supybot is pure fail""" @@ -71,7 +70,7 @@ deb-src deb http://security.debian.org/ %s/updates main contrib non-free PackageInfo.prefixchar.setValue(prefixchar) PackageInfo.defaultRelease.setValue(defaultRelease) - default_dists = set(['precise', 'trusty', 'xenial', 'yakkety', 'zesty', 'artful', + default_dists = set(['bionic', 'focal', 'groovy', 'hirsute', 'impish', 'oldstable', 'stable', 'unstable', 'testing', 'experimental']) pluginDir = os.path.abspath(os.path.dirname(__file__)) update_apt = os.path.join(pluginDir, 'update_apt') @@ -127,13 +126,18 @@ deb-src deb http://security.debian.org/ %s/updates main contrib non-free output("You need to install apt-file in order to use the !find command of this plugin") PackageInfo = conf.registerPlugin('PackageInfo') + conf.registerChannelValue(PackageInfo, 'enabled', registry.Boolean(True, "Enable package lookup")) + conf.registerChannelValue(PackageInfo, 'prefixchar', conf.ValidPrefixChars('!', "Character the bot will respond to")) + conf.registerChannelValue(PackageInfo, 'defaultRelease', - registry.String('zesty', "Default release to use when none is specified")) + registry.String('hirsute', "Default release to use when none is specified")) + +conf.registerChannelValue(PackageInfo, 'listReleasesOnError', + registry.Boolean(True, "Send list of all valid releases in private on error")) + conf.registerGlobalValue(PackageInfo, 'aptdir', conf.Directory(conf.supybot.directories.data.dirize('aptdir'), "Path to the apt directory", private=True)) - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/PackageInfo/packages.py b/PackageInfo/packages.py index 5d4e7ab..30a1d84 100644 --- a/PackageInfo/packages.py +++ b/PackageInfo/packages.py @@ -73,9 +73,6 @@ class Apt: return parser.close() def find(self, pkg, distro, filelookup=True): - if distro not in self.distros: - return "%r is not a valid release: %s" % (distro, ", ".join(self.distros)) - if distro.split('-')[0] in ('oldstable', 'stable', 'unstable', 'testing', 'experimental'): pkgTracURL = "https://packages.debian.org" else: @@ -108,9 +105,6 @@ class Apt: return "Found: %s" % ', '.join(pkgs) def raw_info(self, pkg, distro, isSource, archlookup=True): - if distro not in self.distros: - return "%r is not a valid release: %s" % (distro, ", ".join(self.distros)) - try: data = self.apt_cache(distro, ['show'] if not isSource else ['showsrc', '--only-source'], pkg) except subprocess.CalledProcessError: diff --git a/PackageInfo/plugin.py b/PackageInfo/plugin.py index 9bb123a..30e0de8 100644 --- a/PackageInfo/plugin.py +++ b/PackageInfo/plugin.py @@ -147,6 +147,11 @@ class PackageInfo(callbacks.Plugin): (release, rest) = self.__getRelease(irc, release, channel) if not release: return + if release not in self.Apt.distros: + irc.reply("%r is not a valid release" % release) + if self.registryValue("listReleasesOnError", channel, irc.network): + irc.reply("Valid releases are: %s" % ', '.join(self.Apt.distros), private=True) + return (package, isSource) = self.__getPackage(package) target = ircutils.replyTo(msg) reply = self.Apt.info(package, release, isSource) @@ -166,6 +171,11 @@ class PackageInfo(callbacks.Plugin): (release, rest) = self.__getRelease(irc, release, channel) if not release: return + if release not in self.Apt.distros: + irc.reply("%r is not a valid release" % release) + if self.registryValue("listReleasesOnError", channel, irc.network): + irc.reply("Valid releases are: %s" % ', '.join(self.Apt.distros), private=True) + return (package, isSource) = self.__getPackage(package) target = ircutils.replyTo(msg) reply = self.Apt.depends(package, release, isSource) @@ -186,6 +196,11 @@ class PackageInfo(callbacks.Plugin): (release, rest) = self.__getRelease(irc, release, channel) if not release: return + if release not in self.Apt.distros: + irc.reply("%r is not a valid release" % release) + if self.registryValue("listReleasesOnError", channel, irc.network): + irc.reply("Valid releases are: %s" % ', '.join(self.Apt.distros), private=True) + return target = ircutils.replyTo(msg) reply = self.Apt.find(package, release) if rest: @@ -193,6 +208,14 @@ class PackageInfo(callbacks.Plugin): queue(irc, target, reply) find = wrap(find, ['anything', optional('text')]) + def releases(self, irc, msg, args): + """takes no arguments + + List all valid releases. + """ + irc.reply("Valid releases are: %s" % ', '.join(self.Apt.distros)) + releases = wrap(releases) + def doPrivmsg(self, irc, msg): if chr(1) in msg.args[1]: # CTCP return @@ -229,6 +252,3 @@ class PackageInfo(callbacks.Plugin): return msg Class = PackageInfo - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/PackageInfo/test.py b/PackageInfo/test.py index a9ec5ee..ea1e7fc 100644 --- a/PackageInfo/test.py +++ b/PackageInfo/test.py @@ -17,6 +17,3 @@ from supybot.test import * class PackageInfoTestCase(PluginTestCase): plugins = ('PackageInfo',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: