jenkins-bot has submitted this change and it was merged.

Change subject: improvement; remove simplejson support completely, use json 
instead (py2.5 compatibility droped)
......................................................................


improvement; remove simplejson support completely, use json instead (py2.5 
compatibility droped)

Change-Id: Ic0e2e9ca1c631088674fff7728e9a82df88bcf22
---
M .gitmodules
M CONTENTS
M catimages.py
M commonsdelinker/checkusage.py
M commonsdelinker/delinker.py
M commonsdelinker/image_replacer.py
M externals/__init__.py
D externals/simplejson
M generate_family_file.py
M panoramiopicker.py
M query.py
M tests/test_externals.py
M wikipedia.py
13 files changed, 10 insertions(+), 53 deletions(-)

Approvals:
  DrTrigon: Checked; Looks good to me, but someone else must approve
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.gitmodules b/.gitmodules
index 7a21ee4..3ceaddf 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,6 +7,3 @@
 [submodule "externals/spelling"]
        path = externals/spelling
        url = https://gerrit.wikimedia.org/r/p/pywikibot/spelling.git
-[submodule "externals/simplejson"]
-       path = externals/simplejson
-       url = https://github.com/simplejson/simplejson.git
diff --git a/CONTENTS b/CONTENTS
index 8fbb3f9..24abdb1 100644
--- a/CONTENTS
+++ b/CONTENTS
@@ -259,8 +259,6 @@
 externals              : Contains all external software that might be used by
                          by PyWikipediaBot scripts and libraries. The most
                          important among them are:
-                         * simplejson; used by query.py and needed for python
-                                       release prev. 2.6
                          * spelling; dictionaries for spellcheck.py
                          * BeautifulSoup.py; 
http://www.crummy.com/software/BeautifulSoup
                          (and more)
diff --git a/catimages.py b/catimages.py
index 0ed7684..10b3376 100644
--- a/catimages.py
+++ b/catimages.py
@@ -48,7 +48,7 @@
 
 # python default packages
 import re, urllib2, os, locale, sys, datetime, math, shutil, mimetypes, shelve
-import StringIO, json # fallback: simplejson
+import StringIO, json
 from subprocess import Popen, PIPE
 try:
     import Image            # classic 'PIL'
diff --git a/commonsdelinker/checkusage.py b/commonsdelinker/checkusage.py
index 67bc2fd..9fa32d4 100644
--- a/commonsdelinker/checkusage.py
+++ b/commonsdelinker/checkusage.py
@@ -43,7 +43,7 @@
 
 import wikipedia, family
 
-import simplejson   # after 'wikipedia' because of externals path
+import json
 
 try:
     import MySQLdb
@@ -141,7 +141,7 @@
             self._conn.close()
             self.__init__(self.host)
         try:
-            data = simplejson.load(res)
+            data = json.load(res)
         finally:
             res.close()
 
diff --git a/commonsdelinker/delinker.py b/commonsdelinker/delinker.py
index c674071..18d09dd 100644
--- a/commonsdelinker/delinker.py
+++ b/commonsdelinker/delinker.py
@@ -23,7 +23,7 @@
 # Distributed under the terms of the MIT license.
 #
 __version__ = '$Id$'
-# This script requires MySQLdb and simplejson. Tested with:
+# This script requires MySQLdb and json. Tested with:
 # * Python 2.4.4, MySQLdb 1.2.1_p, simplejson 1.3
 # * Python 2.5, MySQLdb 1.2.2, simplejson 1.5 (recommended)
 # TODO:
diff --git a/commonsdelinker/image_replacer.py 
b/commonsdelinker/image_replacer.py
index f5d8015..dec7c08 100644
--- a/commonsdelinker/image_replacer.py
+++ b/commonsdelinker/image_replacer.py
@@ -11,7 +11,7 @@
 #
 __version__ = '$Id$'
 import config, wikipedia
-import simplejson   # after 'wikipedia' because of externals path
+import json
 import re, time
 import sys, os, signal, traceback
 
@@ -163,7 +163,7 @@
         if since:
             predata.append(('rvend', since))
         response, data = self.site.postForm(address, predata)
-        data = simplejson.loads(data)
+        data = json.loads(data)
         if 'error' in data:
             raise RuntimeError(data['error'])
 
diff --git a/externals/__init__.py b/externals/__init__.py
index 89baed3..cabe6d1 100644
--- a/externals/__init__.py
+++ b/externals/__init__.py
@@ -54,12 +54,6 @@
 #           'spelling': $ svn propedit svn:externals externals/.
 #                         spelling 
