Misc: use Limnoria version string.

This commit is contained in:
Valentin Lorentz 2011-06-05 20:30:32 +02:00
parent 73cf53f8e6
commit 6c1699583b
2 changed files with 15 additions and 5 deletions

View File

@ -28,6 +28,7 @@
# POSSIBILITY OF SUCH DAMAGE.
###
import re
import os
import sys
import time
@ -212,13 +213,22 @@ class Misc(callbacks.Plugin):
Returns the version of the current bot.
"""
try:
newest = utils.web.getUrl('http://supybot.sf.net/version.txt')
newest = _('The newest version available online is %s.') % \
newest.strip()
newestUrl = 'https://github.com/ProgVal/Limnoria/raw/%s/' + \
'src/version.py'
versions = {}
for branch in ('master', 'testing'):
file = utils.web.getUrl(newestUrl % branch)
match = re.search(r"^version = '([^']+)'$", file, re.M)
if match is None:
continue
versions[branch] = match.group(1)
newest = _('The newest versions available online are %s.') % \
', '.join(['%s (in %s)' % (y,x)
for x,y in versions.items()])
except utils.web.Error, e:
self.log.info('Couldn\'t get website version: %s', e)
newest = _('I couldn\'t fetch the newest version '
'from the Supybot website.')
'from the Limnoria repository.')
s = _('The current (running) version of this Supybot is %s. %s') % \
(conf.version, newest)
irc.reply(s)

View File

@ -1,3 +1,3 @@
"""stick the various versioning attributes in here, so we only have to change
them once."""
version = '0.83.4.1+limnoria (2011-05-27T18:16:23+0200)'
version = '0.83.4.1+limnoria (2011-06-05T20:30:31+0200)'