summaryrefslogtreecommitdiff
path: root/azurelinuxagent/common/future.py
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2016-09-13 16:11:47 +0100
committerusd-importer <ubuntu-server@lists.ubuntu.com>2016-09-14 10:39:12 +0000
commit5009a9d0f3606fc08a80ec0d59076d8dc48d2f25 (patch)
treead67eef74c5208178950db6ee28195e2137fa713 /azurelinuxagent/common/future.py
parent0f7cef5b52162d1ebb31a738bd8fc9febe1fbda6 (diff)
downloadvyos-walinuxagent-5009a9d0f3606fc08a80ec0d59076d8dc48d2f25.tar.gz
vyos-walinuxagent-5009a9d0f3606fc08a80ec0d59076d8dc48d2f25.zip
Import patches-unapplied version 2.1.5-0ubuntu1 to ubuntu/yakkety-proposed
Imported using git-ubuntu import. Changelog parent: 0f7cef5b52162d1ebb31a738bd8fc9febe1fbda6 New changelog entries: * New upstream release (LP: #1603581) - d/patches/disable-auto-update.patch: - The new version introduces auto-updating of the agent to its latest version via an internal mechanism; disable this - d/patches/fix_shebangs.patch: - Dropped in favour of the dh_python3 --shebang option. - Refreshed d/patches/disable_udev_overrides.patch
Diffstat (limited to 'azurelinuxagent/common/future.py')
-rw-r--r--azurelinuxagent/common/future.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/azurelinuxagent/common/future.py b/azurelinuxagent/common/future.py
new file mode 100644
index 0000000..8509732
--- /dev/null
+++ b/azurelinuxagent/common/future.py
@@ -0,0 +1,31 @@
+import sys
+
+"""
+Add alies for python2 and python3 libs and fucntions.
+"""
+
+if sys.version_info[0]== 3:
+ import http.client as httpclient
+ from urllib.parse import urlparse
+
+ """Rename Python3 str to ustr"""
+ ustr = str
+
+ bytebuffer = memoryview
+
+ read_input = input
+
+elif sys.version_info[0] == 2:
+ import httplib as httpclient
+ from urlparse import urlparse
+
+ """Rename Python2 unicode to ustr"""
+ ustr = unicode
+
+ bytebuffer = buffer
+
+ read_input = raw_input
+
+else:
+ raise ImportError("Unknown python version:{0}".format(sys.version_info))
+