[Checkins] SVN: zc.buildout/branches/python-3-2/ fixed some imports and setuptools/distribute handling to get bootstrap.txt to fail the same way with Python 2 and 3

Thomas Lotze tl at gocept.com
Fri Apr 8 04:17:55 EDT 2011


Log message for revision 121344:
  fixed some imports and setuptools/distribute handling to get bootstrap.txt to fail the same way with Python 2 and 3

Changed:
  U   zc.buildout/branches/python-3-2/bootstrap/bootstrap.py
  U   zc.buildout/branches/python-3-2/src/zc/buildout/tests.py

-=-
Modified: zc.buildout/branches/python-3-2/bootstrap/bootstrap.py
===================================================================
--- zc.buildout/branches/python-3-2/bootstrap/bootstrap.py	2011-04-08 06:53:49 UTC (rev 121343)
+++ zc.buildout/branches/python-3-2/bootstrap/bootstrap.py	2011-04-08 08:17:54 UTC (rev 121344)
@@ -19,8 +19,11 @@
 """
 
 import os, shutil, sys, tempfile, textwrap
-import urllib.request, urllib.parse, urllib.error, urllib.request
-import urllib.error, urllib.parse, subprocess
+try:
+    import urllib.request as urllib2
+except ImportError:
+    import urllib2
+import subprocess
 from optparse import OptionParser
 
 if sys.platform == 'win32':
@@ -80,7 +83,7 @@
     if value:
         if '://' not in value: # It doesn't smell like a URL.
             value = 'file://%s' % (
-                urllib.request.pathname2url(
+                urllib2.pathname2url(
                     os.path.abspath(os.path.expanduser(value))),)
         if opt_str == '--download-base' and not value.endswith('/'):
             # Download base needs a trailing slash to make the world happy.
@@ -166,7 +169,7 @@
     if not hasattr(pkg_resources, '_distribute'):
         raise ImportError
 except ImportError:
-    ez_code = urllib.request.urlopen(
+    ez_code = urllib2.urlopen(
         options.setup_source).read().replace('\r\n'.encode(), '\n'.encode())
     ez = {}
     exec(ez_code, ez)

Modified: zc.buildout/branches/python-3-2/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/python-3-2/src/zc/buildout/tests.py	2011-04-08 06:53:49 UTC (rev 121343)
+++ zc.buildout/branches/python-3-2/src/zc/buildout/tests.py	2011-04-08 08:17:54 UTC (rev 121344)
@@ -3932,7 +3932,7 @@
     easy_install_SetUp(test)
     sample_eggs = test.globs['sample_eggs']
     ws = getWorkingSetWithBuildoutEgg(test)
-    makeNewRelease('distribute', ws, sample_eggs)
+    makeNewRelease(setuptools_key, ws, sample_eggs)
     makeNewRelease('zc.buildout', ws, sample_eggs)
     makeNewRelease('zc.buildout', ws, sample_eggs, '100.0b1')
     makeNewRelease('zc.buildout', ws, sample_eggs, '98.0')



More information about the checkins mailing list