Make ordered dict work on 2.6

This commit is contained in:
Joshua Harlow
2012-06-01 12:04:19 -07:00
parent 6a13cabb35
commit b19381f350
2 changed files with 14 additions and 3 deletions

View File

@@ -25,6 +25,17 @@ import re
# This one keeps comments but has some weirdness with it
import iniparse
try:
# Only exists on 2.7 or greater
from collections import OrderedDict
except ImportError:
try:
# Try the pypi module
from ordereddict import OrderedDict
except ImportError:
# Not really ordered :-(
OrderedDict = dict
from anvil import cfg_helpers
from anvil import env
from anvil import exceptions as excp
@@ -90,7 +101,7 @@ class IgnoreMissingMixin(object):
class BuiltinConfigParser(IgnoreMissingMixin, ConfigParser.RawConfigParser, StringiferMixin):
def __init__(self, cs=True, fns=None, defaults=None):
ConfigParser.RawConfigParser.__init__(self, defaults=defaults, dict_type=collections.OrderedDict)
ConfigParser.RawConfigParser.__init__(self, defaults=defaults, dict_type=OrderedDict)
if cs:
# Make option names case sensitive
# See: http://docs.python.org/library/configparser.html#ConfigParser.RawConfigParser.optionxform
@@ -102,7 +113,7 @@ class BuiltinConfigParser(IgnoreMissingMixin, ConfigParser.RawConfigParser, Stri
class RewritableConfigParser(IgnoreMissingMixin, iniparse.RawConfigParser, StringiferMixin):
def __init__(self, cs=True, fns=None, defaults=None):
iniparse.RawConfigParser.__init__(self, defaults=defaults, dict_type=collections.OrderedDict)
iniparse.RawConfigParser.__init__(self, defaults=defaults, dict_type=OrderedDict)
if cs:
# Make option names case sensitive
# See: http://docs.python.org/library/configparser.html#ConfigParser.RawConfigParser.optionxform

View File

@@ -43,7 +43,7 @@ then
fi
# Install the needed yum packages
PKGS="gcc git pylint python python-netifaces python-pep8 python-pip python-progressbar PyYAML"
PKGS="gcc git pylint python python-netifaces python-pep8 python-pip python-progressbar PyYAML ordereddict"
echo "Installing packages: $PKGS"
yum -y -q install $PKGS