[Checkins] SVN: zc.buildout/branches/regebro-python3-150/ Merged in the Python 3 support branch.

Lennart Regebro regebro at gmail.com
Sat Jul 24 16:13:42 EDT 2010


Log message for revision 115053:
  Merged in the Python 3 support branch.

Changed:
  U   zc.buildout/branches/regebro-python3-150/bootstrap/bootstrap.py
  U   zc.buildout/branches/regebro-python3-150/dev.py
  U   zc.buildout/branches/regebro-python3-150/setup.py
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/__init__.py
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/buildout.py
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/buildout.txt
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/debugging.txt
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/download.py
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/downloadcache.txt
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/easy_install.py
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/easy_install.txt
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/repeatable.txt
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/rmtree.py
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/testing.py
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/testrecipes.py
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/tests.py
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/update.txt
  U   zc.buildout/branches/regebro-python3-150/src/zc/buildout/windows.txt
  U   zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/README.txt
  U   zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/custom.txt
  U   zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt

-=-
Modified: zc.buildout/branches/regebro-python3-150/bootstrap/bootstrap.py
===================================================================
--- zc.buildout/branches/regebro-python3-150/bootstrap/bootstrap.py	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/bootstrap/bootstrap.py	2010-07-24 20:13:42 UTC (rev 115053)
@@ -22,6 +22,10 @@
 
 import os, shutil, sys, tempfile, textwrap, urllib, urllib2, subprocess
 from optparse import OptionParser
+try: # py3K compat hack:
+    from urllib import urlopen
+except ImportError:
+    from urllib.request import urlopen
 
 if sys.platform == 'win32':
     def quote(c):
@@ -137,6 +141,9 @@
     else:
         options.setup_source = setuptools_source
 
+if sys.version >= '3':
+    USE_DISTRIBUTE = True
+    
 args = args + ['bootstrap']
 
 

Modified: zc.buildout/branches/regebro-python3-150/dev.py
===================================================================
--- zc.buildout/branches/regebro-python3-150/dev.py	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/dev.py	2010-07-24 20:13:42 UTC (rev 115053)
@@ -21,6 +21,10 @@
 
 import os, shutil, sys, subprocess, urllib2, subprocess
 from optparse import OptionParser
+try: # py3K import hack:
+    from urllib import urlopen
+except ImportError:
+    from urllib.request import urlopen
 
 if sys.platform == 'win32':
     def quote(c):
@@ -40,10 +44,10 @@
 # particular because Python 2.6's distutils imports site, so starting
 # with the -S flag is not sufficient.  However, we'll start with that:
 if not has_broken_dash_S and 'site' in sys.modules:
-    # We will restart with python -S.
     args = sys.argv[:]
     args[0:0] = [sys.executable, '-S']
-    args = map(quote, args)
+    # py3k hack: In python 3 map returns a generator.
+    args = list(map(quote, args))
     os.execv(sys.executable, args)
 # Now we are running with -S.  We'll get the clean sys.path, import site
 # because distutils will do it later, and then reset the path and clean
@@ -83,7 +87,7 @@
 if args:
     parser.error('This script accepts no arguments other than its options.')
 
-if options.use_distribute:
+if options.use_distribute or sys.version > '3':
     setup_source = distribute_source
 else:
     setup_source = setuptools_source
@@ -102,9 +106,11 @@
         raise ImportError
     import setuptools # A flag.  Sometimes pkg_resources is installed alone.
 except ImportError:
-    ez_code = urllib2.urlopen(setup_source).read().replace('\r\n', '\n')
+    # py3k: urlopen returns bytes in Python3, encode to string:
+    ez_code = urlopen(setup_source).read().decode('latin-1').replace('\r\n', '\n')
     ez = {}
-    exec ez_code in ez
+    # Py3K compat hack:
+    exec(ez_code, ez)
     setup_args = dict(to_dir='eggs', download_delay=0)
     if options.use_distribute:
         setup_args['no_fake'] = True

Modified: zc.buildout/branches/regebro-python3-150/setup.py
===================================================================
--- zc.buildout/branches/regebro-python3-150/setup.py	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/setup.py	2010-07-24 20:13:42 UTC (rev 115053)
@@ -80,7 +80,7 @@
     packages = ['zc', 'zc.buildout'],
     package_dir = {'': 'src'},
     namespace_packages = ['zc'],
-    install_requires = 'setuptools',
+    install_requires = ['setuptools'],
     include_package_data = True,
     entry_points = entry_points,
     extras_require = dict(test=['zope.testing']),

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/__init__.py
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/__init__.py	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/__init__.py	2010-07-24 20:13:42 UTC (rev 115053)
@@ -21,4 +21,5 @@
     """
 
     def __str__(self):
-        return " ".join(map(str, self))
+        # py3 exceptions arenot iterable, use args instead:
+        return " ".join(map(str, self.args))

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/buildout.py	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/buildout.py	2010-07-24 20:13:42 UTC (rev 115053)
@@ -14,14 +14,22 @@
 """Buildout main script
 """
 
-from rmtree import rmtree
+
+from zc.buildout.rmtree import rmtree
 try:
     from hashlib import md5
 except ImportError:
     # Python 2.4 and older
     from md5 import md5
 
-import ConfigParser
+try:
+    from ConfigParser import RawConfigParser
+    from UserDict import DictMixin
+except ImportError: # py3
+    from configparser import RawConfigParser
+    from collections import MutableMapping as DictMixin
+    
+import base64
 import copy
 import distutils.errors
 import glob
@@ -33,7 +41,6 @@
 import shutil
 import sys
 import tempfile
-import UserDict
 import warnings
 import zc.buildout
 import zc.buildout.download
@@ -80,18 +87,19 @@
 def _print_annotate(data):
     sections = data.keys()
     sections.sort()
-    print
-    print "Annotated sections"
-    print "="*len("Annotated sections")
+    
+    print('')
+    print("Annotated sections")
+    print("="*len("Annotated sections"))
     for section in sections:
-        print
-        print '[%s]' % section
+        print('')
+        print('[%s]' % section)
         keys = data[section].keys()
         keys.sort()
         for key in keys:
             value, notes = data[section][key]
             keyvalue = "%s= %s" % (key, value)
-            print keyvalue
+            print(keyvalue)
             line = '   '
             for note in notes.split():
                 if note == '[+]':
@@ -99,7 +107,7 @@
                 elif note == '[-]':
                     line = '-= '
                 else:
-                    print line, note
+                    print(line + ' ' + note)
                     line = '   '
     print
 
@@ -139,7 +147,7 @@
     }, 'DEFAULT_VALUE')
 
 
-class Buildout(UserDict.DictMixin):
+class Buildout(DictMixin):
 
     def __init__(self, config_file, cloptions,
                  user_defaults=True, windows_restart=False, command=None):
@@ -157,7 +165,7 @@
             base = os.path.dirname(config_file)
             if not os.path.exists(config_file):
                 if command == 'init':
-                    print 'Creating %r.' % config_file
+                    print('Creating %r.' % config_file)
                     open(config_file, 'w').write('[buildout]\nparts = \n')
                 elif command == 'setup':
                     # Sigh. This model of a buildout instance
@@ -470,11 +478,11 @@
         if self._log_level < logging.DEBUG:
             sections = list(self)
             sections.sort()
-            print
-            print 'Configuration data:'
+            print('')
+            print('Configuration data:')
             for section in self._data:
                 _save_options(section, self[section], sys.stdout)
-            print
+            print('')
 
 
         # compute new part recipe signatures
@@ -637,7 +645,7 @@
                 recipe, 'zc.buildout.uninstall', entry, self)
             self._logger.info('Running uninstall recipe.')
             uninstaller(part, installed_part_options[part])
-        except (ImportError, pkg_resources.DistributionNotFound), v:
+        except (ImportError, pkg_resources.DistributionNotFound):
             pass
 
         # remove created files and directories
@@ -727,7 +735,7 @@
     def _read_installed_part_options(self):
         old = self['buildout']['installed']
         if old and os.path.isfile(old):
-            parser = ConfigParser.RawConfigParser()
+            parser = RawConfigParser()
             parser.optionxform = lambda s: s
             parser.read(old)
             result = {}
@@ -792,7 +800,9 @@
         f = open(installed, 'w')
         _save_options('buildout', installed_options['buildout'], f)
         for part in installed_options['buildout']['parts'].split():
-            print >>f
+            #print >>f # Won't work under py3, so:
+            f.write(os.linesep)
+            f.write('\n') # Needs to be fixed to add the right line ending
             _save_options(part, installed_options[part], f)
         f.close()
 
@@ -919,7 +929,8 @@
             include_site_packages=_sys_executable_has_broken_dash_S)
 
         # Restart
-        args = map(zc.buildout.easy_install._safe_arg, sys.argv)
+        # py3 hack: map is a generator in python 3
+        args = list(map(zc.buildout.easy_install._safe_arg, sys.argv))
         if not __debug__:
             args.insert(0, '-O')
         args.insert(0, zc.buildout.easy_install._safe_arg(sys.executable))
@@ -1048,6 +1059,9 @@
 
     def __iter__(self):
         return iter(self._raw)
+    
+    def __len__(self):
+        raise len(self._raw)
 
 
 def _install_and_load(spec, group, entry, buildout):
@@ -1081,14 +1095,16 @@
         return pkg_resources.load_entry_point(
             req.project_name, group, entry)
 
-    except Exception, v:
+    except Exception:
+        # py3 hack:
+        v = sys.exc_info()[1]
         buildout._logger.log(
             1,
             "Could't load %s entry point %s\nfrom %s:\n%s.",
             group, entry, spec, v)
         raise
 
-class Options(UserDict.DictMixin):
+class Options(DictMixin):
 
     def __init__(self, buildout, section, data):
         self.buildout = buildout
@@ -1256,12 +1272,22 @@
         elif key in self._data:
             del self._data[key]
         else:
-            raise KeyError, key
+            raise KeyError(key)
 
     def keys(self):
         raw = self._raw
         return list(self._raw) + [k for k in self._data if k not in raw]
 
+    def __iter__(self):
+        for each in self._raw:
+            yield each
+        for each in self._data:
+            if each not in self._raw:
+                yield each
+
+    def __len__(self):
+        return len(self.keys())
+
     def copy(self):
         result = self._raw.copy()
         result.update(self._cooked)
@@ -1332,12 +1358,17 @@
         value = '%(__buildout_space_n__)s' + value[2:]
     if value.endswith('\n\t'):
         value = value[:-2] + '%(__buildout_space_n__)s'
-    print >>f, option, '=', value
+    # py3: print to file has different syntax in Python 3
+    # Also, join must take an iterable, not 3 arguments
+    f.write(' '.join((option, '=', value,)))
+    f.write(os.linesep)
 
 def _save_options(section, options, f):
-    print >>f, '[%s]' % section
+    # py3: print to file has different syntax in Python 3
+    f.write('[%s]' % section)
+    f.write(os.linesep)
     items = options.items()
-    items.sort()
+    items = sorted(items)
     for option, value in items:
         _save_option(option, value, f)
 
@@ -1381,7 +1412,7 @@
 
     result = {}
 
-    parser = ConfigParser.RawConfigParser()
+    parser = RawConfigParser()
     parser.optionxform = lambda s: s
     parser.readfp(fp)
     if is_temp:
@@ -1423,24 +1454,32 @@
 ignore_directories = '.svn', 'CVS'
 def _dir_hash(dir):
     hash = md5()
+    
     for (dirpath, dirnames, filenames) in os.walk(dir):
         dirnames[:] = [n for n in dirnames if n not in ignore_directories]
         filenames[:] = [f for f in filenames
                         if (not (f.endswith('pyc') or f.endswith('pyo'))
                             and os.path.exists(os.path.join(dirpath, f)))
                         ]
-        hash.update(' '.join(dirnames))
-        hash.update(' '.join(filenames))
+        # py3 hack: Hashes can't be made from unicode, so we encode them:
+        dir_names = ' '.join(dirnames)
+        hash.update(dir_names.encode())
+        file_names = ' '.join(filenames)
+        hash.update(file_names.encode())
         for name in filenames:
-            hash.update(open(os.path.join(dirpath, name)).read())
-    return hash.digest().encode('base64').strip()
+            hash.update(open(os.path.join(dirpath, name), 'rb').read())
+    return base64.b64encode(hash.digest()).strip()
 
 def _dists_sig(dists):
     result = []
     for dist in dists:
         location = dist.location
         if dist.precedence == pkg_resources.DEVELOP_DIST:
-            result.append(dist.project_name + '-' + _dir_hash(location))
+            # py3 hack: b64encode (and therefore _dir_hash) returns binary
+            dhash = _dir_hash(location)
+            if not isinstance(dhash, str):
+                dhash = dhash.decode()
+            result.append(dist.project_name + '-' + dhash)
         else:
             result.append(os.path.basename(location))
     return result
@@ -1639,7 +1678,8 @@
 
 """
 def _help():
