summaryrefslogtreecommitdiff
path: root/morphlib/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/util.py')
-rw-r--r--morphlib/util.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/morphlib/util.py b/morphlib/util.py
index 100f4b6b..e171714a 100644
--- a/morphlib/util.py
+++ b/morphlib/util.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2012 Codethink Limited
+# Copyright (C) 2011-2013 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,6 +20,16 @@ import morphlib
'''Utility functions for morph.'''
+# It is intentional that if collections does not have OrderedDict that
+# simplejson is also used in preference to json, as OrderedDict became
+# a member of collections in the same release json got its object_pairs_hook
+try: # pragma: no cover
+ from collections import OrderedDict
+ import json
+except ImportError: # pragma: no cover
+ from ordereddict import OrderedDict
+ import simplejson as json
+
try:
from multiprocessing import cpu_count
except NotImplementedError: # pragma: no cover