http://svn.wikimedia.org/svnroot/pywikipedia/trunk/spelling/
 #                       $ git submodule add 
https://gerrit.wikimedia.org/r/p/pywikibot/spelling.git externals/spelling
-#         'simplejson': $ svn propedit svn:externals externals/.
-#                         simplejson 
http://simplejson.googlecode.com/svn/tags/simplejson-2.1.3/simplejson/
-#                       $ git submodule add 
https://github.com/simplejson/simplejson.git externals/simplejson
-#                       $ cd externals/simplejson; git checkout v2.1.3
-#         'simplejson': ({'linux-fedora': ['python-simplejson'],
-#                         'linux-ubuntu': [''],},
    'BeautifulSoup.py': ({'linux-fedora': ['python-BeautifulSoup'],
                          'linux-ubuntu': ['']},
                         {  'url': 
'https://pypi.python.org/packages/source/B/BeautifulSoup/BeautifulSoup-3.2.0.tar.gz',
diff --git a/externals/simplejson b/externals/simplejson
deleted file mode 160000
index 04d4032..0000000
--- a/externals/simplejson
+++ /dev/null
-Subproject commit 04d4032816f7faa64912b487060d2c475f595c46
diff --git a/generate_family_file.py b/generate_family_file.py
index 64286ab..06464c9 100644
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -45,10 +45,7 @@
 # parsing response data
 from BeautifulSoup import BeautifulSoup
 
-try:
-    import json
-except ImportError:
-    import simplejson as json   # after 'wikipedia' because of externals path
+import json
 
 class FamilyFileGenerator(object):
     def __init__(self, url=None, name=None, dointerwiki=None):
diff --git a/panoramiopicker.py b/panoramiopicker.py
index d7cb218..33549fd 100644
--- a/panoramiopicker.py
+++ b/panoramiopicker.py
@@ -18,15 +18,7 @@
 import externals                            # check for and install needed
 externals.check_setup('BeautifulSoup.py')   #  'externals'
 
-try:
-    #For Python 2.6 newer
-    import json
-    if not hasattr(json, 'loads'):
-        # 'json' can also be the name in for
-        # http://pypi.python.org/pypi/python-json
-        raise ImportError
-except ImportError:
-    import simplejson as json   # after 'wikipedia' because of externals path
+import json
 
 from Tkinter import *
 from PIL import Image, ImageTk    # see: 
http://www.pythonware.com/products/pil/
diff --git a/query.py b/query.py
index e5414aa..ced5323 100644
--- a/query.py
+++ b/query.py
@@ -29,15 +29,7 @@
 import wikipedia as pywikibot
 import config
 from pywikibot.support import deprecate_arg
-try:
-    #For Python 2.6 newer
-    import json
-    if not hasattr(json, 'loads'):
-        # 'json' can also be the name in for
-        # http://pypi.python.org/pypi/python-json
-        raise ImportError
-except ImportError:
-    import simplejson as json   # after 'wikipedia' because of externals path
+import json
 
 @deprecate_arg("encodeTitle", None)
 def GetData(params, site=None, useAPI=True, retryCount=config.maxretries,
diff --git a/tests/test_externals.py b/tests/test_externals.py
index cd892d6..8c45a94 100644
--- a/tests/test_externals.py
+++ b/tests/test_externals.py
@@ -27,10 +27,6 @@
 
 class PyWikiExternalImporterTestCase(test_pywiki.PyWikiTestCase):
 
-    def test_simplejson(self):
-        import simplejson
-        self.assertTrue( "simplejson" in sys.modules )
-
     def test_spelling(self):
         self.assertTrue(os.path.exists(os.path.join(scriptdir, 
'../externals/spelling')))
 
diff --git a/wikipedia.py b/wikipedia.py
index eba0e71..e476b3b 100644
--- a/wikipedia.py
+++ b/wikipedia.py
@@ -151,16 +151,7 @@
 from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup, SoupStrainer
 import weakref
 import logging, logging.handlers
-try:
-    #For Python 2.6 newer
-    import json
-    if not hasattr(json, 'loads'):
-        # 'json' can also be the name in for
-        # http://pypi.python.org/pypi/python-json
-        raise ImportError
-except ImportError:
-    externals.check_setup('simplejson')
-    import simplejson as json
+import json
 # Splitting the bot into library parts
 from pywikibot.support import *
 import config, login, query

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic0e2e9ca1c631088674fff7728e9a82df88bcf22
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: DrTrigon <[email protected]>
Gerrit-Reviewer: DrTrigon <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: PywikibotCommitWatcher <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to