jenkins-bot has submitted this change and it was merged.
Change subject: Synchronize handleArgs with core
......................................................................
Synchronize handleArgs with core
- remove -dir option which is handled in wikipediatools.py
- reorder options and documentation and synchronize it with core
- remove deprecated doc string for -debug option
- remove deprecated -dry option from help text
Change-Id: Ia3ef3cd76cea508fe57dbfa38c87e1005c01b94e
---
M wikipedia.py
1 file changed, 19 insertions(+), 26 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/wikipedia.py b/wikipedia.py
index bddc1d7..c9bc07e 100644
--- a/wikipedia.py
+++ b/wikipedia.py
@@ -9534,14 +9534,10 @@
arg = _decodeArg(arg)
if arg == '-help':
do_help = True
- elif arg.startswith('-dir:'):
- # currently handled in wikipediatools.py - possibly before this
- # routine is called.
- pass # config_dir = arg[5:]
elif arg.startswith('-family:'):
- default_family = arg[8:]
+ default_family = arg[len("-family:"):]
elif arg.startswith('-lang:'):
- default_code = arg[6:]
+ default_code = arg[len("-lang:"):]
elif arg.startswith("-user:"):
username = arg[len("-user:"):]
elif arg.startswith('-putthrottle:'):
@@ -9555,20 +9551,12 @@
elif arg == '-log':
setLogfileStatus(True)
elif arg.startswith('-log:'):
- setLogfileStatus(True, arg[5:])
+ setLogfileStatus(True, arg[len("-log:"):])
elif arg.startswith('-loghandler:'):
- config.loghandler = arg[12:]
+ config.loghandler = arg[len('-loghandler:'):]
elif arg == '-nolog':
setLogfileStatus(False)
- elif arg in ['-verbose', '-v']:
- verbose += 1
- elif arg == '-daemonize':
- import daemonize
- daemonize.daemonize()
- elif arg.startswith('-daemonize:'):
- import daemonize
- daemonize.daemonize(redirect_std=arg[11:])
- elif arg in ['-cosmeticchanges', '-cc']:
+ elif arg in ('-cosmeticchanges', '-cc'):
config.cosmetic_changes = not config.cosmetic_changes
output(u'NOTE: option cosmetic_changes is %s\n'
% config.cosmetic_changes)
@@ -9577,15 +9565,21 @@
elif arg == '-dry':
output(u"Usage of -dry is deprecated; use -simulate instead.")
simulate = True
- # global debug option for development purposes. Normally does nothing.
elif arg == '-debug':
if not logger:
init_handlers()
logger.setLevel(DEBUG)
config.special_page_limit = 500
+ elif arg in ('-verbose', '-v'):
+ verbose += 1
+ elif arg == '-daemonize':
+ import daemonize
+ daemonize.daemonize()
+ elif arg.startswith('-daemonize:'):
+ import daemonize
+ daemonize.daemonize(redirect_std=arg[len('-daemonize:'):])
else:
- # the argument is not global. Let the specific bot script care
- # about it.
+ # argument not global -> specific bot script will take care
nonGlobalArgs.append(arg)
if username:
@@ -9645,10 +9639,6 @@
-help Show this help text.
--loghandler:xyz Choose a value for 'xyz' from 'TRFH' (TimedRotatingFile-
- Handler) or 'RFH' (RotatingFileHandler). Has to be defined
- before '-log' on command line.
-
-log Enable the logfile, using the default filename
"%s.log"
Logs will be stored in the logs subdirectory.
@@ -9656,6 +9646,10 @@
-log:xyz Enable the logfile, using 'xyz' as the filename.
-nolog Disable the logfile (if it is enabled by default).
+
+-loghandler:xyz Choose a value for 'xyz' from 'TRFH' (TimedRotatingFile-
+ Handler) or 'RFH' (RotatingFileHandler). Has to be defined
+ before '-log' on command line.
-maxlag Sets a new maxlag parameter to a number of seconds. Defer bot
edits during periods of database server lag. Default is set by
@@ -9672,9 +9666,8 @@
settings and restrictions are untouched.
-simulate Disables writing to the server. Useful for testing and
-(-dry) debugging of new code (if given, doesn't do any real
+ debugging of new code (if given, doesn't do any real
changes, but only shows what would have been changed).
- DEPRECATED: please use -simulate instead of -dry
''' % moduleName
output(globalHelp, toStdout=True)
try:
--
To view, visit https://gerrit.wikimedia.org/r/90863
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia3ef3cd76cea508fe57dbfa38c87e1005c01b94e
Gerrit-PatchSet: 8
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: Fix dependency installation during setup.py install
......................................................................
Fix dependency installation during setup.py install
The pwb_install function introduced in Idd1794481b4b57c001fed8df0bf8178bb5eccc30
did not take into account the introspection that happens in install.install.run:
depending on the caller, it changes behavior - in this case to the *incorrect*
behavior. We now explicitly call the right backend function.
See also: https://github.com/jaraco/setuptools/blob/master/setuptools/command/install…
Bug: 56386
Change-Id: Ib27fd645c51f0fd7a903f7118c04f64f96501f89
---
M setup.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/setup.py b/setup.py
index b022d2f..620ee2f 100644
--- a/setup.py
+++ b/setup.py
@@ -36,7 +36,7 @@
`generate_user_files.py` after installing the package.
"""
def run(self):
- install.install.run(self)
+ install.install.do_egg_install(self)
import subprocess
python = sys.executable
python = python.replace("pythonw.exe", "python.exe") # for Windows
--
To view, visit https://gerrit.wikimedia.org/r/92765
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib27fd645c51f0fd7a903f7118c04f64f96501f89
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: pwb.py: mock pywikibot if it is not available
......................................................................
pwb.py: mock pywikibot if it is not available
run_python_file() can only be called after pywikibot has been loaded.
However, it is impossible to load pywikibot if a user-config.py is
not yet available. We therefore now mock pywikibot, by creating
and object (lambda function) with argvu attribute.
Bug: 56324
Change-Id: If0a1e08e29da3a3780b0b9300fcad140ae7087c5
---
M pwb.py
1 file changed, 19 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py
index 08e586e..1c49181 100644
--- a/pwb.py
+++ b/pwb.py
@@ -23,6 +23,19 @@
import sys
+def tryimport_pwb():
+ # See if we can import pywikibot. If so, we need to patch pwb.argvu, too.
+ # If pywikibot is not available, we create a mock object to remove the
+ # need for if statements further on.
+ global pwb
+ try:
+ import pywikibot
+ pwb = pywikibot
+ except RuntimeError:
+ pwb = lambda: None
+ pwb.argvu = []
+
+
def run_python_file(filename, argv, argvu):
"""Run a python file as if it were the main program on the command line.
@@ -30,6 +43,8 @@
`args` is the argument array to present as sys.argv, as unicode strings.
"""
+ tryimport_pwb()
+
# Create a module to serve as __main__
old_main_mod = sys.modules['__main__']
main_mod = imp.new_module('__main__')
@@ -88,13 +103,15 @@
if not os.path.exists(user_config_path):
print "NOTE:", user_config_path, "was not found!"
print "Please follow the prompts to create it:"
- run_python_file('generate_user_files.py', ['generate_user_files.py'])
+ path = 'generate_user_files.py'
+ run_python_file(path, [path], [path.decode('ascii')])
-import pywikibot as pwb
if len(sys.argv) > 1:
+ tryimport_pwb()
fn = sys.argv[1]
argv = sys.argv[1:]
argvu = pwb.argvu[1:]
+ print argvu
if not os.path.exists(fn):
testpath = os.path.join(os.path.split(__file__)[0], 'scripts', fn)
--
To view, visit https://gerrit.wikimedia.org/r/92569
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If0a1e08e29da3a3780b0b9300fcad140ae7087c5
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: Correcting timestamp request in loading deleted revisions
......................................................................
Correcting timestamp request in loading deleted revisions
I checked it and it worked correctly, you can test it by adding "print self._deletedRevs" before line 1325
Bug: 54546
Change-Id: I054097840cc6d69da107425868f92357cf12ce50
---
M pywikibot/page.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index cb06350..78ce1d0 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1324,8 +1324,8 @@
if hasattr(self, "_deletedRevs"):
if timestamp in self._deletedRevs and (
(not retrieveText)
- or "content" in self._deletedRevs["timestamp"]):
- return self._deletedRevs["timestamp"]
+ or "content" in self._deletedRevs[timestamp]):
+ return self._deletedRevs[timestamp]
for item in self.site.deletedrevs(self, start=timestamp,
get_text=retrieveText, total=1):
# should only be one item with one revision
--
To view, visit https://gerrit.wikimedia.org/r/92255
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I054097840cc6d69da107425868f92357cf12ce50
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: .svnprops file for importing to tortoiseSVN
......................................................................
.svnprops file for importing to tortoiseSVN
Change-Id: I18fdefb0ca3acce25d8c37fd676839a543e54bf5
---
A .svnprops
1 file changed, 0 insertions(+), 0 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.svnprops b/.svnprops
new file mode 100644
index 0000000..e5fa0ed
--- /dev/null
+++ b/.svnprops
Binary files differ
--
To view, visit https://gerrit.wikimedia.org/r/92187
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I18fdefb0ca3acce25d8c37fd676839a543e54bf5
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot