http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10281
Revision: 10281 Author: xqt Date: 2012-06-03 10:47:51 +0000 (Sun, 03 Jun 2012) Log Message: ----------- svn settings, license, documentation added
Modified Paths: -------------- branches/rewrite/pwb.py
Property Changed: ---------------- branches/rewrite/pwb.py
Modified: branches/rewrite/pwb.py =================================================================== --- branches/rewrite/pwb.py 2012-06-03 10:46:36 UTC (rev 10280) +++ branches/rewrite/pwb.py 2012-06-03 10:47:51 UTC (rev 10281) @@ -1,24 +1,38 @@ -import sys,os -sys.path.append('.') -sys.path.append('externals/httplib2') -sys.path.append('pywikibot/compat') - -if "PYWIKIBOT2_DIR" not in os.environ: - os.environ["PYWIKIBOT2_DIR"] = os.path.split(__file__)[0] - -sys.argv.pop(0) -if len(sys.argv) > 0: - if not os.path.exists(sys.argv[0]): - testpath = os.path.join(os.path.split(__file__)[0], 'scripts', sys.argv[0]) - if os.path.exists(testpath): - sys.argv[0] = testpath - else: - testpath = testpath + '.py' - if os.path.exists(testpath): - sys.argv[0] = testpath - else: - raise Exception("%s not found!" % sys.argv[0]) - sys.path.append(os.path.split(sys.argv[0])[0]) - execfile(sys.argv[0]) -else: - sys.argv.append('') +# -*- coding: utf-8 -*- +"""wrapper script to use rewrite in 'directory' mode - run scripts using +python pwb.py <name_of_script> <options> + +and it will use the package directory to store all user files, will fix up +search paths so the package does not need to be installed, etc. +""" +# (C) Pywikipedia team, 2012 +# +__version__ = '$Id$' +# +# Distributed under the terms of the MIT license. +# + +import sys,os +sys.path.append('.') +sys.path.append('externals/httplib2') +sys.path.append('pywikibot/compat') + +if "PYWIKIBOT2_DIR" not in os.environ: + os.environ["PYWIKIBOT2_DIR"] = os.path.split(__file__)[0] + +sys.argv.pop(0) +if len(sys.argv) > 0: + if not os.path.exists(sys.argv[0]): + testpath = os.path.join(os.path.split(__file__)[0], 'scripts', sys.argv[0]) + if os.path.exists(testpath): + sys.argv[0] = testpath + else: + testpath = testpath + '.py' + if os.path.exists(testpath): + sys.argv[0] = testpath + else: + raise Exception("%s not found!" % sys.argv[0]) + sys.path.append(os.path.split(sys.argv[0])[0]) + execfile(sys.argv[0]) +else: + sys.argv.append('')
Property changes on: branches/rewrite/pwb.py ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native
pywikipedia-svn@lists.wikimedia.org