Small fixes and documentation updates

This commit is contained in:
Terence Simpson 2008-10-28 08:09:48 +00:00
parent 885ad30ded
commit 687e689b09
5 changed files with 62 additions and 24 deletions

View File

@ -221,14 +221,23 @@ class Bantracker(callbacks.Plugin):
def die(self):
global queue
if self.db:
self.db.close()
self.thread_timer.cancel()
try:
self.db.close()
except:
pass
try:
self.thread_timer.cancel()
except:
pass
queue.clear()
def reset(self):
global queue
if self.db:
self.db.close()
try:
self.db.close()
except:
pass
queue.clear()
self.logs.clear()
self.lastMsgs.clear()

View File

@ -9,8 +9,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This plugin is a rather intricate combination of a factoid plugin and package
info lookup via apt. Here's how to set it up:
This plugin is a factoid plugin. Here's how to set it up:
Pick a name for your database. A lowercase-only name without spaces is probably
best, this example wil use myfactoids as name. Then create a directory to store
@ -53,19 +52,5 @@ commoncgi.py file from the bzr tree. Make sure you set the variables datadir and
database in factoids.cgi to the correct values. Also set default_db to the one
you want to show by default.
To get package lookup working, you need to set the variable
supybot.plugins.encyclopedia.aptdir to the name of a new, empty directory. In
this directory, you create sources.list files for every distrorelease you want to
search. The name of the file is important, since the filename (without the .list
suffix) is the name that is used to refer to the distrorelease.
Whenever you create a new .list file, it is important to run the update_apt
and update_apt_file scripts that comes with this plugin. Before you run these,
you have to edit them to point to your apt dir. It's also useful to run them
periodically from cron (say, once per week for update_apt and once per moth for
update_apt_file). You also need to reload the plugin to make it pick up the new
releases.
It is very useful to set the supybot.plugins.encyclopedia.searchorder value to a
space separated list of release names. That way you can limit the (expensive)
searching for packages to a small set of releases.
This plugin used to have package lookup, this was mooved to the PackageInfo
plugin.

View File

@ -665,8 +665,11 @@ class Encyclopedia(callbacks.Plugin):
data = fd2.read(47)
if data == '** This file contains an SQLite 2.1 database **': # OK, rename to dpath
os.rename(tmp_db, dpath)
self.databases[channel].close()
self.databases.pop(channel)
try:
self.databases[channel].close()
self.databases.pop(channel)
except:
pass
else: # Remove the tmpparary file and raise an error
os.remove(tmp_db)
raise RuntimeError, "Downloaded file was not a SQLite 2.1 database"

View File

@ -1 +1,41 @@
Insert a description of your plugin here, with any notes, etc. about using it.
This plugin allows package lookup via apt-cache/apt-file
--Setup--
supybot.plugins.PackageInfo.aptdir:
Directory to use to store the apt cache (Global)
Default: ''
Create a new empty directory that will be used for the apt cache.
In this directory, you create sources.list files for every release you
want to search. The name of the file is important, since the filename (without
the .list suffix) is the name that is used to refer to the release.
supybot.plugins.PackageInfo.defaultRelease:
Set this to the default release to use when none is specified. (Channel)
Default: ''
Whenever you create a new .list file, it is important to run the update_apt
and update_apt_file scripts that comes with this plugin. Before you run these,
you have to edit them to point to your apt dir. It's also useful to run them
periodically from cron (say, once per week for update_apt and once per moth for
update_apt_file). You also need to reload the plugin to make it pick up the new
releases.
supybot.plugins.PackageInfo.enabled:
Enable or disable package lookup snarfing. (Channel)
Default: True
supybot.plugins.PackageInfo.prefixchar:
Prefix character for the package lookup snarfer. (Channel)
Default: !
--Usage--
find <package/filename> [<release>]
Search for <package> or, of that fails, find <filename>'s package(s).
Optionally in <release>
info <package> [<release>]
Lookup information for <package>, optionally in <release>
if supybot.plugins.PackageInfo.enabled is True the bot will also reply to
the commands if prefixed with supybot.plugins.PackageInfo.prefixchar.

View File

@ -19,6 +19,7 @@ import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
import supybot.schedule as schedule
import supybot.ircmsgs as ircmsgs
import supybot.conf as conf
import pytz
import ical
import datetime, shelve, re