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. # POSSIBILITY OF SUCH DAMAGE.
### ###
import re
import os import os
import sys import sys
import time import time
@ -212,13 +213,22 @@ class Misc(callbacks.Plugin):
Returns the version of the current bot. Returns the version of the current bot.
""" """
try: try:
newest = utils.web.getUrl('http://supybot.sf.net/version.txt') newestUrl = 'https://github.com/ProgVal/Limnoria/raw/%s/' + \
newest = _('The newest version available online is %s.') % \ 'src/version.py'
newest.strip() 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: except utils.web.Error, e:
self.log.info('Couldn\'t get website version: %s', e) self.log.info('Couldn\'t get website version: %s', e)
newest = _('I couldn\'t fetch the newest version ' 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') % \ s = _('The current (running) version of this Supybot is %s. %s') % \
(conf.version, newest) (conf.version, newest)
irc.reply(s) irc.reply(s)

View File

@ -1,3 +1,3 @@
"""stick the various versioning attributes in here, so we only have to change """stick the various versioning attributes in here, so we only have to change
them once.""" 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)'