jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/445095 )
Change subject: Drop Python 2.7.2/2.7.3 support ......................................................................
Drop Python 2.7.2/2.7.3 support
Bug: T191192 Change-Id: I694c8e1a483f3637939db43a8ea2f154a05f710e --- M .appveyor.yml M HISTORY.rst M dev-requirements.txt M docs/index.rst M pwb.py M pywikibot/README.rst M pywikibot/__init__.py M pywikibot/site_detect.py M pywikibot/textlib.py M requirements.txt M setup.py M tests/__init__.py M tests/utils.py 13 files changed, 44 insertions(+), 103 deletions(-)
Approvals: Dalba: Looks good to me, approved jenkins-bot: Verified
diff --git a/.appveyor.yml b/.appveyor.yml index aa5f763..315f09c 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,16 +17,16 @@
# Test the lowest supported release of each major Python version.
- - PYTHON: "C:\Python272" - PYTHON_VERSION: "2.7.2" + - PYTHON: "C:\Python274" + PYTHON_VERSION: "2.7.4" PYTHON_ARCH: "32"
- PYTHON: "C:\Python341" PYTHON_VERSION: "3.4.1" PYTHON_ARCH: "32"
- - PYTHON: "C:\Python272-x64" - PYTHON_VERSION: "2.7.2" + - PYTHON: "C:\Python274-x64" + PYTHON_VERSION: "2.7.4" PYTHON_ARCH: "64"
- PYTHON: "C:\Python341-x64" diff --git a/HISTORY.rst b/HISTORY.rst index 0033fb2..2c30039 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,7 +3,7 @@
Current release --------------- - +* Dropped support for py2.7.2 and py2.7.3 (T191192) * Bugfixes and improvements * Localisation updates
diff --git a/dev-requirements.txt b/dev-requirements.txt index ea8424c..828eac5 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,7 +1,5 @@ # This is a PIP 6+ requirements file for development dependencies # -unittest2==0.8.0 ; python_full_version == '2.7.2' - pytest>=3.6.0 pytest-timeout pytest-runner diff --git a/docs/index.rst b/docs/index.rst index 2b780e2..b471ea5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -13,7 +13,7 @@
Pywikibot is a Python library and collection of scripts that automate work on `MediaWiki https://mediawiki.org`_ sites.
-Pywikibot supports Python 2.7.2+ and 3.4+. +Pywikibot supports Python 2.7.4+ and 3.4+.
Pywikibot and this documentation are licensed under the :ref:`MIT license <licenses-MIT>`; manual pages on mediawiki.org are licensed under the `CC-BY-SA 3.0`_ license. diff --git a/pwb.py b/pwb.py index 26d6d66..d6211ef 100755 --- a/pwb.py +++ b/pwb.py @@ -9,7 +9,7 @@ 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) Pywikibot team, 2012-2018 +# (C) Pywikibot team, 2012-2019 # # Distributed under the terms of the MIT license. # @@ -29,14 +29,14 @@ Pywikibot is not available on: {version}
-This version of Pywikibot only supports Python 2.7.2+ or 3.4+. +This version of Pywikibot only supports Python 2.7.4+ or 3.4+. """
def python_is_supported(): """Check that Python is supported.""" # Any change to this must be copied to setup.py - return PYTHON_VERSION >= (3, 4, 0) or PY2 and PYTHON_VERSION >= (2, 7, 2) + return PYTHON_VERSION >= (3, 4, 0) or PY2 and PYTHON_VERSION >= (2, 7, 4)
if not python_is_supported(): diff --git a/pywikibot/README.rst b/pywikibot/README.rst index a817648..7303b28 100644 --- a/pywikibot/README.rst +++ b/pywikibot/README.rst @@ -30,7 +30,7 @@ * python-tkinter (optional, used by some experimental GUI stuff)
-You need to have at least python version `2.7.2 http://www.python.org/download/`_ +You need to have at least python version `2.7.4 http://www.python.org/download/`_ or newer installed on your computer to be able to run any of the code in this package, but not 3.0-3.3. It works fine with 3.4+ versions of python installed. Support for older versions of python is not planned. Some scripts could run with diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index 899710a..61b2699 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """The initialization file for the Pywikibot framework.""" # -# (C) Pywikibot team, 2008-2018 +# (C) Pywikibot team, 2008-2019 # # Distributed under the terms of the MIT license. # @@ -133,14 +133,6 @@ deprecate_arg = redirect_func(_deprecate_arg)
-if sys.version_info[:2] == (2, 7) and sys.version_info[2] in (2, 3): - warn( - 'Pywikibot will soon drop support for Python 2.7.2 and 2.7.3, ' - 'please update your Python.', - FutureWarning, - ) - - class Timestamp(datetime.datetime):
"""Class for handling MediaWiki timestamps. diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py index c8d6f13..5bc6a74 100644 --- a/pywikibot/site_detect.py +++ b/pywikibot/site_detect.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Classes for detecting a MediaWiki site.""" # -# (C) Pywikibot team, 2010-2018 +# (C) Pywikibot team, 2010-2019 # # Distributed under the terms of the MIT license. # @@ -23,10 +23,7 @@ from html.parser import HTMLParser from urllib.parse import urljoin, urlparse else: - if PYTHON_VERSION == (2, 7, 2): - from future.backports.html.parser import HTMLParser # T175873 - else: - from HTMLParser import HTMLParser + from HTMLParser import HTMLParser from urlparse import urljoin, urlparse
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 83cade7..500ebd0 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -7,7 +7,7 @@
""" # -# (C) Pywikibot team, 2008-2018 +# (C) Pywikibot team, 2008-2019 # # Distributed under the terms of the MIT license. # @@ -110,44 +110,32 @@ # [[ or ]]. # The namespace names must be substituted into this regex. # e.g. FILE_LINK_REGEX % 'File' or FILE_LINK_REGEX % '|'.join(site.namespaces) -if sys.version_info[:3] >= (2, 7, 4): - FILE_LINK_REGEX = r""" - [[\s* - (?:%s) # namespace aliases - \s*: - (?=(?P<filename> - [^]|]* - ))(?P=filename) +FILE_LINK_REGEX = r""" + [[\s* + (?:%s) # namespace aliases + \s*: + (?=(?P<filename> + [^]|]* + ))(?P=filename) + ( + | ( - | ( - ( - (?=(?P<inner_link> - [[.*?]] - ))(?P=inner_link) - )? - (?=(?P<other_chars> - [^[]]* - ))(?P=other_chars) - | - (?=(?P<not_wikilink> - [[^]]*] - ))(?P=not_wikilink) - )*? - )?? - ]] - """ -else: - # Python 2.7.2 and 2.7.3 re bug (T191161) - FILE_LINK_REGEX = r""" - [[\s*(?:%s)\s*:[^|]*?\s* - (| - ( ( [[ .*? ]] )? [^[]*? - | [ [^]]*? ] - )* - )? + (?=(?P<inner_link> + [[.*?]] + ))(?P=inner_link) + )? + (?=(?P<other_chars> + [^[]]* + ))(?P=other_chars) + | + (?=(?P<not_wikilink> + [[^]]*] + ))(?P=not_wikilink) + )*? + )?? ]] - """ +"""
NON_LATIN_DIGITS = { 'ckb': '٠١٢٣٤٥٦٧٨٩', diff --git a/requirements.txt b/requirements.txt index 551d858..36d9ba7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,8 +24,6 @@ # requests security extra requests[security] ; python_full_version > '2.7.6' and python_full_version < '2.7.9'
-future>=0.15.0 ; python_full_version < '2.7.3' - ipaddr>=2.1.10 ; python_version < '3'
# OAuth support diff --git a/setup.py b/setup.py index a73a804..00745d1 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Installer script for Pywikibot 3.0 framework.""" # -# (C) Pywikibot team, 2009-2018 +# (C) Pywikibot team, 2009-2019 # # Distributed under the terms of the MIT license. # @@ -13,17 +13,6 @@
from setuptools import find_packages, setup
-if sys.version_info[:3] < (2, 7, 4): - try: - # Work around a traceback on Python < 2.7.4 - # http://bugs.python.org/issue15881#msg170215 - import multiprocessing - except ImportError: - pass - else: - _unused = multiprocessing # pyflakes workaround - - PYTHON_VERSION = sys.version_info[:3] PY2 = (PYTHON_VERSION[0] == 2)
@@ -31,14 +20,14 @@ Pywikibot is not available on: {version}
-This version of Pywikibot only supports Python 2.7.2+ or 3.4+. +This version of Pywikibot only supports Python 2.7.4+ or 3.4+. """
def python_is_supported(): """Check that Python is supported.""" # Any change to this must be copied to pwb.py - return PYTHON_VERSION >= (3, 4, 0) or PY2 and PYTHON_VERSION >= (2, 7, 2) + return PYTHON_VERSION >= (3, 4, 0) or PY2 and PYTHON_VERSION >= (2, 7, 4)
if not python_is_supported(): @@ -110,15 +99,6 @@ 'git+https://github.com/vasily-v-ryabov/pywinauto-64#egg=pywinauto', ]
-if PYTHON_VERSION == (2, 7, 2): - # work around distutils hardcoded unittest dependency - # work around T106512 - import unittest - _unused = unittest - if 'test' in sys.argv: - import unittest2 - sys.modules['unittest'] = unittest2 - if PY2: # tools.ip does not have a hard dependency on an IP address module, # as it falls back to using regexes if one is not available. @@ -130,9 +110,6 @@ # ipaddr 2.1.10+ is distributed with Debian and Fedora. See T105443. dependencies.append('ipaddr>=2.1.10')
- if PYTHON_VERSION == (2, 7, 2): - dependencies.append('future>=0.15.0') # Bug fixes for HTMLParser - if (2, 7, 6) < PYTHON_VERSION < (2, 7, 9): # Python versions before 2.7.9 will cause urllib3 to trigger # InsecurePlatformWarning warnings for all HTTPS requests. By @@ -240,7 +217,7 @@ packages=[str(name)] + [package for package in find_packages() if package.startswith('pywikibot.')], - python_requires='>=2.7.2, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + python_requires='>=2.7.4, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', install_requires=dependencies, dependency_links=dependency_links, extras_require=extra_deps, diff --git a/tests/__init__.py b/tests/__init__.py index 7bddc15..7f47850 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Package tests.""" # -# (C) Pywikibot team, 2007-2018 +# (C) Pywikibot team, 2007-2019 # # Distributed under the terms of the MIT license. # @@ -19,9 +19,9 @@ # Verify that the unit tests have a base working environment: # - requests is mandatory # however if unavailable this will fail on use; see pywikibot/tools.py -# - unittest2; see below # - mwparserfromhell is optional, so is only imported in textlib_tests import requests +import unittest
from pywikibot import config import pywikibot.data.api @@ -30,11 +30,6 @@ from pywikibot import i18n from pywikibot.tools import PYTHON_VERSION
-if PYTHON_VERSION == (2, 7, 2): - # Use unittest2 for python 2.7.2 (T106512) - import unittest2 as unittest -else: - import unittest try: import unittest.mock as mock from unittest.mock import MagicMock, Mock, patch diff --git a/tests/utils.py b/tests/utils.py index c0ce35b..09d423f 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Test utilities.""" # -# (C) Pywikibot team, 2013-2018 +# (C) Pywikibot team, 2013-2019 # # Distributed under the terms of the MIT license. # @@ -643,10 +643,6 @@ @param command: executable to run and arguments to use @type command: list of unicode """ - if PYTHON_VERSION[:2] == (2, 7) and PYTHON_VERSION[2] in (2, 3): - command.insert(1, '-W ignore:{0}:DeprecationWarning'.format( - 'Pywikibot will soon drop support for Python 2.7.2 and 2.7.3, ' - 'please update your Python.')) if cryptography_version and cryptography_version < [1, 3, 4]: command.insert(1, '-W ignore:Old version of cryptography:Warning') # Any environment variables added on Windows must be of type
pywikibot-commits@lists.wikimedia.org