From defcb43883797aa02cc7101e2d4a26f197152362 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 13 May 2014 12:28:39 +0530 Subject: [PATCH] Use json instead of simplejson library to avoid extra depedency Simplejson is an externally mainainted version of json library available in Python 2.6 and up. It supports Python 2.5 which were are not targetting. It also boasts better speed which is not at all a factor for us. --- INSTALL | 2 +- Makefile | 2 +- fabfile.py | 7 ++----- filedict.py | 6 +----- modules/installed/lib/user_store.py | 5 ----- modules/installed/santiago/santiago.py | 4 ---- modules/installed/system/config.py | 5 +---- 7 files changed, 6 insertions(+), 25 deletions(-) diff --git a/INSTALL b/INSTALL index b131f1f4e..503c1a53a 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ Install the dependencies: -apt-get install libpython2.7 pandoc psmisc python2.7 python-bcrypt python-cherrypy3 python-django python-passlib python-simplejson python-bootstrapform libjs-twitter-bootstrap sudo +apt-get install libpython2.7 pandoc psmisc python2.7 python-bcrypt python-cherrypy3 python-django python-passlib python-bootstrapform libjs-twitter-bootstrap sudo Unzip and untar the source into a directory. Change to the directory containing the program. Run: diff --git a/Makefile b/Makefile index 71990e49f..298bc0bb5 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ default: config dirs docs all: default predepend: - sudo sh -c "apt-get install libpython2.7 pandoc psmisc python2.7 python-bcrypt python-cherrypy3 python-django python-passlib python-simplejson python-bootstrapform libjs-twitter-bootstrap sudo" + sudo sh -c "apt-get install libpython2.7 pandoc psmisc python2.7 python-bcrypt python-cherrypy3 python-django python-passlib python-bootstrapform libjs-twitter-bootstrap sudo" git submodule init git submodule update touch predepend diff --git a/fabfile.py b/fabfile.py index f56e08b29..c8bde9722 100644 --- a/fabfile.py +++ b/fabfile.py @@ -7,10 +7,7 @@ # plinth box import os,sys, subprocess -try: - import simplejson as json -except ImportError: - import json +import json import fabric.api from fabric.api import local, env, cd, put, get, task @@ -150,7 +147,7 @@ def apache(): @task def deps(): "Basic plinth dependencies" - sudo('apt-get install --no-install-recommends -y python make pandoc python-simplejson python-pyme python-django python-bootstrapform libjs-twitter-bootstrap') + sudo('apt-get install --no-install-recommends -y python make pandoc python-pyme python-django python-bootstrapform libjs-twitter-bootstrap') @task def update(): diff --git a/filedict.py b/filedict.py index d4f9a35ad..94f779759 100644 --- a/filedict.py +++ b/filedict.py @@ -5,13 +5,9 @@ Author: Erez Shinan Date : 31-May-2009 """ -try: - import simplejson as json ## jlv replaced pickle with json -except ImportError: - import json +import json import UserDict -##import cPickle as pickle import sqlite3 diff --git a/modules/installed/lib/user_store.py b/modules/installed/lib/user_store.py index 595e83893..41d13f947 100644 --- a/modules/installed/lib/user_store.py +++ b/modules/installed/lib/user_store.py @@ -1,8 +1,3 @@ -import os -try: - import simplejson as json -except ImportError: - import json import cherrypy import cfg from model import User diff --git a/modules/installed/santiago/santiago.py b/modules/installed/santiago/santiago.py index 6d179c50b..b052daab7 100644 --- a/modules/installed/santiago/santiago.py +++ b/modules/installed/santiago/santiago.py @@ -7,10 +7,6 @@ haven't figured that one all the way through yet. import os, sys import cherrypy -try: - import simplejson as json -except ImportError: - import json from gettext import gettext as _ from plugin_mount import PagePlugin from modules.auth import require diff --git a/modules/installed/system/config.py b/modules/installed/system/config.py index dde4329e3..d39777e29 100644 --- a/modules/installed/system/config.py +++ b/modules/installed/system/config.py @@ -23,10 +23,7 @@ import cherrypy from django import forms from django.core import validators from gettext import gettext as _ -try: - import simplejson as json -except ImportError: - import json +import json import os import socket