Repository: libcloud
Updated Branches:
  refs/heads/trunk 368ed715b -> 8fa1168af


Update libcloud.utils.py3, only import from backports.ssl_match_hostname if pre
2.7.9 and 3.2.

This should fix the build failure.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7d533647
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7d533647
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7d533647

Branch: refs/heads/trunk
Commit: 7d53364737c7c286f66a8042afacce23a28bb456
Parents: 368ed71
Author: Tomaz Muraus <[email protected]>
Authored: Sat Mar 28 13:46:34 2015 +0100
Committer: Tomaz Muraus <[email protected]>
Committed: Sat Mar 28 13:46:34 2015 +0100

----------------------------------------------------------------------
 libcloud/utils/py3.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7d533647/libcloud/utils/py3.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/py3.py b/libcloud/utils/py3.py
index 7ef3c8b..7ae9cd6 100644
--- a/libcloud/utils/py3.py
+++ b/libcloud/utils/py3.py
@@ -28,6 +28,14 @@ try:
 except ImportError:
     from xml.etree import ElementTree as ET
 
+PY2 = sys.version_info[0] == 2
+PY3 = sys.version_info[0] == 3
+PY2_pre_25 = PY2 and sys.version_info < (2, 5)
+PY2_pre_26 = PY2 and sys.version_info < (2, 6)
+PY2_pre_27 = PY2 and sys.version_info < (2, 7)
+PY2_pre_279 = PY2 and sys.version_info < (2, 7, 9)
+PY3_pre_32 = PY3 and sys.version_info < (3, 2)
+
 PY2 = False
 PY25 = False
 PY26 = False
@@ -53,12 +61,11 @@ if sys.version_info >= (3, 0):
 if sys.version_info >= (3, 2) and sys.version_info < (3, 3):
     PY32 = True
 
-if sys.version_info >= (3, 2):
+if PY2_pre_279 or PY3_pre_32:
+    from backports.ssl_match_hostname import match_hostname, CertificateError  
# NOQA
+else:
     # ssl module in Python >= 3.2 includes match hostname function
     from ssl import match_hostname, CertificateError  # NOQA
-else:
-    from backports.ssl_match_hostname import match_hostname, CertificateError  
# NOQA
-
 
 if PY3:
     import http.client as httplib

Reply via email to