-    print _usage
+    # py3 hack
+    print(_usage)
     sys.exit(0)
 
 def main(args=None):
@@ -1703,7 +1743,7 @@
                         _error("No timeout value must be numeric", orig_op)
 
                     import socket
-                    print 'Setting socket time out to %d seconds' % timeout
+                    print('Setting socket time out to %d seconds' % timeout)
                     socket.setdefaulttimeout(timeout)
 
             elif op:
@@ -1752,7 +1792,8 @@
             getattr(buildout, command)(args)
         except SystemExit:
             pass
-        except Exception, v:
+        except Exception:
+            v = sys.exc_info()[1]
             _doing()
             exc_info = sys.exc_info()
             import pdb, traceback

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/buildout.txt
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/buildout.txt	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/buildout.txt	2010-07-24 20:13:42 UTC (rev 115053)
@@ -289,10 +289,11 @@
     >>> import os
     >>> os.chdir(sample_buildout)
     >>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
-    >>> print system(buildout),
+    >>> print(system(buildout).decode())
     Develop: '/sample-buildout/recipes'
     Installing data-dir.
     data-dir: Creating directory mystuff
+    <BLANKLINE>
 
 We see that the recipe created the directory, as expected:
 
@@ -314,6 +315,7 @@
     installed_develop_eggs = /sample-buildout/develop-eggs/recipes.egg-link
     parts = data-dir
     <BLANKLINE>
+    <BLANKLINE>
     [data-dir]
     __buildout_installed__ = /sample-buildout/mystuff
     __buildout_signature__ = recipes-c7vHV6ekIDUPy/7fjAaYjg==
@@ -338,11 +340,12 @@
     ... path = mydata
     ... """)
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling data-dir.
     Installing data-dir.
     data-dir: Creating directory mydata
+    <BLANKLINE>
 
     >>> ls(sample_buildout)
     -  .installed.cfg
@@ -358,11 +361,12 @@
 the part will be reinstalled:
 
     >>> rmdir(sample_buildout, 'mydata')
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling data-dir.
     Installing data-dir.
     data-dir: Creating directory mydata
+    <BLANKLINE>
 
 Error reporting
 ---------------
@@ -389,7 +393,7 @@
 
 We'll get a user error, not a traceback.
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     data-dir: Cannot create /xxx/mydata. /xxx is not a directory.
     While:
@@ -397,6 +401,7 @@
       Getting section data-dir.
       Initializing part data-dir.
     Error: Invalid Path
+    <BLANKLINE>
 
 
 Recipe Error Handling
@@ -454,7 +459,7 @@
     ... path = foo bin
     ... """)
 
-    >>> print system(buildout), # doctest: +ELLIPSIS
+    >>> print(system(buildout)) # doctest: +ELLIPSIS
     Develop: '/sample-buildout/recipes'
     Uninstalling data-dir.
     Installing data-dir.
@@ -468,6 +473,7 @@
     Traceback (most recent call last):
       ...
     OSError: [Errno 17] File exists: '/sample-buildout/bin'
+    <BLANKLINE>
 
 We meant to create a directory bins, but typed bin.  Now foo was
 left behind.
@@ -488,7 +494,7 @@
     ... path = foo bins
     ... """)
 
-    >>> print system(buildout), # doctest: +ELLIPSIS
+    >>> print(system(buildout)) # doctest: +ELLIPSIS
     Develop: '/sample-buildout/recipes'
     Installing data-dir.
     data-dir: Creating directory foo
@@ -500,6 +506,7 @@
     Traceback (most recent call last):
     ...
     OSError: [Errno 17] File exists: '/sample-buildout/foo'
+    <BLANKLINE>
 
 Now they fail because foo exists, because it was left behind.
 
@@ -564,7 +571,7 @@
 
 When we rerun the buildout:
 
-    >>> print system(buildout), # doctest: +ELLIPSIS
+    >>> print(system(buildout)) # doctest: +ELLIPSIS
     Develop: '/sample-buildout/recipes'
     Installing data-dir.
     data-dir: Creating directory foo
@@ -577,6 +584,7 @@
     Traceback (most recent call last):
     ...
     OSError: [Errno 17] File exists: '/sample-buildout/bin'
+    <BLANKLINE>
 
 .. Wait for the file to really disappear. My linux is weird.
 
@@ -645,7 +653,7 @@
 If we rerun the buildout, again, we'll get the error and no
 directories will be created:
 
-    >>> print system(buildout), # doctest: +ELLIPSIS
+    >>> print(system(buildout)) # doctest: +ELLIPSIS
     Develop: '/sample-buildout/recipes'
     Installing data-dir.
     data-dir: Creating directory foo
@@ -658,6 +666,7 @@
     Traceback (most recent call last):
     ...
     OSError: [Errno 17] File exists: '/sample-buildout/bin'
+    <BLANKLINE>
 
     >>> os.path.exists('foo')
     False
@@ -675,11 +684,12 @@
     ... path = foo bins
     ... """)
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Installing data-dir.
     data-dir: Creating directory foo
     data-dir: Creating directory bins
+    <BLANKLINE>
 
     >>> os.path.exists('foo')
     True
@@ -859,7 +869,7 @@
 Now, if we run the buildout, we'll see the options with the values
 substituted.
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling data-dir.
     Installing data-dir.
@@ -868,6 +878,7 @@
     File 1 /sample-buildout/mydata/file
     File 2 /sample-buildout/mydata/file/log
     recipe recipes:debug
+    <BLANKLINE>
 
 Note that the substitution of the data-dir path option reflects the
 update to the option performed by the mkdir recipe.
@@ -878,13 +889,14 @@
 recipe, so it assumed it could and reinstalled mydata.  If we rerun
 the buildout:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Updating data-dir.
     Updating debug.
     File 1 /sample-buildout/mydata/file
     File 2 /sample-buildout/mydata/file/log
     recipe recipes:debug
+    <BLANKLINE>
 
 We can see that mydata was not recreated.
 
@@ -917,7 +929,7 @@
     ... path = mydata
     ... """)
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling debug.
     Updating data-dir.
@@ -926,6 +938,7 @@
     File 2 /sample-buildout/mydata/file/log
     my_name debug
     recipe recipes:debug
+    <BLANKLINE>
 
 Automatic part selection and ordering
 -------------------------------------
@@ -955,7 +968,7 @@
 
 It will still be treated as a part:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling debug.
     Updating data-dir.
@@ -963,6 +976,7 @@
     File 1 /sample-buildout/mydata/file
     File 2 /sample-buildout/mydata/file/log
     recipe recipes:debug
+    <BLANKLINE>
 
     >>> cat('.installed.cfg') # doctest: +ELLIPSIS
     [buildout]
@@ -994,13 +1008,14 @@
 
 It will still be treated as a part:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Updating data-dir.
     Updating debug.
     File 1 /sample-buildout/mydata/file
     File 2 /sample-buildout/mydata/file/log
     recipe recipes:debug
+    <BLANKLINE>
 
     >>> cat('.installed.cfg') # doctest: +ELLIPSIS
     [buildout]
@@ -1043,7 +1058,7 @@
     ... path = mydata
     ... """)
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling debug.
     Uninstalling data-dir.
@@ -1053,6 +1068,7 @@
     file2 mydata/file2
     path mydata
     recipe recipes:debug
+    <BLANKLINE>
 
 In this example, the debug, with_file1 and with_file2 sections act as
 macros. In particular, the variable substitutions are performed
@@ -1260,11 +1276,12 @@
     ... op = base
     ... """)
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Installing debug.
     op buildout
     recipe recipes:debug
+    <BLANKLINE>
 
 The example is pretty trivial, but the pattern it illustrates is
 pretty common.  In a more practical example, the base buildout might
@@ -1330,7 +1347,7 @@
     ... name = base
     ... """)
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling debug.
     Installing debug.
@@ -1342,6 +1359,7 @@
     op4 b3 4
     op5 b3base 5
     recipe recipes:debug
+    <BLANKLINE>
 
 There are several things to note about this example:
 
@@ -1465,7 +1483,7 @@
     ... """)
 
     >>> os.environ['HOME'] = home
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling debug.
     Installing debug.
@@ -1478,6 +1496,7 @@
     op5 b3base 5
     op7 7
     recipe recipes:debug
+    <BLANKLINE>
 
 A buildout command-line argument, -U, can be used to suppress reading
 user defaults:
@@ -1511,12 +1530,13 @@
     ... extends = b1.cfg b2.cfg
     ... """)
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     name base
     op1 b1 1
     op2 b2 2
     op3 b2 3
     recipe recipes:debug
+    <BLANKLINE>
 
 Uninstall recipes
 -----------------
