http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11454
Revision: 11454 Author: drtrigon Date: 2013-04-25 12:38:00 +0000 (Thu, 25 Apr 2013) Log Message: ----------- improvement; as follow-up to r11449 more externals and final merge with DrTrigonBot framework
Modified Paths: -------------- branches/rewrite/externals/README branches/rewrite/pwb.py branches/rewrite/scripts/script_wui.py
Modified: branches/rewrite/externals/README =================================================================== --- branches/rewrite/externals/README 2013-04-25 12:34:16 UTC (rev 11453) +++ branches/rewrite/externals/README 2013-04-25 12:38:00 UTC (rev 11454) @@ -18,6 +18,9 @@ (from http://labix.org/lunatic-python) Download the zip archive and unpack the 'lunatic-python-1.0' dir into the path 'externals/_lua' afterwards. + $ wget http://labix.org/download/lunatic-python/lunatic-python-1.0.tar.bz2 + $ tar -xvf lunatic-python-1.0.tar.bz2 + $ mv lunatic-python-1.0 _lua Patch package dir in order to work with newer lua (>= 5.1) versions $ patch -p1 -d [path-to-install-dir]/_lua < [path-to-externals]/patch-lua and you are done.
Modified: branches/rewrite/pwb.py =================================================================== --- branches/rewrite/pwb.py 2013-04-25 12:34:16 UTC (rev 11453) +++ branches/rewrite/pwb.py 2013-04-25 12:38:00 UTC (rev 11454) @@ -19,10 +19,15 @@ if sys.version_info[1] < 6: raise RuntimeError("ERROR: Pywikipediabot only runs under Python 2.6 or higher")
-sys.path.append('.') -sys.path.append('externals/httplib2') -sys.path.append('pywikibot/compat') +rewrite_path = os.path.dirname(sys.argv[0]) +if not os.path.isabs(rewrite_path): + rewrite_path = os.path.abspath(os.path.join(os.curdir, rewrite_path))
+sys.path.append(rewrite_path) +sys.path.append(os.path.join(rewrite_path, 'externals/httplib2')) +sys.path.append(os.path.join(rewrite_path, 'pywikibot/compat')) +sys.path.append(os.path.join(rewrite_path, 'externals')) + if "PYWIKIBOT2_DIR" not in os.environ: os.environ["PYWIKIBOT2_DIR"] = os.path.split(__file__)[0]
Modified: branches/rewrite/scripts/script_wui.py =================================================================== --- branches/rewrite/scripts/script_wui.py 2013-04-25 12:34:16 UTC (rev 11453) +++ branches/rewrite/scripts/script_wui.py 2013-04-25 12:38:00 UTC (rev 11454) @@ -57,8 +57,6 @@ # --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # __version__ = '$Id$' -__framework_rev__ = '11448' # check: http://de.wikipedia.org/wiki/Hilfe:MediaWiki/Versionen -__release_ver__ = '1.5.%s' # increase minor (1.x) at re-merges with framework #
@@ -77,7 +75,6 @@
import pywikibot import pywikibot.botirc -from pywikibot import version
bot_config = { 'BotName': pywikibot.config.usernames[pywikibot.config.family][pywikibot.config.mylang], @@ -230,10 +227,7 @@ exec( code ) except: # (done according to subster in trunk and submit in rewrite/.../data/api.py) - #exc_info = sys.exc_info() - #tb = traceback.format_exception(exc_info[0], exc_info[1], exc_info[2]) - tb = traceback.format_exc() - pywikibot.error(tb) # secure traceback print (from api.py submit) + pywikibot.exception(tb=True) # secure traceback print (from api.py submit)
sys.stdout = sys.__stdout__ sys.stderr = sys.__stderr__ @@ -271,7 +265,7 @@ # comment = pywikibot.translate(self.site.lang, bot_config['msg']))
def main(): - global __simulate, __sys_argv, __release_ver__ + global __simulate, __sys_argv
for arg in pywikibot.handleArgs(): pywikibot.showHelp('script_wui') @@ -280,15 +274,6 @@ __simulate = pywikibot.config.simulate __sys_argv = sys.argv
- # 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() chan = '#' + site.language() + '.' + site.family.name
pywikipedia-svn@lists.wikimedia.org