jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/794382 )
Change subject: [7.4] prepare next release 7.4
......................................................................
[7.4] prepare next release 7.4
Bug: T308902
Change-Id: Idfb6eb69c321d9d95ef3c6647d8c9c98419b3223
---
M .appveyor.yml
M HISTORY.rst
M ROADMAP.rst
M pywikibot/__metadata__.py
M scripts/CHANGELOG.md
M scripts/__init__.py
6 files changed, 33 insertions(+), 27 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.appveyor.yml b/.appveyor.yml
index 13593b4..0498d73 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,7 +1,7 @@
image: Visual Studio 2019
clone_depth: 50
skip_tags: true
-version: 7.3.{build}
+version: 7.4.{build}
environment:
PYWIKIBOT_DIR: "%appdata%\\Pywikibot"
diff --git a/HISTORY.rst b/HISTORY.rst
index b66d94e..2b27147 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,6 +1,33 @@
Release history
^^^^^^^^^^^^^^^
+7.3.0
+-----
+*21 May 2022*
+
+* Add support for kcgwiki (:phab:`T305282`)
+* Raise InvalidTitleError instead of unspecific ValueError in ProofreadPage (:phab:`T308016`)
+* Preload pages if GeneratorFactory.articlenotfilter_list is not empty; also set attribute ``is_preloading``.
+* ClaimCollection.toJSON() should not ignore new claim (:phab:`T308245`)
+* use linktrail via siteinfo and remove `update_linkrtrails` maintenance script
+* Print counter statistic for all counters (:phab:`T307834`)
+* Use proofreadpagesinindex query module
+* Prioritize -namespaces options in `pagegenerators.handle_args` (:phab:`T222519`)
+* Remove `ThreadList.stop_all()` method (:phab:`T307830`)
+* L10N updates
+* Improve get_charset_from_content_type function (:phab:`T307760`)
+* A tiny cache wrapper was added to hold results of parameterless methods and properties
+* Increase workers in preload_sites.py
+* Close logging handlers before deleting them (:phab:`T91375`, :phab:`T286127`)
+* Clear _sites cache if called with pwb wrapper (:phab:`T225594`)
+* Enable short creation of a site if family name is equal to site code
+* Use `exc_info=True` with pywikibot.exception() by default (:phab:`T306762`)
+* Make IndexPage more robust when getting links in Page ns (:phab:`T307280`)
+* Do not print log header twice in log files (:phab:`T264235`)
+* Do not delegate logging output to the root logger (:phab:`T281643`)
+* Add `get_charset_from_content_type` to extract the charset from the content-type response header
+
+
7.2.0
-----
*26 April 2022*
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 2a48fdf..db50131 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,28 +1,7 @@
-Current release 7.3.0
+Current release 7.4.0
^^^^^^^^^^^^^^^^^^^^^
-* Add support for kcgwiki (:phab:`T305282`)
-* Raise InvalidTitleError instead of unspecific ValueError in ProofreadPage (:phab:`T308016`)
-* Preload pages if GeneratorFactory.articlenotfilter_list is not empty; also set attribute ``is_preloading``.
-* ClaimCollection.toJSON() should not ignore new claim (:phab:`T308245`)
-* use linktrail via siteinfo and remove `update_linkrtrails` maintenance script
-* Print counter statistic for all counters (:phab:`T307834`)
-* Use proofreadpagesinindex query module
-* Prioritize -namespaces options in `pagegenerators.handle_args` (:phab:`T222519`)
-* Remove `ThreadList.stop_all()` method (:phab:`T307830`)
-* L10N updates
-* Improve get_charset_from_content_type function (:phab:`T307760`)
-* A tiny cache wrapper was added to hold results of parameterless methods and properties
-* Increase workers in preload_sites.py
-* Close logging handlers before deleting them (:phab:`T91375`, :phab:`T286127`)
-* Clear _sites cache if called with pwb wrapper (:phab:`T225594`)
-* Enable short creation of a site if family name is equal to site code
-* Use `exc_info=True` with pywikibot.exception() by default (:phab:`T306762`)
-* Make IndexPage more robust when getting links in Page ns (:phab:`T307280`)
-* Do not print log header twice in log files (:phab:`T264235`)
-* Do not delegate logging output to the root logger (:phab:`T281643`)
-* Add `get_charset_from_content_type` to extract the charset from the content-type response header
-
+* *(no changes yet)*
Deprecations
^^^^^^^^^^^^
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index b1a3ca3..91545c8 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -11,7 +11,7 @@
__name__ = 'pywikibot'
-__version__ = '7.3.0'
+__version__ = '7.4.0.dev0'
__description__ = 'Python MediaWiki Bot Framework'
__maintainer__ = 'The Pywikibot team'
__maintainer_email__ = 'pywikibot(a)lists.wikimedia.org'
diff --git a/scripts/CHANGELOG.md b/scripts/CHANGELOG.md
index d7a3571..783d5e5 100644
--- a/scripts/CHANGELOG.md
+++ b/scripts/CHANGELOG.md
@@ -1,7 +1,7 @@
# Scripts Changelog
## 7.3.0
-*20 May 2022*
+*21 May 2022*
### general
* Call ExistingPageBot.skip_page() first (:phab:`T86491`)
diff --git a/scripts/__init__.py b/scripts/__init__.py
index 41f6eb7..4385672 100644
--- a/scripts/__init__.py
+++ b/scripts/__init__.py
@@ -29,4 +29,4 @@
#
# Distributed under the terms of the MIT license.
#
-__version__ = '7.3.0'
+__version__ = '7.4.0'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/794382
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: Idfb6eb69c321d9d95ef3c6647d8c9c98419b3223
Gerrit-Change-Number: 794382
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/793394 )
Change subject: [cleanup] Remove README-conversion.rst
......................................................................
[cleanup] Remove README-conversion.rst
core/rewrite branch started 15 years ago and development of compat branch
has been dropped for 6 years. compat to core support request was never used
and closed last year. Therefore
- remove README-conversion.rst. The content is still available at
Manual:Pywikibot (mediawiki.org)
- remove update_script.py formerly known as compat2core.py and its tests
- update documentation
Change-Id: I1549bb6fbf97524ec3b291d80a35a90f4de8d057
---
M CONTENT.rst
D README-conversion.rst
M scripts/CHANGELOG.md
M scripts/README.rst
D scripts/maintenance/update_script.py
M tests/__init__.py
D tests/update_script_tests.py
7 files changed, 3 insertions(+), 295 deletions(-)
Approvals:
DannyS712: Looks good to me, but someone else must approve
Legoktm: Looks good to me, approved
Xqt: Verified; Looks good to me, approved
diff --git a/CONTENT.rst b/CONTENT.rst
index 19fa285..d2c2b63 100644
--- a/CONTENT.rst
+++ b/CONTENT.rst
@@ -28,8 +28,6 @@
+---------------------------+-----------------------------------------------------------+
| README.rst | Short info string used by Pywikibot Nightlies |
+---------------------------+-----------------------------------------------------------+
- | README-conversion.txt | Compat to Core branch conversion hints |
- +---------------------------+-----------------------------------------------------------+
| requirements.txt | General PIP requirements file |
+---------------------------+-----------------------------------------------------------+
| ROADMAP.rst | PyPI version roadmap file |
diff --git a/README-conversion.rst b/README-conversion.rst
deleted file mode 100644
index 8560c0c..0000000
--- a/README-conversion.rst
+++ /dev/null
@@ -1,18 +0,0 @@
-Compat to Core Conversion
-=========================
-
-There is a guide to converting bot scripts from version 1 of the
-Pywikibot framework called trunk or compat to the new version 3+,
-so called rewrite or core. Refer `compat-to-core conversion Manual
-<https://www.mediawiki.org/wiki/Manual:Pywikibot/compat-to-core_conversion>`_
-for further instructions.
-
-There is also a helper script which does a lot of changes automatically.
-Just call it::
-
- pwb.py update_script [<script to convert>]
-
-and follow the instructions and hints.
-
-Ask at `compat to core support request <https://phabricator.wikimedia.org/T247105>`_
-for any Pywikibot compat to core migration support.
\ No newline at end of file
diff --git a/scripts/CHANGELOG.md b/scripts/CHANGELOG.md
index b887002..e3d942f 100644
--- a/scripts/CHANGELOG.md
+++ b/scripts/CHANGELOG.md
@@ -13,6 +13,9 @@
* Do not kill threads after generator is exhausted (:phab:`T113139`)
* Use Page.extlinks() to get external links (:phab:`T60812`)
+### update_script
+* update_script script was removed
+
## 7.2.1
*07 May 2022**
diff --git a/scripts/README.rst b/scripts/README.rst
index 519b755..113ab36 100644
--- a/scripts/README.rst
+++ b/scripts/README.rst
@@ -162,9 +162,6 @@
+------------------------+---------------------------------------------------------+
| colors.py | Utility to show pywikibot colors. |
+------------------------+---------------------------------------------------------+
- | update_script.py | Helper script to update scripts and replace deprecated |
- | | code parts. |
- +------------------------+---------------------------------------------------------+
| make_i18n_dict.py | Generate an i18n file from a given script. |
+------------------------+---------------------------------------------------------+
| preload_sites.py | Preload and cache site information for each WikiMedia |
diff --git a/scripts/maintenance/update_script.py b/scripts/maintenance/update_script.py
deleted file mode 100755
index 9c39ada..0000000
--- a/scripts/maintenance/update_script.py
+++ /dev/null
@@ -1,229 +0,0 @@
-#!/usr/bin/python3
-"""
-A helper script to update scripts and replace deprecated parts.
-
-This also convert compat 1.0 scripts to the new core framework.
-
-NOTE: Please be aware that this script is not able to convert your codes
-completely. It may support you with some automatic replacements and it gives
-some warnings and hints for converting. Please refer to the converting guide
-README-conversion.txt in the core framework folder and check your codes
-finally.
-
-The scripts asks for the .py file and converts it to
-<scriptname>-new.py in the same directory. The following option is supported:
-
--warnonly Do not convert the source but show warning messages. This is good
- to check already merged scripts.
-
-usage
-
-to convert a script and show warnings about deprecated methods:
-
- python pwb.py update_script <scriptname>
-
-to show warnings about deprecated methods:
-
- python pwb.py update_script <scriptname> -warnonly
-"""
-#
-# (C) Pywikibot team, 2014-2021
-#
-# Distributed under the terms of the MIT license.
-#
-import codecs
-import os
-import re
-import sys
-
-import pywikibot
-
-
-# be careful with replacement order!
-replacements = (
- #############################
- # compat 2 core replacements
- #############################
- # doc strings
- ('#\r?\n__version__.*\r?\n',
- '#\n'
- '# Automatically ported from compat branch by update_script.py script\n'),
- ('Pywikipedia bot team', 'Pywikibot team'),
- # importing changes
- ('import wikipedia(?: as pywikibot)?', 'import pywikibot'),
- ('(?<!from pywikibot )import (config|pagegenerators)',
- r'from pywikibot import \1'),
- # remove deprecated libs
- ('(?:from pywikibot.compat )?import query', ''),
- ('import catlib\r?\n', ''),
- ('import userlib\r?\n', ''),
- # change wikipedia to pywikibot, exclude URLs
- (r'(?<!\.)wikipedia\.', 'pywikibot.'),
- # site instance call
- (r'pywikibot\.getSite\s*\(\s*', 'pywikibot.Site('),
- # lang is different from code. We should use code in core
- (r'([Ss])ite\.lang(?:uage\(\))?', r'\1ite.code'),
- # change compat library classes to pywikibot intrinsic classes
- (r'catlib\.Category\s*\(\s*', 'pywikibot.Category('),
- (r'catlib\.change_category\s*\((\s*)(?P<article>.+?),\s*(?P<oldcat>.+?),',
- r'\g<article>.change_category(\1\g<oldcat>,'),
- (r'userlib\.User\s*\(\s*', 'pywikibot.User('),
- # change ImagePage to FilePage
- (r'pywikibot\.ImagePage\s*\(\s*', 'pywikibot.FilePage('),
- # deprecated title methods
- (r'\.urlname\s*\(\s*\)', '.title(as_url=True)'),
- (r'\.urlname\s*\(\s*(?:withNamespace\s*=\s*)?(True|False)+\s*\)',
- r'.title(as_url=True, with_ns=\1)'),
- (r'\.titleWithoutNamespace\s*\(\s*\)', '.title(with_ns=False)'),
- (r'\.sectionFreeTitle\s*\(\s*\)', '.title(with_section=False)'),
- (r'\.aslink\s*\(\s*\)', '.title(as_link=True)'),
- # other deprecated methods
- (r'(?<!site)\.encoding\s*\(\s*\)', '.site.encoding()'),
- (r'\.newimages\s*\(\)', ".logevents(logtype='upload')"),
- (r'\.newimages\s*\(([^)])', r".logevents(logtype='upload', \1"),
- (r'\.getRestrictions\s*\(', '.protection('),
- # new core methods and properties
- (r'\.get\s*\(\s*get_redirect\s*=\s*True\s*\)', '.text'),
- (r'(?:pywikibot|wikipedia)\.verbose', 'config.verbose_output'),
- # stopme() is done by the framework itself
- (r'(\s*)try\:\s*\r?\n\s+main\(\)\s*\r?\n\s*finally\:\s*\r?\n'
- r'\s+pywikibot\.stopme\(\)',
- r'\1main()'),
-)
-
-# some warnings which must be changed manually
-warnings = (
- #############################
- # compat 2 core warnings
- #############################
- ('pywikibot.setAction(',
- 'setAction() no longer works; you must pass an explicit edit summary\n'
- 'message to save() or put()'),
- ('.removeImage(',
- 'Page.removeImage() is deprecated and does not work at core'),
- ('.replaceImage(',
- 'Page.replaceImage() is deprecated and does not work at core'),
- ('.getVersionHistory(',
- 'Page.getVersionHistory() was removed. Use Page.revisions() instead.'),
- ('.fullVersionHistory(',
- 'Page.fullVersionHistory() was removed. Use Page.revisions() instead.'),
- ('.contributions(',
- 'User.contributions() returns a pywikibot.Timestamp object instead of a\n'
- 'MediaWiki one'),
- ('.getFileMd5Sum(',
- 'FilePage.getFileMd5Sum() is deprecated should be replaced by '
- 'FilePage.latest_file_info.sha1'),
- (' wikipedia.',
- '"wikipedia" library has been changed to "pywikibot".'),
- ('from wikipedia import',
- '"wikipedia" library has been changed to "pywikibot". Please find the\n'
- 'right way to import your object.'),
- ('from pywikibot.compat import',
- 'compat module has been removed. Please refer README-conversion.txt for\n'
- 'core implementation.'),
- ('query.GetData(',
- 'query.GetData() should be replaced by pywikibot.data.api.Request or\n'
- 'by a direct site request'),
- ('.verbose',
- 'verbose_output need "from pywikibot import config" first'),
- ('templates(',
- 'returns a list of templage page objects, not a list of template titles.'
- '\nPlease refer README-conversion.txt and the documentation.'),
- ('templatesWithParams(',
- 'the first item of each template info is a Page object of the template,\n'
- 'not the title. '
- 'Please refer README-conversion.txt and the documentation.'),
- ('linkedPages(',
- 'returns a PageGenerator of page objects of link targets, not a list\n'
- 'of link target strings. Please refer README-conversion.txt\n'
- 'and the documentation.'),
-)
-
-
-class ConvertBot:
-
- """Script conversion bot."""
-
- def __init__(self, filename=None, warnonly=False):
- """Initializer."""
- self.source = filename
- self.warnonly = warnonly
-
- def run(self):
- """Run the bot."""
- self.get_source()
- self.get_dest()
- if not self.warnonly:
- self.convert()
- self.warning()
-
- def get_source(self):
- """Get source script."""
- while True:
- if self.source is None:
- self.source = pywikibot.input(
- 'Please input the .py file to convert '
- '(no input to leave):')
- if not self.source:
- sys.exit()
- if not self.source.endswith('.py'):
- self.source += '.py'
- if os.path.exists(self.source):
- break
- self.source = os.path.join('scripts', self.source)
- if os.path.exists(self.source):
- break
- pywikibot.output('{} does not exist. Please retry.'
- .format(self.source))
- self.source = None
-
- def get_dest(self):
- """Ask for destination script name."""
- self.dest = '{}-new.{}'.format(*self.source.rsplit('.', 1))
- if not self.warnonly and not pywikibot.input_yn(
- 'Destination file is {}.'.format(self.dest),
- default=True, automatic_quit=False):
- pywikibot.output('Quitting...')
- sys.exit()
-
- def convert(self):
- """Convert script."""
- with codecs.open(self.source, 'r', 'utf-8') as f:
- text = f.read()
- for r in replacements:
- text = re.sub(r[0], r[1], text)
- with codecs.open(self.dest, 'w', 'utf-8') as g:
- g.write(text)
-
- def warning(self):
- """Show warnings and hints."""
- filename = self.source if self.warnonly else self.dest
- with codecs.open(filename, 'r', 'utf-8') as g:
- lines = enumerate(g.readlines(), start=1)
- for i, line in lines:
- for w in warnings:
- if w[0] in line:
- pywikibot.warning(
- 'line {}: {}>>> {}\n'.format(i, line, w[1]))
-
-
-def main():
- """Process command line arguments and invoke bot."""
- filename = None
- warnonly = False
-
- # Parse command line arguments for -help option
- for arg in pywikibot.handle_args():
- if arg.startswith('-warnonly'):
- warnonly = True
- elif not arg.startswith('-'):
- filename = arg
- else:
- pywikibot.warning(arg + ' is not supported')
- bot = ConvertBot(filename, warnonly)
- bot.run()
-
-
-if __name__ == '__main__':
- pywikibot.stopme() # we do not work on any site
- main()
diff --git a/tests/__init__.py b/tests/__init__.py
index c5295ad..6606d55 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -157,7 +157,6 @@
'replacebot',
'script',
'template_bot',
- 'update_script',
'uploadscript',
'weblinkchecker'
}
diff --git a/tests/update_script_tests.py b/tests/update_script_tests.py
deleted file mode 100755
index 539828c..0000000
--- a/tests/update_script_tests.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/python3
-"""update_script.py tests."""
-#
-# (C) Pywikibot team, 2019-2022
-#
-# Distributed under the terms of the MIT license.
-#
-import unittest
-
-import scripts.maintenance.update_script as us
-from tests.aspects import TestCase
-
-
-class Compat2CoreTests(TestCase):
-
- """Validate update_script script."""
-
- net = False
-
- def test_replacements(self):
- """Test update_script replacements."""
- for item in us.replacements:
- self.assertLength(item, 2)
- self.assertIsInstance(item[0], str)
- self.assertIsInstance(item[1], str)
-
- def test_warnings(self):
- """Test update_script warnings."""
- for item in us.warnings:
- self.assertLength(item, 2)
- self.assertIsInstance(item[0], str)
- self.assertIsInstance(item[1], str)
-
- def test_bot(self):
- """Test update_script bot."""
- bot = us.ConvertBot(warnonly=True)
- self.assertIsNone(bot.source)
- self.assertTrue(bot.warnonly)
-
-
-if __name__ == '__main__': # pragma: no cover
- unittest.main()
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/793394
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: I1549bb6fbf97524ec3b291d80a35a90f4de8d057
Gerrit-Change-Number: 793394
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: DannyS712 <dannys712.wiki(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm(a)debian.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/793392 )
Change subject: [doc] Update ROADMAP.rst and CHANGELOG.md
......................................................................
[doc] Update ROADMAP.rst and CHANGELOG.md
Change-Id: I7ca765a5f79f9e2057f077be3991323b72ad08f4
---
M ROADMAP.rst
M scripts/CHANGELOG.md
2 files changed, 11 insertions(+), 3 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 37dd271..2a48fdf 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,6 +1,10 @@
Current release 7.3.0
^^^^^^^^^^^^^^^^^^^^^
+* Add support for kcgwiki (:phab:`T305282`)
+* Raise InvalidTitleError instead of unspecific ValueError in ProofreadPage (:phab:`T308016`)
+* Preload pages if GeneratorFactory.articlenotfilter_list is not empty; also set attribute ``is_preloading``.
+* ClaimCollection.toJSON() should not ignore new claim (:phab:`T308245`)
* use linktrail via siteinfo and remove `update_linkrtrails` maintenance script
* Print counter statistic for all counters (:phab:`T307834`)
* Use proofreadpagesinindex query module
@@ -23,7 +27,7 @@
Deprecations
^^^^^^^^^^^^
-* Python 3.5 support will be dropped with Python 8 (:phab:`T301908`)
+* 7.3.0: Python 3.5 support will be dropped with Python 8 (:phab:`T301908`)
* 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a `content` parameter (:phab:`T306134`)
* 7.2.0: RedirectPageBot and NoRedirectPageBot bot classes are deprecated in favour of `use_redirects` attribute
* 7.2.0: `tools.formatter.color_format` is deprecated and will be removed
diff --git a/scripts/CHANGELOG.md b/scripts/CHANGELOG.md
index b887002..dc24824 100644
--- a/scripts/CHANGELOG.md
+++ b/scripts/CHANGELOG.md
@@ -1,21 +1,25 @@
# Scripts Changelog
## 7.3.0
-*In development*
+*20 May 2022*
### general
* Call ExistingPageBot.skip_page() first (:phab:`T86491`)
+### delete
+* Count deleted pages and other actions (:phab:`T212040`)
+
### replace
* A -nopreload option was added
### weblinkchecker
+* Throttle connections to the same host (:phab:`T152350`)
* Do not kill threads after generator is exhausted (:phab:`T113139`)
* Use Page.extlinks() to get external links (:phab:`T60812`)
## 7.2.1
-*07 May 2022**
+*07 May 2022*
### movepages
* Fix regression of option parsing (:phab:`T307826`)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/793392
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: I7ca765a5f79f9e2057f077be3991323b72ad08f4
Gerrit-Change-Number: 793392
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/792930 )
Change subject: [py35] Show a warning if Pywikibot is running with Python 3.5 and below
......................................................................
[py35] Show a warning if Pywikibot is running with Python 3.5 and below
After toolforge was migrated from Debian Stretch to Debian Buster
Python 3.7.3 is available and Python 3.5 can be dropped. Show a
FutureWarning for the deprecation time.
Bug: T301908
Change-Id: I27700d47f6c0577a054f8bd7cea252cd31abd5d8
---
M pywikibot/__init__.py
M tests/utils.py
2 files changed, 14 insertions(+), 1 deletion(-)
Approvals:
Matěj Suchánek: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index aead197..1df2fb1 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -67,7 +67,7 @@
warning,
)
from pywikibot.site import APISite, BaseSite, DataSite
-from pywikibot.tools import classproperty, normalize_username
+from pywikibot.tools import classproperty, normalize_username, PYTHON_VERSION
ItemPageStrNoneType = Union[str, 'ItemPage', None]
@@ -93,6 +93,15 @@
argvu = [] # type: List[str]
+if PYTHON_VERSION < (3, 6):
+ warn("""
+Python {version} will be dropped with release 8.0 soon.
+It is recommended to use Python 3.6 or above.
+See T301908 for further information.
+""".format(version=sys.version.split(maxsplit=1)[0]),
+ FutureWarning) # adjust this line no in utils.execute()
+
+
class Timestamp(datetime.datetime):
"""Class for handling MediaWiki timestamps.
diff --git a/tests/utils.py b/tests/utils.py
index 160d703..171e165 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -19,6 +19,8 @@
from pywikibot.exceptions import APIError
from pywikibot.login import LoginStatus
from pywikibot.site import Namespace
+from pywikibot.tools import PYTHON_VERSION
+
from tests import _pwb_py
@@ -433,6 +435,8 @@
:param command: executable to run and arguments to use
:type command: list of str
"""
+ if PYTHON_VERSION < (3, 6):
+ command.insert(1, '-W ignore::FutureWarning:pywikibot:102')
if cryptography_version and cryptography_version < [1, 3, 4]:
command.insert(1, '-W ignore:Old version of cryptography:Warning')
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/792930
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: I27700d47f6c0577a054f8bd7cea252cd31abd5d8
Gerrit-Change-Number: 792930
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged