summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2Py3k.py
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2011-04-26 12:40:32 -0500
committerSol Jerome <sol.jerome@gmail.com>2011-04-26 12:40:32 -0500
commit944df5470f9d30717baccf7b716fd4847b31da27 (patch)
tree1211b8f65d13ff0934b1f3f5a5ada3112ea5a8dd /src/lib/Bcfg2Py3k.py
parent25576cd076d66dfed4bbd98ce1bbb3bc86a6230e (diff)
downloadbcfg2-944df5470f9d30717baccf7b716fd4847b31da27.tar.gz
bcfg2-944df5470f9d30717baccf7b716fd4847b31da27.tar.bz2
bcfg2-944df5470f9d30717baccf7b716fd4847b31da27.zip
Consolidate PY3K compatibility libraries
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src/lib/Bcfg2Py3k.py')
-rw-r--r--src/lib/Bcfg2Py3k.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/Bcfg2Py3k.py b/src/lib/Bcfg2Py3k.py
new file mode 100644
index 000000000..b334c4466
--- /dev/null
+++ b/src/lib/Bcfg2Py3k.py
@@ -0,0 +1,24 @@
+try:
+ from email.Utils import formatdate
+except ImportError:
+ from email.utils import formatdate
+
+# urllib imports
+try:
+ from urllib import urlopen
+except ImportError:
+ from urllib.request import urlopen
+try:
+ from urlparse import urljoin
+except ImportError:
+ from urllib.parse import urljoin
+
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from io import StringIO
+
+try:
+ import ConfigParser
+except ImportError:
+ import configparser as ConfigParser