Initial doTopic work, apt dir moved and support seveas
This commit is contained in:
@ -23,7 +23,9 @@ apt_pkg.init()
|
||||
fallback = ('ubuntu', '#ubuntu')
|
||||
datadir = '/home/dennis/ubugtu/data/facts'
|
||||
|
||||
def r(section):
|
||||
def r(repo,section):
|
||||
if 'seveas' in repo:
|
||||
return 'Seveas'
|
||||
if '/' in section:
|
||||
return section[:section.find('/')]
|
||||
return 'main'
|
||||
@ -389,19 +391,20 @@ class Encyclopedia(callbacks.PluginRegexp):
|
||||
irc.error('An error occured (code 124)')
|
||||
|
||||
aptcommand = """apt-cache\\
|
||||
-o"Dir::State::Lists=/home/dennis/ubugtu/data/%s"\\
|
||||
-o"Dir::etc::sourcelist=/home/dennis/ubugtu/data/%s.list"\\
|
||||
-o"Dir::State::status=/home/dennis/ubugtu/data/%s.status"\\
|
||||
-o"Dir::Cache=/home/dennis/ubugtu/data/cache"\\
|
||||
-o"Dir::State::Lists=/home/dennis/ubugtu/data/apt/%s"\\
|
||||
-o"Dir::etc::sourcelist=/home/dennis/ubugtu/data/apt/%s.list"\\
|
||||
-o"Dir::State::status=/home/dennis/ubugtu/data/apt/%s.status"\\
|
||||
-o"Dir::Cache=/home/dennis/ubugtu/data/apt/cache"\\
|
||||
%s %s"""
|
||||
def info(self, irc, msg, match):
|
||||
r"^!?info\s+(?P<package>\S+)(\s+(?P<distro>\S+))?"
|
||||
if not self._precheck(irc, msg, timeout=(msg.args[0],match.group('package'), match.group('distro'))):
|
||||
return
|
||||
distro = 'dapper'
|
||||
if (match.group('distro') in ('warty','hoary','breezy','dapper','edgy')):
|
||||
if (match.group('distro') in ('warty','hoary','breezy','dapper','edgy','breezy-seveas','dapper-seveas')):
|
||||
distro = match.group('distro')
|
||||
data = commands.getoutput(self.aptcommand % (distro, distro, distro, 'show', match.group('package')))
|
||||
print data
|
||||
if not data or 'E: No packages found' in data:
|
||||
irc.reply('Package %s does not exist in %s' % (match.group('package'), distro))
|
||||
else:
|
||||
@ -417,7 +420,7 @@ class Encyclopedia(callbacks.PluginRegexp):
|
||||
maxp = p
|
||||
del parser
|
||||
irc.reply("%s: %s. In repository %s, is %s. Version %s (%s), package size %s kB, installed size %s kB" %
|
||||
(maxp['Package'], maxp['Description'].split('\n')[0], r(maxp['Section']),
|
||||
(maxp['Package'], maxp['Description'].split('\n')[0], r(distro, maxp['Section']),
|
||||
maxp['Priority'], maxp['Version'], distro, int(maxp['Size'])/1024, maxp['Installed-Size']))
|
||||
|
||||
def find(self, irc, msg, match):
|
||||
|
@ -26,5 +26,7 @@ conf.registerChannelValue(conf.supybot.plugins.Webcal, 'filter',
|
||||
registry.String('',"""What to filter on in the ical feed"""))
|
||||
conf.registerChannelValue(conf.supybot.plugins.Webcal, 'topic',
|
||||
registry.String('',"""Topic template"""))
|
||||
conf.registerChannelValue(conf.supybot.plugins.Webcal, 'doTopic',
|
||||
registry.Boolean(False,"""Whether to manage the topic"""))
|
||||
conf.registerGlobalValue(conf.supybot.plugins.Webcal, 'defaultChannel',
|
||||
registry.String('',"""Default channel for /msg replies"""))
|
||||
|
@ -195,8 +195,7 @@ class Webcal(callbacks.Plugin):
|
||||
|
||||
# Warn people that you manage the topic
|
||||
def doTopic(self, irc, msg):
|
||||
url = self.registryValue('url', msg.args[0])
|
||||
if not url:
|
||||
if not self.registryValue('doTopic'):
|
||||
return
|
||||
irc.reply("The topic of %s is managed by me and filled with the contents of %s - please don't change manually" % (msg.args[0],url), private=True)
|
||||
|
||||
|
Reference in New Issue
Block a user