libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1439012 - /libcloud/trunk/libcloud/utils/py3.py
Date Sun, 27 Jan 2013 01:28:44 GMT
Author: tomaz
Date: Sun Jan 27 01:28:44 2013
New Revision: 1439012

URL: http://svn.apache.org/viewvc?rev=1439012&view=rev
Log:
Only import os.path.relpath if we are running inside Python 2, but not Python
2.5.

Modified:
    libcloud/trunk/libcloud/utils/py3.py

Modified: libcloud/trunk/libcloud/utils/py3.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/utils/py3.py?rev=1439012&r1=1439011&r2=1439012&view=diff
==============================================================================
--- libcloud/trunk/libcloud/utils/py3.py (original)
+++ libcloud/trunk/libcloud/utils/py3.py Sun Jan 27 01:28:44 2013
@@ -28,8 +28,16 @@ PY3 = False
 PY2 = False
 PY25 = False
 
+if sys.version_info >= (2, 0) and sys.version_info < (3, 0):
+    PY2 = True
+
+if sys.version_info >= (2, 5) and sys.version_info <= (2, 6):
+    PY25 = True
+
 if sys.version_info >= (3, 0):
     PY3 = True
+
+if PY3:
     import http.client as httplib
     from io import StringIO
     import urllib
@@ -65,7 +73,6 @@ if sys.version_info >= (3, 0):
     def tostring(node):
         return ET.tostring(node, encoding='unicode')
 else:
-    PY2 = True
     import httplib
     from StringIO import StringIO
     import urllib
@@ -75,7 +82,9 @@ else:
     from urllib import quote as urlquote
     from urllib import unquote as urlunquote
     from urllib import urlencode as urlencode
-    from os.path import relpath
+
+    if not PY25:
+        from os.path import relpath
 
     basestring = unicode = str
 
@@ -92,8 +101,7 @@ else:
 
     tostring = ET.tostring
 
-if sys.version_info >= (2, 5) and sys.version_info <= (2, 6):
-    PY25 = True
+if PY25:
     import posixpath
 
     # Taken from http://jimmyg.org/work/code/barenecessities/index.html



Mime
View raw message