jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
setup.py: Use PYTHON_VERSION for version comparisons

sys.version_info == (2, 7, 2) is always False. The tuple form of
sys.version_info is something like (2, 7, 6, 'final', 0).

To avoid any future mistakes also replace other occurrences of
sys.version_info.

Bug: T191190
Change-Id: I247033d0908d0f1966e2eb9376d3fead4ce240c2
---
M setup.py
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/setup.py b/setup.py
index 90d1649..4561aec 100644
--- a/setup.py
+++ b/setup.py
@@ -99,7 +99,7 @@
import unittest2
sys.modules['unittest'] = unittest2

-if sys.version_info[0] == 2:
+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.
# The functional backport of py3 ipaddress is acceptable:
@@ -110,10 +110,10 @@
# ipaddr 2.1.10+ is distributed with Debian and Fedora. See T105443.
dependencies.append('ipaddr>=2.1.10')

- if sys.version_info == (2, 7, 2):
+ if PYTHON_VERSION == (2, 7, 2):
dependencies.append('future>=0.15.0') # Bug fixes for HTMLParser

- if sys.version_info < (2, 7, 9):
+ if PYTHON_VERSION < (2, 7, 9):
# Python versions before 2.7.9 will cause urllib3 to trigger
# InsecurePlatformWarning warnings for all HTTPS requests. By
# installing with security extras, requests will automatically set
@@ -155,11 +155,11 @@

if 'requests[security]' in test_deps:
# Bug T105767 on Python 2.7 release 9+
- if sys.version_info[:2] == (2, 7) and sys.version_info[2] >= 9:
+ if PY2 and PYTHON_VERSION[2] >= 9:
test_deps.remove('requests[security]')

# These extra dependencies are needed other unittest fails to load tests.
-if sys.version_info[0] == 2:
+if PY2:
test_deps += extra_deps['csv'] + ['mock']
else:
test_deps += ['six']

To view, visit change 423366. To unsubscribe, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I247033d0908d0f1966e2eb9376d3fead4ce240c2
Gerrit-Change-Number: 423366
Gerrit-PatchSet: 1
Gerrit-Owner: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot <>