http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11446
Revision: 11446 Author: drtrigon Date: 2013-04-24 16:55:33 +0000 (Wed, 24 Apr 2013) Log Message: ----------- improvement; version handling and verbose output
Modified Paths: -------------- branches/rewrite/pywikibot/bot.py branches/rewrite/pywikibot/version.py branches/rewrite/scripts/script_wui.py
Modified: branches/rewrite/pywikibot/bot.py =================================================================== --- branches/rewrite/pywikibot/bot.py 2013-04-24 12:32:58 UTC (rev 11445) +++ branches/rewrite/pywikibot/bot.py 2013-04-24 16:55:33 UTC (rev 11446) @@ -252,11 +252,11 @@ output(u'SYSTEM: %s' % unicode(os.uname()))
# imported modules - #output(u'MODULES:') - #for item in sys.modules.keys(): - # ver = version.getfileversion('%s.py' % item) - # if ver and (ver[0] == u'$'): - # output(u' %s' % ver) + output(u'MODULES:') + for item in sys.modules.keys(): + ver = version.getfileversion('%s.py' % item.replace('.', '/')) + if ver and (ver[0] == u'$'): + output(u' %s' % ver)
# messages on bot discussion page? output(u'MESSAGES: %s' % ('unanswered' if site.messages() else 'none'))
Modified: branches/rewrite/pywikibot/version.py =================================================================== --- branches/rewrite/pywikibot/version.py 2013-04-24 12:32:58 UTC (rev 11445) +++ branches/rewrite/pywikibot/version.py 2013-04-24 16:55:33 UTC (rev 11446) @@ -53,9 +53,8 @@ version = pywikibot.__version__
id, file, rev, date, ts, author, dollar = version.split(' ') - tag = '' + tag = 'pywikibot/__init__.py' date = time.strptime('%sT%s' % (date, ts), '%Y-%m-%dT%H:%M:%SZ') - rev += ' (pywikibot/__init__.py)' except: # nothing worked; version unknown (but suppress exceptions) # the value is most likely '$Id' + '$', it means that # wikipedia.py got imported without using svn at all
Modified: branches/rewrite/scripts/script_wui.py =================================================================== --- branches/rewrite/scripts/script_wui.py 2013-04-24 12:32:58 UTC (rev 11445) +++ branches/rewrite/scripts/script_wui.py 2013-04-24 16:55:33 UTC (rev 11446) @@ -57,8 +57,8 @@ # --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # __version__ = '$Id$' -__release_ver__ = '1.5' # increase minor (1.x) at re-merges with framework -__release_rev__ = '%i' +__framework_rev__ = '11445' # check: http://de.wikipedia.org/wiki/Hilfe:MediaWiki/Versionen +__release_ver__ = '1.5.%i' # increase minor (1.x) at re-merges with framework #
@@ -76,6 +76,7 @@
import pywikibot import pywikibot.botirc +from pywikibot import version
bot_config = { 'BotName': pywikibot.config.usernames[pywikibot.config.family][pywikibot.config.mylang], @@ -269,7 +270,7 @@ # comment = pywikibot.translate(self.site.lang, bot_config['msg']))
def main(): - global __simulate, __sys_argv + global __simulate, __sys_argv, __release_ver__
for arg in pywikibot.handleArgs(): pywikibot.showHelp('script_wui') @@ -278,8 +279,14 @@ __simulate = pywikibot.config.simulate __sys_argv = sys.argv
- # verbosely output version info of all involved scripts - # PROBLEM: correct place -> improve logging!! + # output version info + __release_ver__ %= version.getversion_svn(pywikibot.config.datafilepath('..'))[1] + pywikibot.output({'release_ver': __release_ver__, + 'framework_ver': __framework_rev__, + 'release_online_ver': version.getversion_onlinerepo('http://svn.toolserver.org/svnroot/drtrigon/'), + 'framework_online_ver': version.getversion_onlinerepo(), + }) + pywikibot.output(u'=== ' * 14)
site = pywikibot.getSite() site.login()