[buildj] use simplejson if python's json isn't available (they have the same api)



commit 3e13053937212d2d0b392822684bd35f56d06251
Author: Abderrahim Kitouni <a kitouni gmail com>
Date:   Tue Mar 23 09:29:07 2010 +0100

    use simplejson if python's json isn't available (they have the same api)

 buildj.py |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/buildj.py b/buildj.py
index 07c16c2..69e5dd2 100644
--- a/buildj.py
+++ b/buildj.py
@@ -1,4 +1,15 @@
-import json
+try:
+	import json
+except ImportError:
+	# Python < 2.6 doesn't have json
+	import simplejson as json
+
+try:
+	json.decoder
+except AttributeError:
+	# this is json-py and not Python's json
+	import simplejson as json
+
 import re
 
 WAF_TOOLS = {'cc':   'compiler_cc',



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]