@@ -1901,7 +1921,7 @@
     ... recipe = recipes:debug
     ... """)
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling debug.
     Installing debug.
@@ -1912,6 +1932,7 @@
     d2: Creating directory d2
     Installing d3.
     d3: Creating directory d3
+    <BLANKLINE>
 
     >>> ls(sample_buildout)
     -  .installed.cfg
@@ -2056,7 +2077,7 @@
 
 Now, if we run the buildout without the install command:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling d2.
     Uninstalling d1.
@@ -2068,6 +2089,7 @@
     d2: Creating directory data2
     Updating d3.
     Updating d4.
+    <BLANKLINE>
 
 We see the output of the debug recipe and that data2 was created.  We
 also see that d1 and d2 have gone away:
@@ -2113,7 +2135,7 @@
     ...    work = os.path.join(alt, 'work'),
     ... ))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Creating directory '/sample-alt/scripts'.
     Creating directory '/sample-alt/work'.
     Creating directory '/sample-alt/basket'.
@@ -2123,6 +2145,7 @@
     Uninstalling d3.
     Uninstalling d2.
     Uninstalling debug.
+    <BLANKLINE>
 
     >>> ls(alt)
     d  basket
@@ -2149,12 +2172,13 @@
     ...    recipes=os.path.join(sample_buildout, 'recipes'),
     ...    ))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Creating directory '/sample-alt/bin'.
     Creating directory '/sample-alt/parts'.
     Creating directory '/sample-alt/eggs'.
     Creating directory '/sample-alt/develop-eggs'.
     Develop: '/sample-buildout/recipes'
+    <BLANKLINE>
 
     >>> ls(alt)
     -  .installed.cfg
@@ -2201,8 +2225,9 @@
 configuration file.  Because the verbosity is subtracted from the log
 level, we get a final log level of 20, which is the INFO level.
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     INFO Develop: '/sample-buildout/recipes'
+    <BLANKLINE>
 
 Predefined buildout options
 ---------------------------

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/debugging.txt
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/debugging.txt	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/debugging.txt	2010-07-24 20:13:42 UTC (rev 115053)
@@ -56,12 +56,13 @@
 
 If we run the buildout, we'll get an error:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Installing data-dir.
     While:
       Installing data-dir.
     Error: Missing option: data-dir:directory
+    <BLANKLINE>
 
 
 If we want to debug the error, we can add the -D option. Here's we'll

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/download.py
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/download.py	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/download.py	2010-07-24 20:13:42 UTC (rev 115053)
@@ -24,13 +24,17 @@
 import re
 import shutil
 import tempfile
-import urllib
-import urlparse
+try:
+    import urllib as urlrequest
+    from urlparse import urlparse
+except ImportError: #py3
+    import urllib.request as urlrequest
+    from urllib.parse import urlparse
 import zc.buildout
 
 
-class URLOpener(urllib.FancyURLopener):
-    http_error_default = urllib.URLopener.http_error_default
+class URLOpener(urlrequest.FancyURLopener):
+    http_error_default = urlrequest.URLopener.http_error_default
 
 
 class ChecksumError(zc.buildout.UserError):
@@ -151,7 +155,7 @@
         """
         if re.match(r"^[A-Za-z]:\\", url):
             url = 'file:' + url
-        parsed_url = urlparse.urlparse(url, 'file')
+        parsed_url = urlparse(url, 'file')
         url_scheme, _, url_path = parsed_url[:3]
         if url_scheme == 'file':
             self.logger.debug('Using local resource %s' % url)
@@ -166,11 +170,11 @@
                 "Couldn't download %r in offline mode." % url)
 
         self.logger.info('Downloading %s' % url)
-        urllib._urlopener = url_opener
+        urlrequest._urlopener = url_opener
         handle, tmp_path = tempfile.mkstemp(prefix='buildout-')
         try:
             try:
-                tmp_path, headers = urllib.urlretrieve(url, tmp_path)
+                tmp_path, headers = urlrequest.urlretrieve(url, tmp_path)
                 if not check_md5sum(tmp_path, md5sum):
                     raise ChecksumError(
                         'MD5 checksum mismatch downloading %r' % url)
@@ -195,7 +199,7 @@
         else:
             if re.match(r"^[A-Za-z]:\\", url):
                 url = 'file:' + url
-            parsed = urlparse.urlparse(url, 'file')
+            parsed = urlparse(url, 'file')
             url_path = parsed[2]
 
             if parsed[0] == 'file':

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/downloadcache.txt
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/downloadcache.txt	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/downloadcache.txt	2010-07-24 20:13:42 UTC (rev 115053)
@@ -58,7 +58,7 @@
 If we run the buildout, we'll see the eggs installed from the link
 server as usual:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     GET 200 /
     GET 200 /demo-0.2-py2.4.egg
     GET 200 /demoneeded-1.2c1.zip
@@ -68,6 +68,7 @@
     Getting distribution for 'demoneeded'.
     Got demoneeded 1.2c1.
     Generated script '/sample-buildout/bin/demo'.
+    <BLANKLINE>
 
 We'll also get the download cache populated.  The buildout doesn't put
 files in the cache directly.  It creates an intermediate directory,
@@ -88,13 +89,14 @@
     ...     if f.startswith('demo'):
     ...         remove('eggs', f)
    
-    >>> print system(buildout),
+    >>> print(system(buildout))
     GET 200 /
     Updating eggs.
     Getting distribution for 'demo==0.2'.
     Got demo 0.2.
     Getting distribution for 'demoneeded'.
     Got demoneeded 1.2c1.
+    <BLANKLINE>
 
 We see that the distributions aren't downloaded, because they're
 downloaded from the cache.
@@ -131,7 +133,7 @@
     ... eggs = demo
     ... ''' % globals())
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling eggs.
     Installing eggs.
     Getting distribution for 'demo'.
@@ -139,3 +141,4 @@
     Getting distribution for 'demoneeded'.
     Got demoneeded 1.2c1.
     Generated script '/sample-buildout/bin/demo'.
+    <BLANKLINE>

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/easy_install.py	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/easy_install.py	2010-07-24 20:13:42 UTC (rev 115053)
@@ -118,7 +118,7 @@
         cmd.extend(args)
         cmd.extend([
             "-c", "import sys, os;"
-            "print repr([os.path.normpath(p) for p in sys.path if p])"])
+            "print(repr([os.path.normpath(p) for p in sys.path if p]))"])
         # Windows needs some (as yet to be determined) part of the real env.
         env = os.environ.copy()
         # We need to make sure that PYTHONPATH, which will often be set
@@ -905,7 +905,9 @@
                 if dist is None:
                     try:
                         dist = best[req.key] = env.best_match(req, ws)
-                    except pkg_resources.VersionConflict, err:
+                    except pkg_resources.VersionConflict:
+                        #py3k hack
+                        err = sys.exc_info()[1]
                         raise VersionConflict(err, ws)
                     if dist is None or (
                         dist.location in self._site_packages and not
@@ -1137,12 +1139,13 @@
         undo.append(lambda: os.remove(tsetup))
         undo.append(lambda: os.close(fd))
 
-        os.write(fd, runsetup_template % dict(
+        template = runsetup_template % dict(
             setuptools=setuptools_loc,
             setupdir=directory,
             setup=setup,
             __file__ = setup,
-            ))
+        )
+        os.write(fd, template.encode()) #py3 hack: Convert to binary
 
         tmp3 = tempfile.mkdtemp('build', dir=dest)
         undo.append(lambda : shutil.rmtree(tmp3))
@@ -1428,7 +1431,7 @@
     if changed:
         open(script_name, 'w').write(contents)
         try:
-            os.chmod(script_name, 0755)
+            os.chmod(script_name, 493) #py3k hack: 493 == 0755
         except (AttributeError, os.error):
             pass
         logger.info("Generated %s %r.", logged_type, full_name)
@@ -1524,7 +1527,7 @@
         sys.argv[:] = _args
         __file__ = _args[0]
         del _options, _args
-        execfile(__file__)
+        exec(open(__file__).read())
 
 if _interactive:
     del _interactive
@@ -1543,7 +1546,7 @@
            "import imp; "
            "fp, path, desc = imp.find_module(%r); "
            "fp.close(); "
-           "print path" % (name,)]
+           "print(path)" % (name,)]
     env = os.environ.copy()
     # We need to make sure that PYTHONPATH, which will often be set to
     # include a custom buildout-generated site.py, is not set, or else
@@ -1558,7 +1561,8 @@
             'Could not find file for module %s:\n%s', name, stderr)
         return None
     # else: ...
-    res = stdout.strip()
+    #py3k hack, in python 3 you get binary back, so encode to string
+    res = stdout.decode().strip()
     if res.endswith('.pyc') or res.endswith('.pyo'):
         raise RuntimeError('Cannot find uncompiled version of %s' % (name,))
     if not os.path.exists(res):
@@ -1635,6 +1639,7 @@
     addsitepackages_marker = 'def addsitepackages('
     enableusersite_marker = 'ENABLE_USER_SITE = '
     successful_rewrite = False
+
     real_site_path = _get_module_file(executable, 'site')
     real_site = open(real_site_path, 'r')
     site = open(site_path, 'w')
@@ -1778,7 +1783,7 @@
 
 os.chdir(%(setupdir)r)
 sys.argv[0] = %(setup)r
-execfile(%(setup)r)
+exec(open(%(setup)r).read())
 """
 
 

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/easy_install.txt
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/easy_install.txt	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/easy_install.txt	2010-07-24 20:13:42 UTC (rev 115053)
@@ -775,7 +775,7 @@
             sys.argv[:] = _args
             __file__ = _args[0]
             del _options, _args
-            execfile(__file__)
+            exec(open(__file__).read())
     <BLANKLINE>
     if _interactive:
         del _interactive
@@ -990,7 +990,7 @@
             sys.argv[:] = _args
             __file__ = _args[0]
             del _options, _args
-            execfile(__file__)
+            exec(open(__file__).read())
     <BLANKLINE>
     if _interactive:
         del _interactive
@@ -1065,7 +1065,8 @@
 sitecustomization, so sitecustomize.py is empty.
 
     >>> cat(sitecustomize_path)
-
+    <BLANKLINE>
+    
 The interpreter script is simple.  It puts the directory with the
 site.py and sitecustomize.py on the PYTHONPATH and (re)starts Python.
 

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/repeatable.txt
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/repeatable.txt	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/repeatable.txt	2010-07-24 20:13:42 UTC (rev 115053)
@@ -82,11 +82,12 @@
 
 If we run the buildout, it will use version 2:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Getting distribution for 'spam'.
     Got spam 2.
     Installing foo.
     recipe v2
+    <BLANKLINE>
 
 We can specify a versions section that lists our recipe and name it in
 the buildout section:
@@ -112,12 +113,13 @@
 
 Now, if we run the buildout, we'll use version 1 of the spam recipe:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Getting distribution for 'spam==1'.
     Got spam 1.
     Uninstalling foo.
     Installing foo.
     recipe v1
+    <BLANKLINE>
 
 Running the buildout in verbose mode will help us get information
 about versions used. If we run the buildout in verbose mode without

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/rmtree.py
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/rmtree.py	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/rmtree.py	2010-07-24 20:13:42 UTC (rev 115053)
@@ -38,11 +38,11 @@
     Now create a file ...
 
     >>> foo = os.path.join (d, 'foo')
-    >>> open (foo, 'w').write ('huhu')
+    >>> dummy = open (foo, 'w').write ('huhu') #py3hack: write returns byte count in Python 3
 
     and make it unwriteable
 
-    >>> os.chmod (foo, 0400)
+    >>> os.chmod (foo, 256) #py3 hack: 256 = 0400
 
     rmtree should be able to remove it:
 
@@ -54,7 +54,7 @@
     0
     """
     def retry_writeable (func, path, exc):
-        os.chmod (path, 0600)
+        os.chmod (path, 384) # py3 hack: 384 = 0600
         func (path)
 
     shutil.rmtree (path, onerror = retry_writeable)

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/testing.py
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/testing.py	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/testing.py	2010-07-24 20:13:42 UTC (rev 115053)
@@ -16,7 +16,13 @@
 $Id$
 """
 
-import BaseHTTPServer
+try:
+    import BaseHTTPServer
+    from urllib2 import urlopen
+except ImportError:
+    import http.server as BaseHTTPServer
+    from urllib.request import urlopen
+ 
 import errno
 import logging
 import os
@@ -31,7 +37,6 @@
 import textwrap
 import threading
 import time
-import urllib2
 
 import zc.buildout.buildout
 import zc.buildout.easy_install
@@ -50,7 +55,8 @@
         and os.path.exists(path+'-script.py')
         ):
         path = path+'-script.py'
-    print open(path).read(),
+    out = open(path).read().strip()
+    print(out)
 
 def ls(dir, *subs):
     if subs:
@@ -58,13 +64,15 @@
     names = os.listdir(dir)
     names.sort()
     for name in names:
+        res = []
         if os.path.isdir(os.path.join(dir, name)):
-            print 'd ',
+            res.append('d ')
         elif os.path.islink(os.path.join(dir, name)):
-            print 'l ',
+            res.append('l ')
         else:
-            print '- ',
-        print name
+            res.append('- ')
+        res.append(name)
+        print(' '.join(res))
 
 def mkdir(*path):
     os.mkdir(os.path.join(*path))
@@ -121,7 +129,7 @@
             ' '.join(arg for arg in (interpreter, flags, '-c', cmd) if arg))
 
 def get(url):
-    return urllib2.urlopen(url).read()
+    return urlopen(url).read()
 
 def _runsetup(setup, executable, *args):
     if os.path.isdir(setup):
@@ -168,7 +176,7 @@
         if os.path.exists(e):
             return e
     else:
-        cmd = 'python%s -c "import sys; print sys.executable"' % version
+        cmd = 'python%s -c "import sys; print(sys.executable)"' % version
         p = subprocess.Popen(cmd,
                              shell=True,
                              stdin=subprocess.PIPE,
@@ -181,7 +189,7 @@
         o.close()
         if os.path.exists(e):
             return e
-        cmd = 'python -c "import sys; print \'%s.%s\' % sys.version_info[:2]"'
+        cmd = 'python -c "import sys; print(\'%s.%s\' % sys.version_info[:2])"'
         p = subprocess.Popen(cmd,
                              shell=True,
                              stdin=subprocess.PIPE,
@@ -193,7 +201,7 @@
         e = o.read().strip()
         o.close()
         if e == version:
-            cmd = 'python -c "import sys; print sys.executable"'
+            cmd = 'python -c "import sys; print(sys.executable)"'
             p = subprocess.Popen(cmd,
                                 shell=True,
                                 stdin=subprocess.PIPE,
@@ -491,7 +499,7 @@
 
     def log_request(self, code):
         if self.__server.__log:
-            print '%s %s %s' % (self.command, code, self.path)
+            print('%s %s %s' % (self.command, code, self.path))
 
 def _run(tree, port):
     server_address = ('localhost', port)
@@ -509,7 +517,7 @@
                 return port
         finally:
             s.close()
-    raise RuntimeError, "Can't find port"
+    raise RuntimeError("Can't find port")
 
 def _start_server(tree, name=''):
     port = get_port()
@@ -524,7 +532,7 @@
 
 def stop_server(url, thread=None):
     try:
-        urllib2.urlopen(url+'__stop__')
+        urlopen(url+'__stop__')
     except Exception:
         pass
     if thread is not None:
@@ -540,7 +548,8 @@
             s.close()
             if up:
                 break
-        except socket.error, e:
+        except socket.error:
+            e = sys.exc_info()[1]
             if e[0] not in (errno.ECONNREFUSED, errno.ECONNRESET):
                 raise
             s.close()

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/testrecipes.py
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/testrecipes.py	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/testrecipes.py	2010-07-24 20:13:42 UTC (rev 115053)
@@ -10,7 +10,7 @@
         items = self.options.items()
         items.sort()
         for option, value in items:
-            print "  %s=%r" % (option, value)
+            print("  %s=%r" % (option, value))
         return ()
 
     update = install

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/tests.py	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/tests.py	2010-07-24 20:13:42 UTC (rev 115053)
@@ -48,14 +48,14 @@
     ... parts =
     ... ''')
 
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
     Develop: '/sample-buildout/foo'
