changeset 9:0069096e8e22

python 2.4 compatability
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 30 Mar 2012 16:45:50 -0700
parents 109627b7db9f
children a3599e4db9a4
files commandparser/command.py setup.py
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/commandparser/command.py	Fri Mar 30 10:37:39 2012 -0700
+++ b/commandparser/command.py	Fri Mar 30 16:45:50 2012 -0700
@@ -3,17 +3,21 @@
 """
 
 import inspect
-import json
 import os
 import sys
 from optparse import OptionParser
 from pprint import pprint
 
+try:
+    import json
+except ImportError:
+    import simplejson as json
+
 __all__ = ['Undefined', 'CommandParser']
 
 class Undefined(object):
-  def __init__(self, default):
-    self.default=default
+    def __init__(self, default):
+        self.default=default
 
 class CommandParser(OptionParser):
     # TODO: add `help` command
--- a/setup.py	Fri Mar 30 10:37:39 2012 -0700
+++ b/setup.py	Fri Mar 30 16:45:50 2012 -0700
@@ -4,9 +4,14 @@
 
 import os
 
-version = "0.1.1"
+version = "0.1.2"
 dependencies = []
 
+try:
+    import json
+except ImportError:
+    dependencies.append('simplejson')
+
 # allow use of setuptools/distribute or distutils
 kw = {}
 try: