Skip to content

Commit

Permalink
Merge pull request aparo#406 from thinalai/fix_OrderedDict
Browse files Browse the repository at this point in the history
fix OrderedDict ImportError with Python < 2.7
  • Loading branch information
aparo committed Jun 4, 2014
2 parents 547a8ca + 66be78b commit 9c24d04
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyes/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@


import threading
from collections import OrderedDict
try:
from collections import OrderedDict
except ImportError:
# python 2.6 or earlier, use backport
from ordereddict import OrderedDict
from .models import SortedDict, DotDict


Expand Down
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ def run(self, *args, **kwargs):
# For Python < 2.6 or people using a newer version of simplejson
install_requires.append("simplejson")

try:
from collections import OrderedDict
except ImportError:
# Python 2.6 or earlier, use backport
#from ordereddict import OrderedDict
install_requires.append("ordereddict")

py_version = sys.version_info
if not sys.platform.startswith("java") and sys.version_info < (2, 6):
install_requires.append("multiprocessing==2.6.2.1")
Expand Down

0 comments on commit 9c24d04

Please sign in to comment.