+    <BLANKLINE>
 
     >>> ls('develop-eggs')
     -  foo.egg-link
     -  z3c.recipe.scripts.egg-link
     -  zc.recipe.egg.egg-link
-
     """
 
 def develop_verbose():
@@ -76,25 +76,26 @@
     ... parts =
     ... ''')
 
-    >>> print system(join('bin', 'buildout')+' -vv'), # doctest: +ELLIPSIS
+    >>> print(system(join('bin', 'buildout')+' -vv')) # doctest: +ELLIPSIS
     Installing...
     Develop: '/sample-buildout/foo'
     ...
     Installed /sample-buildout/foo
     ...
-
+    <BLANKLINE>
+    
     >>> ls('develop-eggs')
     -  foo.egg-link
     -  z3c.recipe.scripts.egg-link
     -  zc.recipe.egg.egg-link
 
-    >>> print system(join('bin', 'buildout')+' -vvv'), # doctest: +ELLIPSIS
+    >>> print(system(join('bin', 'buildout')+' -vvv')) # doctest: +ELLIPSIS
     Installing...
     Develop: '/sample-buildout/foo'
     in: '/sample-buildout/foo'
     ... -q develop -mxN -d /sample-buildout/develop-eggs/...
+    <BLANKLINE>
 
-
     """
 
 def buildout_error_handling():
@@ -129,7 +130,7 @@
     ... z = ${buildout:x}
     ... ''')
 
-    >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')))
     ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
     While:
       Initializing.
@@ -140,6 +141,7 @@
       Getting option buildout:x.
       Getting option buildout:y.
     Error: Circular reference in substitutions.
+    <BLANKLINE>
 
 It is an error to use funny characters in variable refereces:
 
@@ -151,7 +153,7 @@
     ... x = ${bui$ldout:y}
     ... ''')
 
-    >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')))
     While:
       Initializing.
       Getting section buildout.
@@ -159,6 +161,7 @@
       Getting option buildout:x.
     Error: The section name in substitution, ${bui$ldout:y},
     has invalid characters.
+    <BLANKLINE>
 
     >>> write(sample_buildout, 'buildout.cfg',
     ... '''
@@ -168,7 +171,7 @@
     ... x = ${buildout:y{z}
     ... ''')
 
-    >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')))
     While:
       Initializing.
       Getting section buildout.
@@ -176,7 +179,8 @@
       Getting option buildout:x.
     Error: The option name in substitution, ${buildout:y{z},
     has invalid characters.
-
+    <BLANKLINE>
+    
 and too have too many or too few colons:
 
     >>> write(sample_buildout, 'buildout.cfg',
@@ -187,7 +191,7 @@
     ... x = ${parts}
     ... ''')
 
-    >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')))
     While:
       Initializing.
       Getting section buildout.
@@ -195,7 +199,8 @@
       Getting option buildout:x.
     Error: The substitution, ${parts},
     doesn't contain a colon.
-
+    <BLANKLINE>
+    
     >>> write(sample_buildout, 'buildout.cfg',
     ... '''
     ... [buildout]
@@ -204,7 +209,7 @@
     ... x = ${buildout:y:z}
     ... ''')
 
-    >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')))
     While:
       Initializing.
       Getting section buildout.
@@ -212,7 +217,8 @@
       Getting option buildout:x.
     Error: The substitution, ${buildout:y:z},
     has too many colons.
-
+    <BLANKLINE>
+    
 Al parts have to have a section:
 
     >>> write(sample_buildout, 'buildout.cfg',
@@ -221,11 +227,12 @@
     ... parts = x
     ... ''')
 
-    >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')))
     While:
       Installing.
       Getting section x.
     Error: The referenced section, 'x', was not defined.
+    <BLANKLINE>
 
 and all parts have to have a specified recipe:
 
@@ -239,10 +246,11 @@
     ... foo = 1
     ... ''')
 
-    >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')))
     While:
       Installing.
     Error: Missing option: x:recipe
+    <BLANKLINE>
 
 """
 
@@ -288,7 +296,7 @@
     ...        samplez
     ... ''' % globals())
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/sampley'
     Develop: '/sample-buildout/samplez'
     Installing eggs.
@@ -299,6 +307,7 @@
     Error: There is a version conflict.
     We already have: demoneeded 1.1
     but sampley 1 requires 'demoneeded==1.0'.
+    <BLANKLINE>
 
 Here, we see that sampley required an older version of demoneeded. What
 if we hadn't required sampley ourselves:
@@ -321,7 +330,7 @@
 
 If we use the verbose switch, we can see where requirements are coming from:
 
-    >>> print system(buildout+' -v'), # doctest: +ELLIPSIS
+    >>> print(system(buildout+' -v')) # doctest: +ELLIPSIS
     Installing 'zc.buildout', 'setuptools'.
     We have a develop egg: zc.buildout 1.0.0
     We have the best distribution that satisfies 'setuptools'.
@@ -348,6 +357,7 @@
     Error: There is a version conflict.
     We already have: demoneeded 1.1
     but sampley 1 requires 'demoneeded==1.0'.
+    <BLANKLINE>
     """
 
 def show_who_requires_missing_distributions():
@@ -372,7 +382,7 @@
     ... eggs = samplea
     ... ''')
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/sampley'
     Develop: '/sample-buildout/samplea'
     Develop: '/sample-buildout/sampleb'
@@ -383,6 +393,7 @@
       Installing eggs.
       Getting distribution for 'demoneeded'.
     Error: Couldn't find a distribution for 'demoneeded'.
+    <BLANKLINE>
     """
 
 def show_eggs_from_site_packages():
@@ -420,7 +431,7 @@
 indicate the eggs from site-packages that have been selected.  You'll see
 we have two: demo 0.3 and demoneeded 1.1.
 
-    >>> print system(buildout+" -v")
+    >>> print(system(buildout+" -v"))
     Installing 'zc.buildout', 'setuptools'.
     We have a develop egg: zc.buildout V
     We have the best distribution that satisfies 'setuptools'.
@@ -507,16 +518,20 @@
     >>> os.chdir(sample_buildout)
     >>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Installing debug.
+    <BLANKLINE>
 
