From 0365ab7eafa09d8b057983ba706d13d716686f08 Mon Sep 17 00:00:00 2001
From: John Chilton <jmchilton@gmail.com>
Date: Mon, 10 Feb 2014 12:26:45 -0600
Subject: [PATCH] Drop dependency on simplejson, just use json.

Mirrors change made by @dannon to Galaxy.
---
 README.rst                            | 2 +-
 lwr/framework.py                      | 2 +-
 lwr/lwr_client/action_mapper.py       | 2 +-
 lwr/lwr_client/client.py              | 6 +++---
 lwr/managers/queued_external_drmaa.py | 2 +-
 lwr/routes.py                         | 2 +-
 lwr/scripts/drmaa_kill.py             | 2 +-
 lwr/scripts/drmaa_launch.py           | 2 +-
 requirements.txt                      | 1 -
 requirements3.txt                     | 1 -
 test/app_test.py                      | 8 ++++----
 test/test_utils.py                    | 4 ++--
 12 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/README.rst b/README.rst
index 8752ea82..2948e103 100644
--- a/README.rst
+++ b/README.rst
@@ -100,7 +100,7 @@ The ``easy_install`` command line application will be installed as
 part of setuptools. Use the following command to install the needed
 packages via ``easy_install``::
 
-    easy_install paste wsgiutils PasteScript PasteDeploy simplejson webob six pyOpenSSL
+    easy_install paste wsgiutils PasteScript PasteDeploy webob six pyOpenSSL
 
 ``pyOpenSSL`` is only required if LWR is configured to use HTTPS/SSL.
 
diff --git a/lwr/framework.py b/lwr/framework.py
index 17a72db7..78aeb81e 100644
--- a/lwr/framework.py
+++ b/lwr/framework.py
@@ -10,7 +10,7 @@ import inspect
 from os.path import exists
 import re
 
-from simplejson import dumps
+from json import dumps
 from six import Iterator
 
 
diff --git a/lwr/lwr_client/action_mapper.py b/lwr/lwr_client/action_mapper.py
index ce09207b..3903f515 100644
--- a/lwr/lwr_client/action_mapper.py
+++ b/lwr/lwr_client/action_mapper.py
@@ -1,4 +1,4 @@
-from simplejson import load
+from json import load
 from os.path import abspath
 from os.path import dirname
 from os.path import join
diff --git a/lwr/lwr_client/client.py b/lwr/lwr_client/client.py
index ff456426..f95a92f0 100644
--- a/lwr/lwr_client/client.py
+++ b/lwr/lwr_client/client.py
@@ -1,7 +1,7 @@
 import os
 import shutil
-import simplejson
-from simplejson import dumps
+import json
+from json import dumps
 from time import sleep
 
 from .destination import submit_params
@@ -16,7 +16,7 @@ class parseJson(object):
     def __call__(self, func):
         def replacement(*args, **kwargs):
             response = func(*args, **kwargs)
-            return simplejson.loads(response)
+            return json.loads(response)
         return replacement
 
 
diff --git a/lwr/managers/queued_external_drmaa.py b/lwr/managers/queued_external_drmaa.py
index 9ad769d9..ba2d79f0 100644
--- a/lwr/managers/queued_external_drmaa.py
+++ b/lwr/managers/queued_external_drmaa.py
@@ -1,4 +1,4 @@
-from simplejson import dumps
+from json import dumps
 from getpass import getuser
 
 from .base.base_drmaa import BaseDrmaaManager
diff --git a/lwr/routes.py b/lwr/routes.py
index 6b8db695..aa842481 100644
--- a/lwr/routes.py
+++ b/lwr/routes.py
@@ -1,6 +1,6 @@
 import os
 from webob import exc
