[Sugar-devel] [PATCH sugar-datastore] Use json as included in Python SL #3142

Simon Schampijer simon at schampijer.de
Wed Aug 8 09:18:28 EDT 2012


We use json as included in Python. This will make Sugar dependent on
Python 2.6 and Python 2.7 to have the highest JSON performance.

Remove as well the requirement in sweets.recipe

Signed-off-by: Simon Schampijer <simon at laptop.org>
---
 src/carquinyol/migration.py | 5 ++---
 sweets.recipe               | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/carquinyol/migration.py b/src/carquinyol/migration.py
index 1745f2c..699552f 100644
--- a/src/carquinyol/migration.py
+++ b/src/carquinyol/migration.py
@@ -21,8 +21,7 @@ import os
 import logging
 import shutil
 import time
-
-import cjson
+import json
 
 from carquinyol import layoutmanager
 
@@ -65,7 +64,7 @@ def migrate_from_0():
 def _migrate_metadata(root_path, old_root_path, uid):
     metadata_path = layoutmanager.get_instance().get_metadata_path(uid)
     old_metadata_path = os.path.join(old_root_path, uid + '.metadata')
-    metadata = cjson.decode(open(old_metadata_path, 'r').read())
+    metadata = json.loads(open(old_metadata_path, 'r').read())
 
     if 'uid' not in metadata:
         metadata['uid'] = uid
diff --git a/sweets.recipe b/sweets.recipe
index b861c35..5b76e87 100644
--- a/sweets.recipe
+++ b/sweets.recipe
@@ -11,7 +11,7 @@ exec      = %(BUILDDIR)s/bin/datastore-service
 binding   = PATH %(BUILDDIR)s/bin
             PYTHONPATH %(BUILDDIR)s/src
             XDG_DATA_DIRS share
-requires  = sugar-toolkit; python-cjson; xapian-bindings-python
+requires  = sugar-toolkit; xapian-bindings-python
 
 [Archive]
 arch      = any
-- 
1.7.11.2



More information about the Sugar-devel mailing list