+
 If we run the buildout again, we shoudn't get a message about
 uninstalling anything because the configuration hasn't changed.
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Updating debug.
+    <BLANKLINE>
+
 """
 
 def finding_eggs_as_local_directories():
@@ -578,7 +593,7 @@
     >>> write('demo', 'demo.py',
     ... '''
     ... def main():
-    ...     print 'Python 2.5'
+    ...     print('Python 2.5')
     ... ''')
 
     >>> write('buildout.cfg',
@@ -588,8 +603,9 @@
     ... parts =
     ... ''')
 
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
     Develop: '/sample-buildout/demo'
+    <BLANKLINE>
 
     >>> import zc.buildout.easy_install
     >>> ws = zc.buildout.easy_install.working_set(
@@ -598,9 +614,10 @@
     ...      ['demo'], ws, sys.executable, 'bin'))
     True
 
-    >>> print system(join('bin', 'demo')),
+    >>> print(system(join('bin', 'demo')))
     Python 2.5
-
+    <BLANKLINE>
+    
 Now, finally, let's test _get_version:
 
     >>> zc.buildout.easy_install._get_version(join('bin', 'demo'))
@@ -617,18 +634,19 @@
     ... x = ${foo:bar}
     ... ''')
 
-    >>> print system(buildout + ' foo:bar=1 -vv'), # doctest: +ELLIPSIS
+    >>> print(system(buildout + ' foo:bar=1 -vv')) # doctest: +ELLIPSIS
     Installing 'zc.buildout', 'setuptools'.
     ...
     [foo]
     bar = 1
     ...
+    <BLANKLINE>
 
     """
 
 def test_help():
     """
-    >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')+' -h'),
+    >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')+' -h'))
     ... # doctest: +ELLIPSIS
     Usage: buildout [options] [assignments] [command [command arguments]]
     <BLANKLINE>
@@ -637,8 +655,8 @@
       -h, --help
     ...
 
-    >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')
-    ...              +' --help'),
+    >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')
+    ...              +' --help'))
     ... # doctest: +ELLIPSIS
     Usage: buildout [options] [assignments] [command [command arguments]]
     <BLANKLINE>
@@ -664,13 +682,14 @@
     ... ''')
 
     >>> os.chdir(d)
-    >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')
-    ...              + ' bootstrap'),
+    >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')
+    ...              + ' bootstrap'))
     Creating directory '/sample-bootstrap/bin'.
     Creating directory '/sample-bootstrap/parts'.
     Creating directory '/sample-bootstrap/eggs'.
     Creating directory '/sample-bootstrap/develop-eggs'.
     Generated script '/sample-bootstrap/bin/buildout'.
+    <BLANKLINE>
     """
 
 
@@ -691,16 +710,18 @@
     ... ''')
 
     >>> os.chdir(d)
-    >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')
-    ...              + ' bootstrap'),
+    >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')
+    ...              + ' bootstrap'))
     Creating directory '/sample-bootstrap/bin'.
     Creating directory '/sample-bootstrap/parts'.
     Creating directory '/sample-bootstrap/eggs'.
     Creating directory '/sample-bootstrap/develop-eggs'.
     Generated script '/sample-bootstrap/bin/buildout'.
+    <BLANKLINE>
 
-    >>> print system(os.path.join('bin', 'buildout')),
+    >>> print(system(os.path.join('bin', 'buildout')))
     Unused options for buildout: 'scripts' 'eggs'.
+    <BLANKLINE>
 
     """
 
@@ -723,8 +744,9 @@
     ... parts =
     ... """)
 
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
     Develop: '/sample-buildout/foo'
+    <BLANKLINE>
 
     >>> ls('develop-eggs')
     -  foox.egg-link
@@ -746,9 +768,10 @@
     ... parts =
     ... """)
 
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
     Develop: '/sample-buildout/foo'
     Develop: '/sample-buildout/bar'
+    <BLANKLINE>
 
     >>> ls('develop-eggs')
     -  foox.egg-link
@@ -764,8 +787,9 @@
     ... develop = bar
     ... parts =
     ... """)
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
     Develop: '/sample-buildout/bar'
+    <BLANKLINE>
 
 It is gone
 
@@ -781,7 +805,8 @@
     ... [buildout]
     ... parts =
     ... """)
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
+    <BLANKLINE>
 
 All gone
 
@@ -827,8 +852,9 @@
     ... parts =
     ... """)
 
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
     Develop: '/sample-buildout/foo'
+    <BLANKLINE>
 
 Now, if we generate a working set using the egg link, we will get a warning
 and we will get setuptools included in the working set.
@@ -846,7 +872,7 @@
     ...     ])]
     ['foox', 'setuptools']
 
-    >>> print handler
+    >>> print(handler)
     zc.buildout.easy_install WARNING
       Develop distribution: foox 0.0.0
     uses namespace packages but the distribution does not require setuptools.
@@ -864,7 +890,7 @@
     -  z3c.recipe.scripts.egg-link
     -  zc.recipe.egg.egg-link
 
-    >>> print 'START ->'; ls('eggs') # doctest: +ELLIPSIS
+    >>> print('START ->'); ls('eggs') # doctest: +ELLIPSIS
     START...
     -  foox-0.0.0-py2.4.egg
     ...
@@ -879,8 +905,10 @@
     ...     ])]
     ['foox', 'setuptools']
 
-    >>> print handler,
+    >>> print(handler)
+    <BLANKLINE>
 
+
 We get the same behavior if the it is a depedency that uses a
 namespace package.
 
@@ -900,9 +928,10 @@
     ... parts =
     ... """)
 
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
     Develop: '/sample-buildout/foo'
     Develop: '/sample-buildout/bar'
+    <BLANKLINE>
 
     >>> [dist.project_name
     ...  for dist in zc.buildout.easy_install.working_set(
@@ -912,12 +941,11 @@
     ...     ])]
     ['bar', 'foox', 'setuptools']
 
-    >>> print handler,
+    >>> print(handler)
     zc.buildout.easy_install WARNING
       Develop distribution: foox 0.0.0
     uses namespace packages but the distribution does not require setuptools.
 
-
     >>> logging.getLogger('zc.buildout.easy_install').propagate = True
     >>> handler.uninstall()
 
@@ -957,7 +985,6 @@
     -  extdemo.egg-link
 
     >>> cat(extdemo, "setup.cfg")
-    <BLANKLINE>
     # sampe cfg file
     <BLANKLINE>
     [foo]
@@ -988,9 +1015,9 @@
     ... class Install:
     ...     def __init__(*args): pass
     ...     def install(self):
-    ...         print 'installing'
+    ...         print('installing')
     ...         return ()
-    ... def uninstall(name, options): print 'uninstalling'
+    ... def uninstall(name, options): print('uninstalling')
     ... ''')
 
     >>> write('buildout.cfg', '''
@@ -1001,10 +1028,11 @@
     ... recipe = recipes:demo
     ... ''')
 
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
     Develop: '/sample-buildout/recipes'
     Installing demo.
     installing
+    <BLANKLINE>
 
 
     >>> write('buildout.cfg', '''
@@ -1016,13 +1044,14 @@
     ... x = 1
     ... ''')
 
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
     Develop: '/sample-buildout/recipes'
     Uninstalling demo.
     Running uninstall recipe.
     uninstalling
     Installing demo.
     installing
+    <BLANKLINE>
 
 
     >>> write('buildout.cfg', '''
@@ -1031,11 +1060,12 @@
     ... parts =
     ... ''')
 
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
     Develop: '/sample-buildout/recipes'
     Uninstalling demo.
     Running uninstall recipe.
     uninstalling
+    <BLANKLINE>
 
 """
 
@@ -1046,7 +1076,7 @@
     >>> write('demo', 'demo.py',
     ... """
     ... def ext(buildout):
-    ...     print 'ext', list(buildout)
+    ...     print('ext' + ' ' + str(list(buildout)))
     ... """)
 
     >>> write('demo', 'setup.py',
@@ -1071,8 +1101,9 @@
     ... offline = true
     ... """)
 
-    >>> print system(join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(join(sample_buildout, 'bin', 'buildout')))
     ext ['buildout']
+    <BLANKLINE>
 
 
     '''
@@ -1109,22 +1140,25 @@
     ... ''')
 
 
-    >>> print system(join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(join(sample_buildout, 'bin', 'buildout')))
     Develop: '/sample-buildout/recipe'
     Installing foo.
+    <BLANKLINE>
 
     >>> mkdir('recipe', '.svn')
     >>> mkdir('recipe', 'CVS')
-    >>> print system(join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(join(sample_buildout, 'bin', 'buildout')))
     Develop: '/sample-buildout/recipe'
     Updating foo.
+    <BLANKLINE>
 
     >>> write('recipe', '.svn', 'x', '1')
     >>> write('recipe', 'CVS', 'x', '1')
 
-    >>> print system(join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(join(sample_buildout, 'bin', 'buildout')))
     Develop: '/sample-buildout/recipe'
     Updating foo.
+    <BLANKLINE>
 
     """
 
@@ -1161,9 +1195,10 @@
     ... ''')
 
 
-    >>> print system(join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(join(sample_buildout, 'bin', 'buildout')))
     Develop: '/sample-buildout/recipe'
     Installing foo.
+    <BLANKLINE>
 
     >>> write('recipe', 'some-file', '1')
     >>> os.symlink(join('recipe', 'some-file'),
@@ -1178,15 +1213,16 @@
 
     >>> remove('recipe', 'some-file')
 
-    >>> print system(join(sample_buildout, 'bin', 'buildout')),
+    >>> print(system(join(sample_buildout, 'bin', 'buildout')))
     Develop: '/sample-buildout/recipe'
     Updating foo.
-
+    <BLANKLINE>
+    
     """
 
 def o_option_sets_offline():
     """
-    >>> print system(join(sample_buildout, 'bin', 'buildout')+' -vvo'),
+    >>> print(system(join(sample_buildout, 'bin', 'buildout')+' -vvo'))
     ... # doctest: +ELLIPSIS
     <BLANKLINE>
     ...
@@ -1207,7 +1243,7 @@
     ... class Recipe:
     ...     def __init__(*a): pass
     ...     def install(self):
-    ...         print 'recipe v1'
+    ...         print('recipe v1')
     ...         return ()
     ...     update = install
     ... ''')
@@ -1222,7 +1258,7 @@
 
     >>> write('recipe', 'README', '')
 
-    >>> print system(buildout+' setup recipe bdist_egg'), # doctest: +ELLIPSIS
+    >>> print(system(buildout+' setup recipe bdist_egg')) # doctest: +ELLIPSIS
     Running setup script 'recipe/setup.py'.
     ...
 
@@ -1240,11 +1276,12 @@
     ... recipe = recipe
     ... ''' % join('recipe', 'dist'))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Getting distribution for 'recipe'.
     Got recipe 1.
     Installing foo.
     recipe v1
+    <BLANKLINE>
 
 Now, if we update the recipe egg:
 
@@ -1253,7 +1290,7 @@
     ... class Recipe:
     ...     def __init__(*a): pass
     ...     def install(self):
-    ...         print 'recipe v2'
+    ...         print('recipe v2')
     ...         return ()
     ...     update = install
     ... ''')
@@ -1267,30 +1304,33 @@
     ... ''')
 
 
-    >>> print system(buildout+' setup recipe bdist_egg'), # doctest: +ELLIPSIS
+    >>> print(system(buildout+' setup recipe bdist_egg')) # doctest: +ELLIPSIS
     Running setup script 'recipe/setup.py'.
     ...
 
 We won't get the update if we specify -N:
 
-    >>> print system(buildout+' -N'),
+    >>> print(system(buildout+' -N'))
     Updating foo.
     recipe v1
+    <BLANKLINE>
 
 or if we use -o:
 
-    >>> print system(buildout+' -o'),
+    >>> print(system(buildout+' -o'))
     Updating foo.
     recipe v1
+    <BLANKLINE>
 
 But we will if we use neither of these:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Getting distribution for 'recipe'.
     Got recipe 2.
     Uninstalling foo.
     Installing foo.
     recipe v2
+    <BLANKLINE>
 
 We can also select a particular recipe version:
 
@@ -1304,10 +1344,11 @@
     ... recipe = recipe ==1
     ... ''' % join('recipe', 'dist'))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling foo.
     Installing foo.
     recipe v1
+    <BLANKLINE>
 
     """
 
