jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/907494 )
Change subject: [log] Disable command.log if -nolog option is given
......................................................................
[log] Disable command.log if -nolog option is given
Bug: T334381
Change-Id: Ic31b94adcc2bf140258cbe632edceddb1edeb290
---
M pywikibot/bot.py
1 file changed, 17 insertions(+), 1 deletion(-)
Approvals:
Bináris: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 26559a9..a15efd7 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -228,6 +228,7 @@
-log:xyz Enable the log file, using 'xyz' as the filename.
-nolog Disable the log file (if it is enabled by default).
+ Also disable command.log.
-maxlag Sets a new maxlag parameter to a number of seconds.
Defer bot edits during periods of database server lag.
@@ -888,6 +889,8 @@
.. versionchanged:: 8.0
Short site value can be given if site code is equal to family
like ``-site:meta``.
+ .. versionchanged:: 8.1
+ ``-nolog`` option also discards command.log.
:param args: Command line arguments. If None,
:meth:`pywikibot.argvu<userinterfaces._interface_base.ABUIC.argvu>`
@@ -911,6 +914,7 @@
module_name = calledModuleName() or 'terminal-interface'
non_global_args = []
username = None
+ commandlog = True
do_help_val: Union[bool, str, None] = None if do_help else False
assert args is not None
for arg in args:
@@ -939,6 +943,7 @@
if value:
config.logfilename = value
elif option == '-nolog':
+ commandlog = False
config.log = []
elif option in ('-cosmeticchanges', '-cc'):
config.cosmetic_changes = (strtobool(value) if value
@@ -1008,7 +1013,8 @@
config.usernames[config.family][config.mylang] = username
init_handlers()
- writeToCommandLogFile()
+ if commandlog:
+ writeToCommandLogFile()
if config.verbose_output:
pywikibot.info('Python ' + sys.version)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/907494
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic31b94adcc2bf140258cbe632edceddb1edeb290
Gerrit-Change-Number: 907494
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Bináris <wikiposta(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/907495 )
Change subject: [tests] Follow-up patch for T334378
......................................................................
[tests] Follow-up patch for T334378
This is necessary due to another SystemError:
SystemError: <built-in method split of str object at 0x7f21bee950b0>
returned a result with an exception set
Bug: T334378
Change-Id: If746cbe93844cac6793c50c590e2aafc9c6031cb
---
M pywikibot/site/_basesite.py
1 file changed, 18 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site/_basesite.py b/pywikibot/site/_basesite.py
index 1f05b30..c0311d3 100644
--- a/pywikibot/site/_basesite.py
+++ b/pywikibot/site/_basesite.py
@@ -31,6 +31,9 @@
)
+PYTHON_312A7 = sys.version.split()[0] == '3.12.0a7' # T334378 workaround
+
+
class BaseSite(ComparableMixin):
"""Site methods that are independent of the communication interface."""
@@ -187,7 +190,7 @@
def __getattr__(self, attr):
"""Delegate undefined methods calls to the Family object."""
- if sys.version.split()[0] == '3.12.0a7': # T334378 workaround
+ if PYTHON_312A7: # T334378 workaround
print(end='') # noqa: T001, T201
try:
method = getattr(self.family, attr)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/907495
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: If746cbe93844cac6793c50c590e2aafc9c6031cb
Gerrit-Change-Number: 907495
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged