jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] Show deprecated options warning
......................................................................
[bugfix] Show deprecated options warning
- issue_deprecation_warning doesn't show the deprecated warning by default
when DeprecationWarning class is used. We have to use
ArgumentDeprecationWarning class instead.
- import issue_deprecation_warning to reuse it.
- When an option is deprecated or renamed the new one should be shown but
deprecated or renamed options should be omitted in the help doc. We have
issue_deprecation_warning to show the warning if necessary.
Change-Id: I68fcb0d671d1a6ae2f5969b38aeaec3c91fdc605
---
M scripts/checkimages.py
1 file changed, 7 insertions(+), 9 deletions(-)
Approvals:
Magul: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 8fc472b..35a0a02 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -25,9 +25,6 @@
-duplicatesreport Report the duplicates in a log *AND* put the template in
the images.
--duplicatereport The -duplicatereport option is deprecated. Use
- -duplicatesreport instead.
-
-sendemail Send an email after tagging.
-break To break the bot after the first check (default: recursive)
@@ -102,9 +99,9 @@
from pywikibot import i18n
from pywikibot import pagegenerators as pg
-from pywikibot.exceptions import NotEmailableError
+from pywikibot.exceptions import ArgumentDeprecationWarning, NotEmailableError
from pywikibot.family import Family
-from pywikibot.tools import deprecated, StringTypes
+from pywikibot.tools import deprecated, issue_deprecation_warning, StringTypes
###############################################################################
# <--------------------------- Change only below! --------------------------->#
@@ -1614,7 +1611,8 @@
if arg.startswith('-sleep'):
length = len('-sleep')
else:
- pywikibot.tools.issue_deprecation_warning('-time',
'-sleep', 2)
+ issue_deprecation_warning('-time', '-sleep', 2,
+ ArgumentDeprecationWarning)
length = len('-time')
if len(arg) == length:
time_sleep = int(pywikibot.input(
@@ -1629,9 +1627,9 @@
commonsActive = True
elif arg == '-duplicatesreport' or arg == '-duplicatereport':
if arg == '-duplicatereport':
- pywikibot.tools.issue_deprecation_warning('-duplicatereport',
- '-duplicatesreport',
- 2)
+ issue_deprecation_warning('-duplicatereport',
+ '-duplicatesreport',
+ 2, ArgumentDeprecationWarning)
duplicatesReport = True
elif arg.startswith('-duplicates'):
duplicatesActive = True
--
To view, visit
https://gerrit.wikimedia.org/r/323691
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I68fcb0d671d1a6ae2f5969b38aeaec3c91fdc605
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>