@@ -1353,13 +1394,15 @@
     ... recipe = recipe
     ... ''')
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipe'
     Installing foo.
+    <BLANKLINE>
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipe'
     Updating foo.
+    <BLANKLINE>
 
     >>> cat('.installed.cfg') # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
     [buildout]
@@ -1389,7 +1432,7 @@
     ...     ['demo==0.2'], dest,
     ...     links=[link_server], index=link_server+'index/')
 
-    >>> print handler # doctest: +ELLIPSIS
+    >>> print(handler) # doctest: +ELLIPSIS
     zc.buildout.easy_install DEBUG
       Installing 'demo==0.2'.
     zc.buildout.easy_install DEBUG
@@ -1435,7 +1478,7 @@
     ... recipe = recipes:mkdir
     ... ''')
 
-    >>> print system(buildout), # doctest: +ELLIPSIS
+    >>> print(system(buildout)) # doctest: +ELLIPSIS
     Develop: '/sample-buildout/recipes'
     While:
       Installing.
@@ -1447,6 +1490,7 @@
     Traceback (most recent call last):
     ...
     NameError: global name 'os' is not defined
+    <BLANKLINE>
     """
 
 def whine_about_unused_options():
@@ -1487,11 +1531,12 @@
     ... z = 1
     ... """)
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/.'
     Unused options for buildout: 'a'.
     Installing foo.
     Unused options for foo: 'z'.
+    <BLANKLINE>
     '''
 
 def abnormal_exit():
@@ -1555,22 +1600,25 @@
     ... recipe = recipes:clean
     ... ''')
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Installing p1.
     Installing p2.
     Installing p3.
+    <BLANKLINE>
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Updating p1.
     Updating p2.
     Installing p3.
+    <BLANKLINE>
 
-    >>> print system(buildout+' buildout:parts='),
+    >>> print(system(buildout+' buildout:parts='))
     Develop: '/sample-buildout/recipes'
     Uninstalling p2.
     Uninstalling p1.
+    <BLANKLINE>
 
 2. We exit while updating:
 
@@ -1593,25 +1641,28 @@
     ... recipe = recipes:clean
     ... ''')
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Installing p1.
     Installing p2.
     Installing p3.
     Installing p4.
+    <BLANKLINE>
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Updating p1.
     Updating p2.
     Updating p3.
+    <BLANKLINE>
 
-    >>> print system(buildout+' buildout:parts='),
+    >>> print(system(buildout+' buildout:parts='))
     Develop: '/sample-buildout/recipes'
     Uninstalling p2.
     Uninstalling p1.
     Uninstalling p4.
     Uninstalling p3.
+    <BLANKLINE>
 
 3. We exit while installing or updating after uninstalling:
 
@@ -1634,12 +1685,13 @@
     ... recipe = recipes:clean
     ... ''')
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Installing p1.
     Installing p2.
     Installing p3.
     Installing p4.
+    <BLANKLINE>
 
     >>> write('buildout.cfg',
     ... '''
@@ -1661,10 +1713,11 @@
     ... x = 1
     ... ''')
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling p4.
     Updating p1.
+    <BLANKLINE>
 
     >>> write('buildout.cfg',
     ... '''
@@ -1685,13 +1738,14 @@
     ... recipe = recipes:clean
     ... ''')
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling p1.
     Installing p1.
     Updating p2.
     Updating p3.
     Installing p4.
+    <BLANKLINE>
 
     """
 
@@ -1718,7 +1772,7 @@
     ...     zip_safe=False)
     ... ''')
 
-    >>> print system(buildout+' setup badegg sdist'), # doctest: +ELLIPSIS
+    >>> print(system(buildout+' setup badegg sdist')) # doctest: +ELLIPSIS
     Running setup script 'badegg/setup.py'.
     ...
 
@@ -1740,7 +1794,7 @@
     ... scripts = buildout=bo
     ... ''' % globals())
 
-    >>> print system(buildout);print 'X' # doctest: +ELLIPSIS
+    >>> print(system(buildout));print('X') # doctest: +ELLIPSIS
     Installing eggs.
     Getting distribution for 'badegg'.
     Got badegg 1.
@@ -1802,16 +1856,18 @@
     ... eggs = demo
     ... ''' % globals())
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Installing x.
     Getting distribution for 'demo'.
     Got demo 0.4c1.
     Getting distribution for 'demoneeded'.
     Got demoneeded 1.2c1.
     Generated script '/sample-buildout/bin/demo'.
+    <BLANKLINE>
 
-    >>> print system(join('bin', 'demo')),
+    >>> print(system(join('bin', 'demo')))
     4 2
+    <BLANKLINE>
 
     >>> write('buildout.cfg',
     ... '''
@@ -1824,15 +1880,17 @@
     ... eggs = demo ==0.1
     ... ''' % globals())
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling x.
     Installing x.
     Getting distribution for 'demo==0.1'.
     Got demo 0.1.
     Generated script '/sample-buildout/bin/demo'.
+    <BLANKLINE>
 
-    >>> print system(join('bin', 'demo')),
+    >>> print(system(join('bin', 'demo')))
     1 2
+    <BLANKLINE>
     """
 
 def versions_section_ignored_for_dependency_in_favor_of_site_packages():
@@ -1853,9 +1911,9 @@
 version 0.3 and demoneeded version 1.1.
 
     >>> py_path = make_py_with_system_install(make_py, sample_eggs)
-    >>> print call_py(
+    >>> print(call_py(
     ...     py_path,
-    ...     "import tellmy.version; print tellmy.version.__version__"),
+    ...     "import tellmy.version; print(tellmy.version.__version__)")),
     1.1
 
 Now here's a setup that would expose the bug, using the
@@ -1870,7 +1928,7 @@
     >>> for dist in workingset:
     ...     res = str(dist)
     ...     if res.startswith('tellmy.version'):
-    ...         print res
+    ...         print(res)
     ...         break
     tellmy.version 1.0
 
@@ -1890,9 +1948,9 @@
 tellmy.version 1.1, and tellmy.fortune 1.0.  tellmy.version 1.1 is installed.
 
     >>> py_path = make_py_with_system_install(make_py, sample_eggs)
-    >>> print call_py(
+    >>> print(call_py(
     ...     py_path,
-    ...     "import tellmy.version; print tellmy.version.__version__")
+    ...     "import tellmy.version; print(tellmy.version.__version__)"))
     1.1
     <BLANKLINE>
 
@@ -1919,12 +1977,12 @@
     ...        demo
     ... script-initialization =
     ...     import tellmy.version
-    ...     print tellmy.version.__version__
+    ...     print(tellmy.version.__version__)
     ...     import tellmy.fortune
-    ...     print tellmy.fortune.__version__
+    ...     print(tellmy.fortune.__version__)
     ... ''' % globals())
 
-    >>> print system(buildout)
+    >>> print(system(buildout))
     Installing eggs.
     Getting distribution for 'tellmy.version==1.0'.
     Got tellmy.version 1.0.
@@ -1951,16 +2009,16 @@
 we could not import tellmy.fortune at all.  The following are the correct
 results for the interpreter and for the script.
 
-    >>> print call_py(
+    >>> print(call_py(
     ...     join('bin', 'py'),
     ...     "import tellmy.version; " +
-    ...     "print tellmy.version.__version__; " +
+    ...     "print(tellmy.version.__version__); " +
     ...     "import tellmy.fortune; " +
-    ...     "print tellmy.fortune.__version__") # doctest: +ELLIPSIS
+    ...     "print(tellmy.fortune.__version__)")) # doctest: +ELLIPSIS
     1.0
     1.0...
 
-    >>> print system(join('bin', 'demo'))
+    >>> print(system(join('bin', 'demo')))
     1.0
     1.0
     4 2
@@ -2016,9 +2074,9 @@
     ...             zc.buildout.testing.sys_install(tmp, site_packages_path)
     ...     finally:
     ...         shutil.rmtree(tmp)
-    >>> print call_py(
+    >>> print(call_py(
     ...     py_path,
-    ...     "import tellmy.version; print tellmy.version.__version__")
+    ...     "import tellmy.version; print(tellmy.version.__version__)"))
     1.0
     <BLANKLINE>
     >>> write('buildout.cfg',
@@ -2056,7 +2114,7 @@
 the comment leading up to zc.buildout.easy_install._easy_install_cmd).
 Now the install works correctly, as seen here.
 
-    >>> print system(buildout)
+    >>> print(system(buildout))
     Installing eggs.
     Getting distribution for 'tellmy.version==1.1'.
     Got tellmy.version 1.1.
@@ -2346,7 +2404,7 @@
     >>> test = (
     ...     "import subprocess, sys; subprocess.call("
     ...     "[sys.executable, '-c', "
-    ...     "'import eggrecipedemo; print eggrecipedemo.x'])")
+    ...     "'import eggrecipedemo; print(eggrecipedemo.x)'])")
     >>> generated = zc.buildout.easy_install.sitepackage_safe_scripts(
     ...     interpreter_bin_dir, ws, sys.executable, interpreter_parts_dir,
     ...     reqs=['demo'], interpreter='py',
@@ -2354,13 +2412,13 @@
 
 This works for the script.
 
-    >>> print system(join(interpreter_bin_dir, 'demo'))
+    >>> print(system(join(interpreter_bin_dir, 'demo')))
     3
     <BLANKLINE>
 
 This also works for the generated interpreter.
 
-    >>> print call_py(join(interpreter_bin_dir, 'py'), test)
+    >>> print(call_py(join(interpreter_bin_dir, 'py'), test))
     3
     <BLANKLINE>
 
@@ -2383,17 +2441,18 @@
 You can also see, actually more easily than in the other example, that we
 have the desired eggs available.
 
-    >>> print system(join(interpreter_bin_dir, 'demo')), # doctest: +ELLIPSIS
+    >>> print(system(join(interpreter_bin_dir, 'demo'))) # doctest: +ELLIPSIS
     ['',
      '/interpreter/parts/interpreter',
      '/sample-buildout/foo',
      ...
      '/interpreter/eggs/demo-0.3-pyN.N.egg',
      '/interpreter/eggs/demoneeded-1.1-pyN.N.egg']
+    <BLANKLINE>
 
 This also works for the generated interpreter, with identical results.
 
-    >>> print call_py(join(interpreter_bin_dir, 'py'), test),
+    >>> print(call_py(join(interpreter_bin_dir, 'py'), test))
     ... # doctest: +ELLIPSIS
     ['',
      '/interpreter/parts/interpreter',
@@ -2401,6 +2460,7 @@
      ...
      '/interpreter/eggs/demo-0.3-pyN.N.egg',
      '/interpreter/eggs/demoneeded-1.1-pyN.N.egg']
+    <BLANKLINE>
 
     >>> # Cleanup
     >>> if original_pythonpath:
@@ -2486,7 +2546,7 @@
 
 Now, it is handled smoothly.
 
-    >>> print system(buildout)
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Getting distribution for 'demoneeded==1.2c1'.
     Got demoneeded 1.2c1.
@@ -2547,7 +2607,7 @@
 
 Now we actually run the buildout.
 
-    >>> print system(buildout)
+    >>> print(system(buildout))
     Develop: '/sample-buildout/ns'
     Develop: '/sample-buildout/recipes'
     Uninstalling dummy.
@@ -2564,8 +2624,8 @@
         ...     p = subprocess.Popen(s, stdin=subprocess.PIPE,
         ...                 stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
         ...     p.stdin.close()
-        ...     print p.stdout.read()
-        ...     print 'Exit:', bool(p.wait())
+        ...     print(p.stdout.read())
+        ...     print('Exit:' + ' ' + str(bool(p.wait())))
 
         >>> call(buildout)
         <BLANKLINE>
@@ -2636,11 +2696,11 @@
     ... import os
     ... class Bad:
     ...     def __init__(self, *_):
-    ...         print os.getcwd()
+    ...         print(os.getcwd())
     ...     def install(self):
-    ...         print os.getcwd()
+    ...         print(os.getcwd())
     ...         os.chdir('bad_start')
-    ...         print os.getcwd()
+    ...         print(os.getcwd())
     ...         return ()
     ... ''')
 
