John Vandenberg has uploaded a new change for review.

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

Change subject: Remove hard dependency on ordereddict from pwb.py
......................................................................

Remove hard dependency on ordereddict from pwb.py

584be7e replaced a hard dependency on 'ordereddict' with a soft
dependency on 'future', as a more general collections backport
for Python 2.6.

pwb.py wasnt updated.

Change-Id: I431056d8ea52ae7ce410599478fcd6c0f8542083
---
M pwb.py
M pywikibot/tools.py
M tests/__init__.py
3 files changed, 7 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/86/189286/1

diff --git a/pwb.py b/pwb.py
index 11ad733..32ecb77 100644
--- a/pwb.py
+++ b/pwb.py
@@ -150,16 +150,6 @@
 
 del httplib2
 
-if sys.version_info[0] == 2 and sys.version_info[1] == 6:
-    try:
-        import ordereddict
-        del ordereddict
-    except ImportError as e:
-        print("ImportError: %s" % e)
-        print("pywikibot depends on module ordereddict in Python 2.6.")
-        print("Upgrade to Python 2.7, or run 'pip install ordereddict'")
-        sys.exit(1)
-
 # Search for user-config.py before creating one.
 try:
     # If successful, user-config.py already exists in one of the candidate
diff --git a/pywikibot/tools.py b/pywikibot/tools.py
index 61577d2..e3cf994 100644
--- a/pywikibot/tools.py
+++ b/pywikibot/tools.py
@@ -57,6 +57,11 @@
     try:
         from future.backports.misc import Counter, OrderedDict
     except ImportError:
+        warn("""
+pywikibot support of Python 2.6 relies on package future for many features.
+Please upgrade to Python 2.7+ or Python 3.3+, or run:
+    "pip install future"
+""", RuntimeWarning)
         try:
             from ordereddict import OrderedDict
         except ImportError:
@@ -829,6 +834,7 @@
 
         if wrapper.__signature__:
             # Build a new signature with deprecated args added.
+            # __signature__ is only available in Python 3 which has OrderedDict
             params = OrderedDict()
             for param in wrapper.__signature__.parameters.values():
                 params[param.name] = param.replace()
diff --git a/tests/__init__.py b/tests/__init__.py
index 16c7dc5..0f8012a 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -16,7 +16,7 @@
 
 # Verify that the unit tests have a base working environment:
 # - httplib2 is mandatory
-# - ordereddict is needed as a fallback for python 2.6,
+# - future is needed as a fallback for python 2.6,
 #   however if unavailable this will fail on use; see pywikibot/tools.py
 # - mwparserfromhell is optional, so is only imported in textlib_tests
 try:

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

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

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

Reply via email to