setup.py: fix python3 badness py33
authorrobin
Mon, 18 Nov 2013 15:03:20 +0000
branchpy33
changeset 3785 974819935ede
parent 3783 b4d048dad7e6
child 3786 5008a8b9567b
setup.py: fix python3 badness
setup.py
--- a/setup.py	Tue Oct 15 14:56:22 2013 +0100
+++ b/setup.py	Mon Nov 18 15:03:20 2013 +0000
@@ -7,7 +7,7 @@
 except ImportError:
     import ConfigParser as configparser
 import functools
-isPython3 = sys.version_info[0]==3
+isPy3 = sys.version_info[0]==3
 platform = sys.platform
 pjoin = os.path.join
 abspath = os.path.abspath
@@ -223,7 +223,11 @@
         ]
 
 def get_fonts(PACKAGE_DIR, reportlab_files):
-    import sys, os, os.path, urllib.request, urllib.error, urllib.parse, zipfile, io
+    import sys, os, os.path, zipfile, io
+    if isPy3:
+        import urllib.request as ureq
+    else:
+        import urllib2 as ureq
     rl_dir = PACKAGE_DIR['reportlab']
     if not [x for x in reportlab_files if not os.path.isfile(pjoin(rl_dir,x))]:
         infoline("Standard T1 font curves already downloaded")
@@ -231,7 +235,7 @@
     try:
         infoline("Downloading standard T1 font curves")
 
-        remotehandle = urllib.request.urlopen("http://www.reportlab.com/ftp/pfbfer-20070710.zip")
+        remotehandle = ureq.urlopen("http://www.reportlab.com/ftp/pfbfer-20070710.zip")
         zipdata = io.BytesIO(remotehandle.read())
         remotehandle.close()
         archive = zipfile.ZipFile(zipdata)
@@ -287,7 +291,7 @@
                             libraries=[], # libraries to link against
                             ),
                         ]
-        if not isPython3:
+        if not isPy3:
             EXT_MODULES += [
                     Extension( 'reportlab.lib.sgmlop',
                             [pjoin(RL_ACCEL,'sgmlop.c')],