@@ -2663,8 +2723,8 @@
     ... ''')
 
     >>> os.chdir('bad_start')
-    >>> print system(join(sample_buildout, 'bin', 'buildout')
-    ...              +' -c '+join(sample_buildout, 'buildout.cfg')),
+    >>> print(system(join(sample_buildout, 'bin', 'buildout')
+    ...              +' -c '+join(sample_buildout, 'buildout.cfg')))
     Develop: '/sample-buildout/.'
     /sample-buildout
     /sample-buildout
@@ -2674,6 +2734,7 @@
     Installing b2.
     /sample-buildout
     /sample-buildout/bad_start
+    <BLANKLINE>
 
     """
 
@@ -2693,7 +2754,7 @@
 
 
     >>> for dist in ws:
-    ...     print dist
+    ...     print(dist)
     demo 0.2
     demoneeded 1.1
 
@@ -2706,13 +2767,12 @@
 def bug_75607_buildout_should_not_run_if_it_creates_an_empty_buildout_cfg():
     """
     >>> remove('buildout.cfg')
-    >>> print system(buildout),
+    >>> print(system(buildout))
     While:
       Initializing.
     Error: Couldn't open /sample-buildout/buildout.cfg
+    <BLANKLINE>
 
-
-
     """
 
 def dealing_with_extremely_insane_dependencies():
@@ -2747,7 +2807,7 @@
     ... eggs = pack0
     ... ''')
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/pack0'
     Develop: '/sample-buildout/pack1'
     Develop: '/sample-buildout/pack2'
@@ -2760,10 +2820,11 @@
       Installing pack1.
       Getting distribution for 'pack5'.
     Error: Couldn't find a distribution for 'pack5'.
+    <BLANKLINE>
 
     However, if we run in verbose mode, we can see why packages were included:
 
-    >>> print system(buildout+' -v'), # doctest: +ELLIPSIS
+    >>> print(system(buildout+' -v')) # doctest: +ELLIPSIS
     Installing 'zc.buildout', 'setuptools'.
     We have a develop egg: zc.buildout 1.0.0
     We have the best distribution that satisfies 'setuptools'.
@@ -2803,6 +2864,7 @@
       Installing pack1.
       Getting distribution for 'pack5'.
     Error: Couldn't find a distribution for 'pack5'.
+    <BLANKLINE>
     """
 
 def read_find_links_to_load_extensions():
@@ -2812,11 +2874,14 @@
     >>> src = tmpdir('src')
     >>> write(src, 'wacky_handler.py',
     ... '''
-    ... import urllib2
-    ... class Wacky(urllib2.HTTPHandler):
-    ...     wacky_open = urllib2.HTTPHandler.http_open
+    ... try:
+    ...     from urllib2 import HTTPHandler, build_opener, install_opener
+    ... except ImportError:
+    ...     from urllib.request import HTTPHandler, build_opener, install_opener
+    ... class Wacky(HTTPHandler):
+    ...     wacky_open = HTTPHandler.http_open
     ... def install(buildout=None):
-    ...     urllib2.install_opener(urllib2.build_opener(Wacky))
+    ...     install_opener(build_opener(Wacky))
     ... ''')
     >>> write(src, 'setup.py',
     ... '''
@@ -2828,7 +2893,7 @@
     ...             },
     ...       )
     ... ''')
-    >>> print system(buildout+' setup '+src+' bdist_egg'),
+    >>> print(system(buildout+' setup '+src+' bdist_egg'))
     ... # doctest: +ELLIPSIS
     Running setup ...
     creating 'dist/wackyextension-1-...
@@ -2852,12 +2917,13 @@
 When we run the buildout. it will load the extension from the dist
 directory and then use the wacky extension to load the demo package
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Getting distribution for 'wackyextension'.
     Got wackyextension 1.
     Installing demo.
     Getting distribution for 'demoneeded'.
     Got demoneeded 1.0.
+    <BLANKLINE>
 
     """
 
@@ -2874,7 +2940,7 @@
     ... setup(name='foo')
     ... ''')
 
-    >>> print system(buildout+' setup test bdist_egg'), # doctest: +ELLIPSIS
+    >>> print(system(buildout+' setup test bdist_egg')) # doctest: +ELLIPSIS
     Running setup script 'test/setup.py'.
     ...
 
@@ -2935,9 +3001,9 @@
         )
 
     if dist.extras:
-        print 'downloaded', dist.version
+        print('downloaded' + ' ' + dist.version)
     else:
-        print 'had', dist.version
+        print('had' + ' ' + dist.version)
     sys.path_importer_cache.clear()
 
 def prefer_final():
@@ -3054,12 +3120,13 @@
     ... eggs = demo
     ... ''' % globals())
 
-    >>> print system(buildout+' -v'), # doctest: +ELLIPSIS
+    >>> print(system(buildout+' -v')) # doctest: +ELLIPSIS
     Installing 'zc.buildout', 'setuptools'.
     ...
     Picked: demo = 0.4c1
     ...
     Picked: demoneeded = 1.2c1
+    <BLANKLINE>
 
 Here we see that the final versions of demo and demoneeded are used.
 We get the same behavior if we add prefer-final = false
@@ -3076,12 +3143,13 @@
     ... eggs = demo
     ... ''' % globals())
 
-    >>> print system(buildout+' -v'), # doctest: +ELLIPSIS
+    >>> print(system(buildout+' -v')) # doctest: +ELLIPSIS
     Installing 'zc.buildout', 'setuptools'.
     ...
     Picked: demo = 0.4c1
     ...
     Picked: demoneeded = 1.2c1
+    <BLANKLINE>
 
 If we specify prefer-final = true, we'll get the newest
 distributions:
@@ -3098,12 +3166,13 @@
     ... eggs = demo
     ... ''' % globals())
 
-    >>> print system(buildout+' -v'), # doctest: +ELLIPSIS
+    >>> print(system(buildout+' -v')) # doctest: +ELLIPSIS
     Installing 'zc.buildout', 'setuptools'.
     ...
     Picked: demo = 0.3
     ...
     Picked: demoneeded = 1.1
+    <BLANKLINE>
 
 We get an error if we specify anything but true or false:
 
@@ -3119,10 +3188,11 @@
     ... eggs = demo
     ... ''' % globals())
 
-    >>> print system(buildout+' -v'), # doctest: +ELLIPSIS
+    >>> print(system(buildout+' -v')) # doctest: +ELLIPSIS
     While:
       Initializing.
     Error: Invalid value for prefer-final option: no
+    <BLANKLINE>
 
     """
 
@@ -3149,8 +3219,9 @@
     ... parts =
     ... ''')
 
-    >>> print system(join('bin', 'buildout')),
+    >>> print(system(join('bin', 'buildout')))
     Develop: '/sample-buildout/foo'
+    <BLANKLINE>
 
     >>> ls('develop-eggs')
     -  foo.egg-link
@@ -3200,10 +3271,11 @@
     ...         pkg_resources.Requirement.parse('setuptools')).version,
     ...        distribute_version))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Installing foo.
     Getting distribution for 'foo==1'.
     Got foo 1.
+    <BLANKLINE>
 
     """
 
@@ -3228,13 +3300,14 @@
     >>> write('t.py',
     ... '''
     ... import eggrecipedemo, eggrecipedemoneeded
-    ... print eggrecipedemo.main.func_code.co_filename
-    ... print eggrecipedemoneeded.f.func_code.co_filename
+    ... print(eggrecipedemo.main.func_code.co_filename)
+    ... print(eggrecipedemoneeded.f.func_code.co_filename)
     ... ''')
 
-    >>> print system(join('bin', 'py')+ ' t.py'),
+    >>> print(system(join('bin', 'py')+ ' t.py'))
     /sample-buildout/eggs/demo-0.4c1-py2.4.egg/eggrecipedemo.py
     /sample-buildout/eggs/demoneeded-1.2c1-py2.4.egg/eggrecipedemoneeded.py
+    <BLANKLINE>
 
     >>> import os
     >>> for name in os.listdir('eggs'):
@@ -3255,7 +3328,8 @@
     ... eggs-directory = ${buildout:directory}/develop-eggs
     ... parts =
     ... ''' % globals())
-    >>> print system(buildout),
+    >>> print(system(buildout))
+    <BLANKLINE>
 
     """
 
@@ -3286,10 +3360,11 @@
 
     We can see that both eggs were found:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/sampley'
     Develop: '/sample-buildout/samplez'
     Installing eggs.
+    <BLANKLINE>
 
     """
 
@@ -3318,10 +3393,11 @@
     We should get one of the eggs, and a warning for the pattern that
     did not match anything.
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/samplea'
     Couldn't develop '/sample-buildout/grumble*' (not found)
     Installing eggs.
+    <BLANKLINE>
 
     """
 
@@ -3373,13 +3449,14 @@
     ... <= p1
     ... ''')
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Installing p1.
       foo='1\n2 b'
       recipe='zc.buildout:debug'
     Installing p2.
       foo='1\n2 b'
       recipe='zc.buildout:debug'
+    <BLANKLINE>
     """
 
 def increment_buildout_with_multiple_extended_files_421022():
@@ -3413,7 +3490,7 @@
     ... x = ${buildout:bar-option} ${buildout:foo-option}
     ... ''')
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Installing p.
       recipe='zc.buildout:debug'
       x='bar\nbaz foo\nham'
@@ -3421,6 +3498,7 @@
       bar-option='bar\nbaz'
       foo-option='foo\nham'
       recipe='zc.buildout:debug'
+    <BLANKLINE>
     """
 
 def increment_on_command_line():
@@ -3440,13 +3518,14 @@
     ... <= p1
     ... ''')
 
-    >>> print system(buildout+' buildout:parts+=p2 p1:foo+=bar'),
+    >>> print(system(buildout+' buildout:parts+=p2 p1:foo+=bar'))
     Installing p1.
       foo='1 a\nb\nbar'
       recipe='zc.buildout:debug'
     Installing p2.
       foo='1 a\nb\nbar'
       recipe='zc.buildout:debug'
+    <BLANKLINE>
     """
 
 ######################################################################