-from simplejson import loads
+from json import loads
 
 from galaxy.util import (
     get_mapped_file,
diff --git a/lwr/scripts/drmaa_kill.py b/lwr/scripts/drmaa_kill.py
index adbdb603..e45a06e1 100644
--- a/lwr/scripts/drmaa_kill.py
+++ b/lwr/scripts/drmaa_kill.py
@@ -1,4 +1,4 @@
-from simplejson import load
+from json import load
 from lwr.managers.util.drmaa import DrmaaSessionFactory
 from lwr.scripts.util.args import ArgumentParser
 
diff --git a/lwr/scripts/drmaa_launch.py b/lwr/scripts/drmaa_launch.py
index e5a6a564..bf2a58b3 100644
--- a/lwr/scripts/drmaa_launch.py
+++ b/lwr/scripts/drmaa_launch.py
@@ -1,5 +1,5 @@
 from __future__ import print_function
-from simplejson import load
+from json import load
 from lwr.managers.util.drmaa import DrmaaSessionFactory
 from lwr.scripts.util.args import ArgumentParser
 
diff --git a/requirements.txt b/requirements.txt
index d68a592c..836b53fd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,3 @@
-simplejson
 webob
 pyOpenSSL
 psutil
diff --git a/requirements3.txt b/requirements3.txt
index d4c7bec7..b0c89e54 100644
--- a/requirements3.txt
+++ b/requirements3.txt
@@ -1,6 +1,5 @@
 ## Python 3 is not yet working, but when it does it will require
 ## different libraries. Hence this file.
-simplejson
 webob
 pyOpenSSL
 psutil
diff --git a/test/app_test.py b/test/app_test.py
index dfb4138c..dfc03e02 100644
--- a/test/app_test.py
+++ b/test/app_test.py
@@ -1,5 +1,5 @@
 import os
-import simplejson
+import json
 import urllib
 import time
 
@@ -12,7 +12,7 @@ def test_standard_requests():
     with test_app(test_conf={"extra_environ": {"REMOTE_ADDR": "127.101.101.98"}}) as app:
         staging_directory = app.app.staging_directory
         setup_response = app.get("/setup?job_id=12345")
-        setup_config = simplejson.loads(setup_response.body)
+        setup_config = json.loads(setup_response.body)
         assert setup_config["working_directory"].startswith(staging_directory)
         outputs_directory = setup_config["outputs_directory"]
         assert outputs_directory.startswith(staging_directory)
@@ -22,7 +22,7 @@ def test_standard_requests():
         def test_upload(upload_type):
             url = "/upload_%s?job_id=%s&name=input1" % (upload_type, job_id)
             upload_input_response = app.post(url, "Test Contents")
-            upload_input_config = simplejson.loads(upload_input_response.body)
+            upload_input_config = json.loads(upload_input_response.body)
             staged_input_path = upload_input_config["path"]
             staged_input = open(staged_input_path, "r")
             try:
@@ -53,7 +53,7 @@ def test_standard_requests():
         time.sleep(1)
 
         check_response = app.get("/check_complete?job_id=%s" % job_id)
-        check_config = simplejson.loads(check_response.body)
+        check_config = json.loads(check_response.body)
         assert check_config['returncode'] == 0
         assert check_config['stdout'] == "test_out"
         assert check_config['stderr'] == ""
diff --git a/test/test_utils.py b/test/test_utils.py
index 9681eab9..ce891c61 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -1,6 +1,6 @@
 from contextlib import contextmanager
 from stat import S_IXOTH
-import simplejson
+import json
 from os import pardir, stat, chmod, access, X_OK, pathsep, environ
 from os.path import join, dirname, isfile, split
 from tempfile import mkdtemp
@@ -48,7 +48,7 @@ def write_json_config(has_temp_directory, data, name="config.json"):
         temp_directory = has_temp_directory
     config_file = join(temp_directory, name)
     with open(config_file, "w") as f:
-        simplejson.dump(data, f)
+        json.dump(data, f)
     return config_file
 
 
-- 
GitLab