John Vandenberg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/243349

Change subject: Desupport Python 2.6 for Pywikibot 2.0 release branch
......................................................................

Desupport Python 2.6 for Pywikibot 2.0 release branch

Prevent setup.py and pwb.py from executing under Python 2.6.
Adapted from 1db58db (Unicode Python issue #10254)

Bug: T102461
Change-Id: I4db6e5f5d6d87dbf90c16a38ee6f69a7b7f66f1f
---
M pwb.py
M setup.py
2 files changed, 43 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/49/243349/1

diff --git a/pwb.py b/pwb.py
index 9ccb5df..601c2d4 100755
--- a/pwb.py
+++ b/pwb.py
@@ -29,6 +29,27 @@
 
 from warnings import warn
 
+PYTHON_VERSION = sys.version_info[:3]
+PY2 = (PYTHON_VERSION[0] == 2)
+
+versions_required_message = """
+Pywikibot 2.0 is not available on:
+%s
+
+Pywikibot is only supported under Python 2.7.2+ or 3.3+
+"""
+
+
+def python_is_supported():
+    """Check that Python is supported."""
+    # Any change to this must be copied to setup.py
+    return (PYTHON_VERSION >= (3, 3, 0) or
+            (PY2 and PYTHON_VERSION >= (2, 7, 2)))
+
+
+if not python_is_supported():
+    raise RuntimeError(versions_required_message % sys.version)
+
 pwb = None
 
 
diff --git a/setup.py b/setup.py
index f04f7bb..c8c95d7 100644
--- a/setup.py
+++ b/setup.py
@@ -10,6 +10,28 @@
 import os
 import sys
 
+PYTHON_VERSION = sys.version_info[:3]
+PY2 = (PYTHON_VERSION[0] == 2)
+
+versions_required_message = """
+Pywikibot 2.0 is not available on:
+%s
+
+Pywikibot is only supported under Python 2.7.2+ or 3.3+
+"""
+
+
+def python_is_supported():
+    """Check that Python is supported."""
+    # Any change to this must be copied to pwb.py
+    return (PYTHON_VERSION >= (3, 3, 0) or
+            (PY2 and PYTHON_VERSION >= (2, 7, 2)))
+
+
+if not python_is_supported():
+    raise RuntimeError(versions_required_message % sys.version)
+
+
 test_deps = []
 
 dependencies = ['httplib2>=0.9']

-- 
To view, visit https://gerrit.wikimedia.org/r/243349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4db6e5f5d6d87dbf90c16a38ee6f69a7b7f66f1f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to