@@ -3513,7 +3592,7 @@
         tmp, 'eggrecipedemo.py',
         'import eggrecipedemoneeded\n'
         'x=%s\n'
-        'def main(): print x, eggrecipedemoneeded.y\n'
+        'def main(): print(str(x) + " " + str(eggrecipedemoneeded.y))\n'
         % minor_version)
     write(
         tmp, 'setup.py',
@@ -3600,7 +3679,7 @@
 from distutils.core import setup, Extension
 
 if os.environ.get('test-variable'):
-    print "Have environment test-variable:", os.environ['test-variable']
+    print("Have environment test-variable:" + " " + os.environ['test-variable'])
 
 setup(name = "extdemo", version = "%s", url="http://www.zope.org",
       author="Demo", author_email="demo at demo.com",

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/update.txt
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/update.txt	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/update.txt	2010-07-24 20:13:42 UTC (rev 115053)
@@ -63,7 +63,7 @@
 Now if we run the buildout, the buildout will upgrade itself to the
 new versions found in new releases:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Getting distribution for 'zc.buildout'.
     Got zc.buildout 99.99.
     Getting distribution for 'setuptools'.
@@ -77,6 +77,7 @@
     Installing show-versions.
     zc.buildout 99.99
     setuptools 99.99
+    <BLANKLINE>
 
 Our buildout script's site.py has been updated to use the new eggs:
 
@@ -120,7 +121,7 @@
 
 Now we can see that we actually "upgrade" to an earlier version.
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Upgraded:
       zc.buildout version 1.0.0,
       setuptools version 0.6;
@@ -129,6 +130,7 @@
     Updating show-versions.
     zc.buildout 1.0.0
     setuptools 0.6
+    <BLANKLINE>
 
 There are a number of cases, described below, in which the updates
 don't happen.
@@ -175,7 +177,7 @@
     ... """ % dict(new_releases=new_releases))
 
     >>> cd(sample_buildout2)
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Creating directory '/sample_buildout2/bin'.
     Creating directory '/sample_buildout2/parts'.
     Creating directory '/sample_buildout2/eggs'.
@@ -185,5 +187,6 @@
     Getting distribution for 'setuptools'.
     Got setuptools 99.99.
     Not upgrading because not running a local buildout command.
+    <BLANKLINE>
 
     >>> ls('bin')

Modified: zc.buildout/branches/regebro-python3-150/src/zc/buildout/windows.txt
===================================================================
--- zc.buildout/branches/regebro-python3-150/src/zc/buildout/windows.txt	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/src/zc/buildout/windows.txt	2010-07-24 20:13:42 UTC (rev 115053)
@@ -59,8 +59,9 @@
     ... recipe = spam
     ... ''' % join('recipe', 'dist'))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Getting distribution for 'spam'.
     Got spam 1.
     Installing foo.
     can't remove read only files
+    <BLANKLINE>

Modified: zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/README.txt
===================================================================
--- zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/README.txt	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/README.txt	2010-07-24 20:13:42 UTC (rev 115053)
@@ -67,12 +67,13 @@
 Let's run the buildout:
 
     >>> import os
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Installing demo.
     Getting distribution for 'demo<0.3'.
     Got demo 0.2.
     Getting distribution for 'demoneeded'.
     Got demoneeded 1.2c1.
+    <BLANKLINE>
 
 Now, if we look at the buildout eggs directory:
 
@@ -111,10 +112,11 @@
     ... index = %(server)s/index
     ... """ % dict(server=link_server))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling demo.
     Installing demo.
     Generated script '/sample-buildout/bin/demo'.
+    <BLANKLINE>
 
 Now we also see the script defined by the demo script:
 
@@ -193,11 +195,12 @@
 specification. We were able to do this because the scripts recipe is
 the default entry point for the zc.recipe.egg egg.
 
-   >>> print system(buildout),
+   >>> print(system(buildout))
    Uninstalling demo.
    Installing demo.
    Generated script '/sample-buildout/bin/demo'.
    Generated interpreter '/sample-buildout/bin/py-demo'.
+   <BLANKLINE>
 
 Now we also get a py-demo script for giving us a Python prompt with
 the path for demo and any eggs it depends on included in sys.path.
@@ -276,11 +279,12 @@
 If we run the buildout on the default online and newest modes,
 we'll get an update for demo:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Updating demo.
     Getting distribution for 'demo'.
     Got demo 0.4c1.
     Generated script '/sample-buildout/bin/demo'.
+    <BLANKLINE>
 
 Then we'll get a new demo egg:
 
@@ -316,9 +320,10 @@
     ... """ % dict(server=link_server))
 
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling demo.
     Installing demo.
+    <BLANKLINE>
 
     >>> ls(sample_buildout, 'bin')
     -  buildout
@@ -337,10 +342,11 @@
     ... scripts = demo=foo
     ... """ % dict(server=link_server))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling demo.
     Installing demo.
     Generated script '/sample-buildout/bin/foo'.
+    <BLANKLINE>
 
     >>> ls(sample_buildout, 'bin')
     -  buildout
@@ -367,10 +373,11 @@
     ...    ${buildout:directory}/spam
     ... """ % dict(server=link_server))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling demo.
     Installing demo.
     Generated script '/sample-buildout/bin/foo'.
+    <BLANKLINE>
 
 Let's look at the script that was generated:
 
@@ -414,10 +421,11 @@
     ...    ${buildout:directory}/spam
     ... """ % dict(server=link_server))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling demo.
     Installing demo.
     Generated script '/sample-buildout/bin/foo'.
+    <BLANKLINE>
 
 Let's look at the script that was generated:
 
@@ -463,10 +471,11 @@
     ...    ${buildout:directory}/spam
     ... """ % dict(server=link_server))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling demo.
     Installing demo.
     Generated script '/sample-buildout/bin/foo'.
+    <BLANKLINE>
 
     >>> cat(sample_buildout, 'bin', 'foo') # doctest: +NORMALIZE_WHITESPACE
     #!/usr/local/bin/python2.4
@@ -516,10 +525,11 @@
     ... arguments = a, 2
     ... """ % dict(server=link_server))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling demo.
     Installing demo.
     Generated script '/sample-buildout/bin/foo'.
+    <BLANKLINE>
 
     >>> cat(sample_buildout, 'bin', 'foo') # doctest: +NORMALIZE_WHITESPACE
     #!/usr/local/bin/python2.4
@@ -566,12 +576,13 @@
     ... entry-points = alt=eggrecipedemo:alt other=foo.bar:a.b.c
     ... """ % dict(server=link_server))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling demo.
     Installing demo.
     Generated script '/sample-buildout/bin/demo'.
     Generated script '/sample-buildout/bin/alt'.
     Generated script '/sample-buildout/bin/other'.
+    <BLANKLINE>
 
     >>> ls(sample_buildout, 'bin')
     -  alt
@@ -638,8 +649,9 @@
     ... scripts = demo=foo
     ... """ % dict(server=link_server))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Uninstalling bigdemo.
     Installing demo.
     Generated script '/sample-buildout/bin/foo'.
+    <BLANKLINE>
 

Modified: zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/custom.txt
===================================================================
--- zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/custom.txt	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/custom.txt	2010-07-24 20:13:42 UTC (rev 115053)
@@ -137,9 +137,10 @@
     ...
     ... """ % dict(server=link_server))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Installing extdemo.
     zip_safe flag not set; analyzing archive contents...
+    <BLANKLINE>
 
 We got the zip_safe warning because the source distribution we used
 wasn't setuptools based and thus didn't set the option.
@@ -194,11 +195,12 @@
     ... entry-points = demo=demo:main
     ... """ % dict(server=link_server))
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/demo'
     Updating extdemo.
     Installing demo.
     Generated script '/sample-buildout/bin/demo'.
+    <BLANKLINE>
 
 When we run the script, we'll 42 printed:
 
@@ -239,12 +241,13 @@
 will. This time we also get the test-variable message again, because the new
 version is imported:
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/demo'
     Updating extdemo.
     zip_safe flag not set; analyzing archive contents...
     Updating demo.
     Generated script '/sample-buildout/bin/demo'.
+    <BLANKLINE>
 
     >>> ls(sample_buildout, 'develop-eggs')
     -  demo.egg-link
@@ -355,7 +358,7 @@
     ... recipe = recipes:environ
     ...
     ... """ % dict(server=link_server))
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling demo.
     Uninstalling extdemo.
@@ -364,6 +367,7 @@
     zip_safe flag not set; analyzing archive contents...
     Installing checkenv.
     checkenv: test-variable left over: False
+    <BLANKLINE>
 
 
 The setup.py also printed out that we have set the environment `test-variable`
@@ -375,11 +379,12 @@
 
     >>> import os
     >>> os.environ['test-variable'] = 'bar'
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Updating extdemo.
     Updating checkenv.
     checkenv: test-variable left over: True
+    <BLANKLINE>
 
     >>> os.environ['test-variable']
     'bar'
@@ -409,7 +414,7 @@
     ... recipe = recipes:environ
     ...
     ... """ % dict(server=link_server))
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling extdemo.
     Installing extdemo.
@@ -417,6 +422,7 @@
     zip_safe flag not set; analyzing archive contents...
     Updating checkenv.
     checkenv: test-variable left over: True
+    <BLANKLINE>
 
     >>> os.environ['test-variable']
     'bar'
@@ -438,12 +444,13 @@
     ... include-dirs = include
     ...
     ... """ % dict(server=link_server))
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/recipes'
     Uninstalling checkenv.
     Uninstalling extdemo.
     Installing extdemo.
     zip_safe flag not set; analyzing archive contents...
+    <BLANKLINE>
 
     >>> rmdir(sample_buildout, 'recipes')
 
@@ -545,12 +552,13 @@
 TWO to be defined.  This will cause the module-variable, 'val', to be
 set with a value of 2.
 
-    >>> print system(buildout),
+    >>> print(system(buildout))
     Develop: '/sample-buildout/demo'
     Uninstalling extdemo.
     Installing extdemo.
     Installing demo.
     Generated script '/sample-buildout/bin/demo'.
+    <BLANKLINE>
 
 Our develop-eggs now includes an egg link for extdemo:
 

Modified: zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt
===================================================================
--- zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt	2010-07-24 19:53:02 UTC (rev 115052)
+++ zc.buildout/branches/regebro-python3-150/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt	2010-07-24 20:13:42 UTC (rev 115053)
@@ -50,7 +50,7 @@
    >>> import os
    >>> os.chdir(sample_buildout)
    >>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
-   >>> print system(buildout),
+   >>> print(system(buildout))
    Installing demo.
    Getting distribution for 'demo<0.3'.
    Got demo 0.2.
@@ -58,7 +58,8 @@
    Got demoneeded 1.2c1.
    Generated script '/sample-buildout/bin/demo'.
    Generated interpreter '/sample-buildout/bin/py-demo'.
-
+   <BLANKLINE>
+    
 we'll get the Python 2.4 eggs for demo and demoneeded:
 
     >>> ls(sample_buildout, 'eggs')
@@ -131,7 +132,7 @@
             sys.argv[:] = _args
             __file__ = _args[0]
             del _options, _args
-            execfile(__file__)
+            exec(open(__file__).read())
     <BLANKLINE>
     if _interactive:
         del _interactive



More information about the checkins mailing list