Commit 83d53da5 authored by Jim Fulton's avatar Jim Fulton

checkout: core tests passing w python 3.2

parent 493394b7
......@@ -18,7 +18,7 @@ The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
"""
import os, shutil, sys, tempfile, urllib2
import os, shutil, sys, tempfile, urllib.request, urllib.error, urllib.parse
from optparse import OptionParser
tmpeggs = tempfile.mkdtemp()
......@@ -80,9 +80,9 @@ try:
raise ImportError
except ImportError:
ez = {}
exec urllib2.urlopen(
exec(urllib.request.urlopen(
'http://python-distribute.org/distribute_setup.py'
).read() in ez
).read(), ez)
setup_args = dict(to_dir=tmpeggs, download_delay=0, no_fake=True)
ez['use_setuptools'](**setup_args)
......
......@@ -9,7 +9,7 @@ eggs = zc.buildout
interpreter = py
[test]
recipe = zc.recipe.testrunner
recipe = zc.recipe.testrunner ==1.3.0
eggs =
zc.buildout[test]
zc.recipe.egg
......
......@@ -17,7 +17,7 @@ This is different from a normal boostrapping process because the
buildout egg itself is installed as a develop egg.
"""
import os, shutil, sys, subprocess, urllib2
import os, shutil, sys, subprocess, urllib.request, urllib.error, urllib.parse
for d in 'eggs', 'develop-eggs', 'bin', 'parts':
if not os.path.exists(d):
......@@ -57,8 +57,8 @@ else:
######################################################################
# Install distribute
ez = {}
exec urllib2.urlopen(
'http://python-distribute.org/distribute_setup.py').read() in ez
exec(urllib.request.urlopen(
'http://python-distribute.org/distribute_setup.py').read(), ez)
ez['use_setuptools'](to_dir='eggs', download_delay=0)
import pkg_resources
......
......@@ -19,4 +19,4 @@ class UserError(Exception):
"""
def __str__(self):
return " ".join(map(str, self))
return " ".join(map(str, self.args))
......@@ -55,7 +55,7 @@ local files::
Now we can run the buildout and make sure all attempts to dist.plone.org fails::
>>> print system(buildout)
>>> print_(system(buildout))
Develop: '/sample-buildout/allowdemo'
Installing eggs.
<BLANKLINE>
......@@ -91,7 +91,7 @@ XXX (showcase with a svn:// file)
Now we can run the buildout and make sure all attempts to dist.plone.org fails::
>>> print system(buildout)
>>> print_(system(buildout))
Develop: '/sample-buildout/allowdemo'
Installing eggs.
<BLANKLINE>
......@@ -121,7 +121,7 @@ Test for 1.0.5 breakage as in https://bugs.launchpad.net/zc.buildout/+bug/239212
... eggs=zc.buildout
... interpreter=python
... ''')
>>> print 'XX'; print system(buildout) # doctest: +ELLIPSIS
>>> print_('XX'; print system(buildout)) # doctest: +ELLIPSIS
X...
Unused options for buildout: 'foo'.
Installing python.
......
......@@ -20,9 +20,9 @@ Make sure the bootstrap script actually works::
... parts =
... ''')
>>> write('bootstrap.py', open(bootstrap_py).read())
>>> print 'X'; print system(
>>> print_('X'; print system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py'); print 'X' # doctest: +ELLIPSIS
... 'bootstrap.py')); print_('X') # doctest: +ELLIPSIS
X...
Creating directory '/sample/bin'.
Creating directory '/sample/parts'.
......@@ -43,7 +43,7 @@ Make sure the bootstrap script actually works::
>>> ls(sample_buildout, 'bin')
- buildout
>>> print 'X'; ls(sample_buildout, 'eggs') # doctest: +ELLIPSIS
>>> print_('X'); ls(sample_buildout, 'eggs') # doctest: +ELLIPSIS
X...
d zc.buildout-...egg
......@@ -52,9 +52,9 @@ Now trying the `--version` option, that let you define a version for
Let's try with an unknown version::
>>> print 'X'; print system(
>>> print_('X'); print_(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py --version UNKNOWN'); print 'X' # doctest: +ELLIPSIS
... 'bootstrap.py --version UNKNOWN')); print_('X') # doctest: +ELLIPSIS
...
X
...
......@@ -63,9 +63,9 @@ Let's try with an unknown version::
Now let's try with `1.1.2`, which happens to exist::
>>> print 'X'; print system(
>>> print_('X'); print_(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py --version 1.1.2'); print 'X'
... 'bootstrap.py --version 1.1.2')); print_('X')
... # doctest: +ELLIPSIS
X
...
......@@ -78,7 +78,7 @@ Let's make sure the generated `buildout` script uses it::
>>> buildout_script = join(sample_buildout, 'bin', 'buildout')
>>> if sys.platform.startswith('win'):
... buildout_script += '-script.py'
>>> print open(buildout_script).read() # doctest: +ELLIPSIS
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
<BLANKLINE>
import sys
......@@ -95,9 +95,9 @@ Let's make sure the generated `buildout` script uses it::
Let's try with `1.2.1`::
>>> print 'X'; print system(
>>> print_('X'); print_(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py --version 1.2.1'); print 'X' # doctest: +ELLIPSIS
... 'bootstrap.py --version 1.2.1')); print_('X') # doctest: +ELLIPSIS
...
X
...
......@@ -107,7 +107,7 @@ Let's try with `1.2.1`::
Let's make sure the generated `buildout` script uses it::
>>> print open(buildout_script).read() # doctest: +ELLIPSIS
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
<BLANKLINE>
import sys
......
This diff is collapsed.
This diff is collapsed.
##############################################################################
#
# Copyright Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
# The following copied from Python 2 config parser because:
# - The py3 configparser isn't backward compatible
# - Both strip option values in undesireable ways
# - dict of dicts is a much simpler api
import re
class Error(Exception):
"""Base class for ConfigParser exceptions."""
def _get_message(self):
"""Getter for 'message'; needed only to override deprecation in
BaseException."""
return self.__message
def _set_message(self, value):
"""Setter for 'message'; needed only to override deprecation in
BaseException."""
self.__message = value
# BaseException.message has been deprecated since Python 2.6. To prevent
# DeprecationWarning from popping up over this pre-existing attribute, use
# a new property that takes lookup precedence.
message = property(_get_message, _set_message)
def __init__(self, msg=''):
self.message = msg
Exception.__init__(self, msg)
def __repr__(self):
return self.message
class ParsingError(Error):
"""Raised when a configuration file does not follow legal syntax."""
def __init__(self, filename):
Error.__init__(self, 'File contains parsing errors: %s' % filename)
self.filename = filename
self.errors = []
def append(self, lineno, line):
self.errors.append((lineno, line))
self.message += '\n\t[line %2d]: %s' % (lineno, line)
class MissingSectionHeaderError(ParsingError):
"""Raised when a key-value pair is found before any section header."""
def __init__(self, filename, lineno, line):
Error.__init__(
self,
'File contains no section headers.\nfile: %s, line: %d\n%r' %
(filename, lineno, line))
self.filename = filename
self.lineno = lineno
self.line = line
SECTCRE = re.compile(
r'\[' # [
r'(?P<header>[^]]+)' # very permissive!
r'\]' # ]
)
OPTCRE = re.compile(
r'(?P<option>[^:=\s][^:=]*)' # very permissive!
r'\s*(?P<vi>[:=])\s*' # any number of space/tab,
# followed by separator
# (either : or =), followed
# by any # space/tab
r'(?P<value>.*)$' # everything up to eol
)
def parse(fp, fpname):
"""Parse a sectioned setup file.
The sections in setup file contains a title line at the top,
indicated by a name in square brackets (`[]'), plus key/value
options lines, indicated by `name: value' format lines.
Continuations are represented by an embedded newline then
leading whitespace. Blank lines, lines beginning with a '#',
and just about everything else are ignored.
"""
_sections = {}
cursect = None # None, or a dictionary
optname = None
lineno = 0
e = None # None, or an exception
while True:
line = fp.readline()
if not line:
break
lineno = lineno + 1
# comment or blank line?
if line.strip() == '' or line[0] in '#;':
continue
if line.split(None, 1)[0].lower() == 'rem' and line[0] in "rR":
# no leading whitespace
continue
# continuation line?
if line[0].isspace() and cursect is not None and optname:
value = line.strip()
if value:
cursect[optname] = "%s\n%s" % (cursect[optname], value)
# a section header or option header?
else:
# is it a section header?
mo = SECTCRE.match(line)
if mo:
sectname = mo.group('header')
if sectname in _sections:
cursect = _sections[sectname]
else:
cursect = {}
_sections[sectname] = cursect
# So sections can't start with a continuation line
optname = None
# no section header in the file?
elif cursect is None:
raise MissingSectionHeaderError(fpname, lineno, line)
# an option line?
else:
mo = OPTCRE.match(line)
if mo:
optname, vi, optval = mo.group('option', 'vi', 'value')
# This check is fine because the OPTCRE cannot
# match if it would set optval to None
if optval is not None:
if vi in ('=', ':') and ';' in optval:
# ';' is a comment delimiter only if it follows
# a spacing character
pos = optval.find(';')
if pos != -1 and optval[pos-1].isspace():
optval = optval[:pos]
optval = optval.strip()
# allow empty values
if optval == '""':
optval = ''
optname = optname.rstrip()
cursect[optname] = optval
else:
# a non-fatal parsing error occurred. set up the
# exception but keep going. the exception will be
# raised at the end of the file and will contain a
# list of all bogus lines
if not e:
e = ParsingError(fpname)
e.append(lineno, repr(line))
# if any parsing errors occurred, raise an exception
if e:
raise e
return _sections
......@@ -56,7 +56,7 @@ And create a buildout that uses it:
If we run the buildout, we'll get an error:
>>> print system(buildout),
>>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes'
Installing data-dir.
While:
......@@ -67,11 +67,11 @@ If we run the buildout, we'll get an error:
If we want to debug the error, we can add the -D option. Here's we'll
supply some input:
>>> print system(buildout+" -D", """\
>>> print_(system(buildout+" -D", """\
... up
... p self.options.keys()
... q
... """),
... """), end='')
Develop: '/sample-buildout/recipes'
Installing data-dir.
> /zc/buildout/buildout.py(925)__getitem__()
......
......@@ -54,14 +54,13 @@ Now let's configure the buildout to use the develop egg.
Now we can run the buildout.
>>> print system(buildout)
>>> print_(system(buildout), end='')
GET 200 /
GET 200 /demoneeded-1.2c1.zip
Develop: '/sample-buildout/depdemo'
Installing eggs.
Getting distribution for 'demoneeded'.
Got demoneeded 1.2c1.
<BLANKLINE>
Notice that the egg was retrieved from the logging server.
......@@ -83,7 +82,7 @@ buildout to see where the egg comes from this time.
... for egg in glob(join(sample_buildout, 'eggs', 'demoneeded*.egg')):
... remove(sample_buildout, 'eggs', egg)
>>> remove_demoneeded_egg()
>>> print system(buildout)
>>> print_(system(buildout), end='')
Develop: '/sample-buildout/depdemo'
Updating eggs.
Couldn't find index page for 'demoneeded' (maybe misspelled?)
......@@ -92,7 +91,6 @@ buildout to see where the egg comes from this time.
Updating eggs.
Getting distribution for 'demoneeded'.
Error: Couldn't find a distribution for 'demoneeded'.
<BLANKLINE>
Now it can't find the dependency since neither the buildout
configuration nor setup specifies where to look.
......@@ -112,12 +110,11 @@ to look for eggs.
... eggs = depdemo
... ''' % link_server)
>>> print system(buildout)
>>> print_(system(buildout), end='')
Develop: '/sample-buildout/depdemo'
Installing eggs.
Getting distribution for 'demoneeded'.
Got demoneeded 1.2c1.
<BLANKLINE>
This time the dependency egg was found on the server without logging
configured.
......@@ -134,13 +131,12 @@ specify different places to look for the dependency egg.
... ''' % link_server2)
>>> remove_demoneeded_egg()
>>> print system(buildout) #doctest: +ELLIPSIS
>>> print_(system(buildout), end='') #doctest: +ELLIPSIS
GET 200 /...
Develop: '/sample-buildout/depdemo'
Updating eggs.
Getting distribution for 'demoneeded'.
Got demoneeded 1.2c1.
<BLANKLINE>
So when both setuptools and buildout specify places to search for
eggs, the dependency_links takes precedence over find-links.
......@@ -166,12 +162,11 @@ Here is an example of using this option to disable dependency_links.
... ''' % link_server)
>>> remove_demoneeded_egg()
>>> print system(buildout)
>>> print_(system(buildout), end='')
Develop: '/sample-buildout/depdemo'
Updating eggs.
Getting distribution for 'demoneeded'.
Got demoneeded 1.2c1.
<BLANKLINE>
Notice that this time the egg isn't downloaded from the logging server.
......@@ -191,10 +186,9 @@ before. The dependency's are looked for first in the logging server.
... eggs = depdemo
... ''' % link_server)
>>> remove_demoneeded_egg()
>>> print system(buildout) #doctest: +ELLIPSIS
>>> print_(system(buildout), end='') #doctest: +ELLIPSIS
GET 200 /...
Develop: '/sample-buildout/depdemo'
Updating eggs.
Getting distribution for 'demoneeded'.
Got demoneeded 1.2c1.
<BLANKLINE>
......@@ -24,13 +24,13 @@ import os.path
import re
import shutil
import tempfile
import urllib
import urlparse
import urllib.request, urllib.parse, urllib.error
import urllib.parse
import zc.buildout
class URLOpener(urllib.FancyURLopener):
http_error_default = urllib.URLopener.http_error_default
class URLOpener(urllib.request.FancyURLopener):
http_error_default = urllib.request.URLopener.http_error_default
class ChecksumError(zc.buildout.UserError):
......@@ -157,7 +157,7 @@ class Download(object):
if re.match(r"^[A-Za-z]:\\", url):
url = 'file:' + url
parsed_url = urlparse.urlparse(url, 'file')
parsed_url = urllib.parse.urlparse(url, 'file')
url_scheme, _, url_path = parsed_url[:3]
if url_scheme == 'file':
self.logger.debug('Using local resource %s' % url)
......@@ -172,18 +172,19 @@ class Download(object):
"Couldn't download %r in offline mode." % url)
self.logger.info('Downloading %s' % url)
urllib._urlopener = url_opener
urllib.request._urlopener = url_opener
handle, tmp_path = tempfile.mkstemp(prefix='buildout-')
try:
tmp_path, headers = urllib.urlretrieve(url, tmp_path)
tmp_path, headers = urllib.request.urlretrieve(url, tmp_path)
if not check_md5sum(tmp_path, md5sum):
raise ChecksumError(
'MD5 checksum mismatch downloading %r' % url)
except IOError, e:
except IOError:
e = sys.exc_info()[1]
os.remove(tmp_path)
raise zc.buildout.UserError("Error downloading extends for URL "
"%s: %r" % (url, e[1:3]))
except Exception, e:
except Exception:
os.remove(tmp_path)
raise
finally:
......@@ -204,7 +205,7 @@ class Download(object):
else:
if re.match(r"^[A-Za-z]:\\", url):
url = 'file:' + url
parsed = urlparse.urlparse(url, 'file')
parsed = urllib.parse.urlparse(url, 'file')
url_path = parsed[2]
if parsed[0] == 'file':
......
......@@ -28,7 +28,7 @@ without any arguments:
>>> from zc.buildout.download import Download
>>> download = Download()
>>> print download.cache_dir
>>> print_(download.cache_dir)
None
Downloading a file is achieved by calling the utility with the URL as an
......@@ -37,7 +37,7 @@ of the file and a boolean value indicating whether this is a temporary file
meant to be cleaned up during the same buildout run:
>>> path, is_temp = download(server_url+'foo.txt')
>>> print path
>>> print_(path)
/.../buildout-...
>>> cat(path)
This is a foo text.
......@@ -59,8 +59,8 @@ We are responsible for cleaning up temporary files behind us:
When trying to access a file that doesn't exist, we'll get an exception:
>>> try: download(server_url+'not-there') # doctest: +ELLIPSIS
... except: print 'download error'
... else: print 'woops'
... except: print_('download error')
... else: print_('woops')
download error
Downloading a local file doesn't produce a temporary file but simply returns
......@@ -102,7 +102,7 @@ Finally, we can download the file to a specified place in the file system:
>>> target_dir = tmpdir('download-target')
>>> path, is_temp = download(server_url+'foo.txt',
... path=join(target_dir, 'downloaded.txt'))
>>> print path
>>> print_(path)
/download-target/downloaded.txt
>>> cat(path)
This is a foo text.
......@@ -136,7 +136,7 @@ attribute upon instantiation:
>>> cache = tmpdir('download-cache')
>>> download = Download(cache=cache)
>>> print download.cache_dir
>>> print_(download.cache_dir)
/download-cache/
Simple usage
......@@ -148,7 +148,7 @@ to the cached copy:
>>> ls(cache)
>>> path, is_temp = download(server_url+'foo.txt')
>>> print path
>>> print_(path)
/download-cache/foo.txt
>>> cat(path)
This is a foo text.
......@@ -160,7 +160,7 @@ the file on the server to see this:
>>> write(server_data, 'foo.txt', 'The wrong text.')
>>> path, is_temp = download(server_url+'foo.txt')
>>> print path
>>> print_(path)
/download-cache/foo.txt
>>> cat(path)
This is a foo text.
......@@ -179,7 +179,7 @@ will result in the cached copy being used:
>>> mkdir(server_data, 'other')
>>> write(server_data, 'other', 'foo.txt', 'The wrong text.')
>>> path, is_temp = download(server_url+'other/foo.txt')
>>> print path
>>> print_(path)
/download-cache/foo.txt
>>> cat(path)
This is a foo text.
......@@ -194,7 +194,7 @@ cached copy:
>>> path, is_temp = download(server_url+'foo.txt',
... path=join(target_dir, 'downloaded.txt'))
>>> print path
>>> print_(path)
/download-target/downloaded.txt
>>> cat(path)
This is a foo text.
......@@ -208,7 +208,7 @@ False
>>> path, is_temp = download(server_url+'foo.txt',
... path=join(target_dir, 'downloaded.txt'))
>>> print path
>>> print_(path)
/download-target/downloaded.txt
>>> cat(path)
This is a foo text.
......@@ -281,7 +281,7 @@ namespaces to use, so the download utility stored files directly inside the
download cache. Let's use a namespace "test" instead:
>>> download = Download(cache=cache, namespace='test')
>>> print download.cache_dir
>>> print_(download.cache_dir)
/download-cache/test
The namespace sub-directory hasn't been created yet:
......@@ -292,7 +292,7 @@ Downloading a file now creates the namespace sub-directory and places a copy
of the file inside it:
>>> path, is_temp = download(server_url+'foo.txt')
>>> print path
>>> print_(path)
/download-cache/test/foo.txt
>>> ls(cache)
d test
......@@ -311,7 +311,7 @@ different content both on the server and in the cache's root directory:
>>> write(cache, 'foo.txt', 'The wrong text.')
>>> path, is_temp = download(server_url+'foo.txt')
>>> print path
>>> print_(path)
/download-cache/test/foo.txt
>>> cat(path)
This is a foo text.
......@@ -332,7 +332,7 @@ be used as the filename in the cache:
>>> download = Download(cache=cache, hash_name=True)
>>> path, is_temp = download(server_url+'foo.txt')
>>> print path
>>> print_(path)
/download-cache/09f5793fcdc1716727f72d49519c688d
>>> cat(path)
This is a foo text.
......@@ -362,7 +362,7 @@ file the same, the file will be downloaded again this time and put in the
cache under a different name:
>>> path2, is_temp = download(server_url+'other/foo.txt')
>>> print path2
>>> print_(path2)
/download-cache/537b6d73267f8f4447586989af8c470e
>>> path == path2
False
......@@ -390,7 +390,7 @@ down or if we are in offline mode. This mode is only in effect if a download
cache is configured in the first place:
>>> download = Download(cache=cache, fallback=True)
>>> print download.cache_dir
>>> print_(download.cache_dir)
/download-cache/
A downloaded file will be cached:
......@@ -408,8 +408,8 @@ If the file cannot be served, the cached copy will be used:
>>> remove(server_data, 'foo.txt')
>>> try: Download()(server_url+'foo.txt') # doctest: +ELLIPSIS
... except: print 'download error'
... else: print 'woops'
... except: print_('download error')
... else: print_('woops')
download error
>>> path, is_temp = download(server_url+'foo.txt')
>>> cat(path)
......@@ -426,7 +426,7 @@ using the cache:
>>> offline_download = Download(cache=cache, offline=True, fallback=True)
>>> path, is_temp = offline_download(server_url+'foo.txt')
>>> print path
>>> print_(path)
/download-cache/foo.txt
>>> cat(path)
This is a foo text.
......@@ -466,7 +466,7 @@ The location of the download cache is specified by the ``download-cache``
option:
>>> download = Download({'download-cache': cache}, namespace='cmmi')
>>> print download.cache_dir
>>> print_(download.cache_dir)
/download-cache/cmmi
If the ``download-cache`` option specifies a relative path, it is understood
......@@ -474,18 +474,18 @@ relative to the current working directory, or to the buildout directory if
that is given:
>>> download = Download({'download-cache': 'relative-cache'})
>>> print download.cache_dir
>>> print_(download.cache_dir)
/sample-buildout/relative-cache/
>>> download = Download({'directory': join(sample_buildout, 'root'),
... 'download-cache': 'relative-cache'})
>>> print download.cache_dir
>>> print_(download.cache_dir)
/sample-buildout/root/relative-cache/
Keyword parameters take precedence over the corresponding options:
>>> download = Download({'download-cache': cache}, cache=None)
>>> print download.cache_dir
>>> print_(download.cache_dir)
None
Whether to assume offline mode can be inferred from either the ``offline`` or
......
......@@ -31,7 +31,7 @@ And set up a buildout that downloads some eggs:
We specified a link server that has some distributions available for
download:
>>> print get(link_server),
>>> print_(get(link_server), end='')
<html><body>
<a href="bigdemo-0.1-py2.4.egg">bigdemo-0.1-py2.4.egg</a><br>
<a href="demo-0.1-py2.4.egg">demo-0.1-py2.4.egg</a><br>
......@@ -59,7 +59,7 @@ We also specified a download cache.
If we run the buildout, we'll see the eggs installed from the link
server as usual:
>>> print system(buildout),
>>> print_(system(buildout), end='')
GET 200 /
GET 200 /demo-0.2-py2.4.egg
GET 200 /demoneeded-1.2c1.zip
......@@ -89,7 +89,7 @@ If we remove the installed eggs from eggs directory and re-run the buildout:
... if f.startswith('demo'):
... remove('eggs', f)
>>> print system(buildout),
>>> print_(system(buildout), end='')
GET 200 /
Updating eggs.
Getting distribution for 'demo==0.2'.
......@@ -132,7 +132,7 @@ install-from-cache option set to true:
... eggs = demo
... ''' % globals())
>>> print system(buildout),
>>> print_(system(buildout), end='')
Uninstalling eggs.
Installing eggs.
Getting distribution for 'demo'.
......
......@@ -611,8 +611,9 @@ class Installer:
while 1:
try:
ws.resolve(requirements)
except pkg_resources.DistributionNotFound, err:
[requirement] = err
except pkg_resources.DistributionNotFound:
err = sys.exc_info()[1]
[requirement] = err.args
requirement = self._constrain(requirement)
if dest:
logger.debug('Getting required %r', str(requirement))
......@@ -623,7 +624,8 @@ class Installer:
for dist in self._get_dist(requirement, ws):
ws.add(dist)
self._maybe_add_distribute(ws, dist)
except pkg_resources.VersionConflict, err:
except pkg_resources.VersionConflict:
err = sys.exc_info()[1]
raise VersionConflict(err, ws)
else:
break
......@@ -813,12 +815,12 @@ def develop(setup, dest,
undo.append(lambda: os.remove(tsetup))
undo.append(lambda: os.close(fd))
os.write(fd, runsetup_template % dict(
os.write(fd, (runsetup_template % dict(
distribute=distribute_loc,
setupdir=directory,
setup=setup,
__file__ = setup,
))
)).encode())
tmp3 = tempfile.mkdtemp('build', dir=dest)
undo.append(lambda : shutil.rmtree(tmp3))
......@@ -871,7 +873,7 @@ def scripts(reqs, working_set, executable, dest=None,
for p in path:
if p not in unique_path:
unique_path.append(p)
path = map(realpath, unique_path)
path = list(map(realpath, unique_path))
generated = []
......@@ -1073,7 +1075,7 @@ def _create_script(contents, dest):
logger.info("Generated script %r.", script)
try:
os.chmod(dest, 0755)
os.chmod(dest, 0o755)
except (AttributeError, os.error):
pass
......@@ -1110,8 +1112,7 @@ sys.path[0:0] = [
]
%(initialization)s
%(original_content)s
'''
%(original_content)s'''
def _pyscript(path, dest, rsetup):
......@@ -1142,7 +1143,7 @@ def _pyscript(path, dest, rsetup):
if changed:
open(dest, 'w').write(contents)
try:
os.chmod(dest,0755)
os.chmod(dest,0o755)
except (AttributeError, os.error):
pass
logger.info("Generated interpreter %r.", script)
......@@ -1167,7 +1168,7 @@ if len(sys.argv) > 1:
if _opt == '-i':
_interactive = True
elif _opt == '-c':
exec _val
exec(_val)
elif _opt == '-m':
sys.argv[1:] = _args
_args = []
......@@ -1178,7 +1179,9 @@ if len(sys.argv) > 1:
sys.argv[:] = _args
__file__ = _args[0]
del _options, _args
execfile(__file__)
__file__f = open(__file__)
exec(compile(__file__f.read(), __file__, "exec"))
__file__f.close(); del __file__f
if _interactive:
del _interactive
......@@ -1195,7 +1198,8 @@ __file__ = %(__file__)r
os.chdir(%(setupdir)r)
sys.argv[0] = %(setup)r
execfile(%(setup)r)
exec(compile(open(%(setup)r).read(), %(setup)r, 'exec'))
"""
......
This diff is collapsed.
......@@ -41,20 +41,20 @@ buildout:
When trying to run this buildout offline, we'll find that we cannot read all
of the required configuration:
>>> print system(buildout + ' -o')
>>> print_(system(buildout + ' -o'))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
Trying the same online, we can:
>>> print system(buildout)
>>> print_(system(buildout))
Unused options for buildout: 'foo'.
As long as we haven't said anything about caching downloaded configuration,
nothing gets cached. Offline mode will still cause the buildout to fail:
>>> print system(buildout + ' -o')
>>> print_(system(buildout + ' -o'))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
......@@ -73,7 +73,7 @@ being a hash of the complete URL):
... extends-cache = cache
... """ % server_url)
>>> print system(buildout)
>>> print_(system(buildout))
Unused options for buildout: 'foo'.
>>> cache = join(sample_buildout, 'cache')
......@@ -88,7 +88,7 @@ foo = bar
We can now run buildout offline as it will read base.cfg from the cache:
>>> print system(buildout + ' -o')
>>> print_(system(buildout + ' -o'))
Unused options for buildout: 'foo'.
The cache is being used purely as a fall-back in case we are offline or don't
......@@ -104,18 +104,18 @@ base.cfg from the cache:
... bar = baz
... """)
>>> print system(buildout + ' -o')
>>> print_(system(buildout + ' -o'))
Unused options for buildout: 'foo'.
In online mode, buildout will download and use the modified version:
>>> print system(buildout)
>>> print_(system(buildout))
Unused options for buildout: 'bar'.
Trying offline mode again, the new version will be used as it has been put in
the cache now:
>>> print system(buildout + ' -o')
>>> print_(system(buildout + ' -o'))
Unused options for buildout: 'bar'.
Clean up:
......@@ -203,7 +203,7 @@ bases, using different caches:
Buildout will now assemble its configuration from all of these 6 files,
defaults first. The online resources end up in the respective extends caches:
>>> print system(buildout)
>>> print_(system(buildout))
Unused options for buildout: 'foo'.
>>> ls('user-cache')
......@@ -249,7 +249,7 @@ Let's rewrite the config files, clean out the caches and re-run buildout:
>>> remove('user-cache', os.listdir('user-cache')[0])
>>> remove('cache', os.listdir('cache')[0])
>>> print system(buildout)
>>> print_(system(buildout))
Unused options for buildout: 'foo'.
>>> ls('user-cache')
......@@ -272,7 +272,7 @@ Offline mode and installation from cache
If we run buildout in offline mode now, it will fail because it cannot get at
the remote configuration file needed by the user's defaults:
>>> print system(buildout + ' -o')
>>> print_(system(buildout + ' -o'))
While:
Initializing.
Error: Couldn't download 'http://localhost/base_default.cfg' in offline mode.
......@@ -285,7 +285,7 @@ configuration and see when buildout applies this setting in each case:
... extends = fancy_default.cfg
... offline = true
... """)
>>> print system(buildout)
>>> print_(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base_default.cfg' in offline mode.
......@@ -299,7 +299,7 @@ Error: Couldn't download 'http://localhost/base_default.cfg' in offline mode.
... extends = %sbase_default.cfg
... offline = true
... """ % server_url)
>>> print system(buildout)
>>> print_(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
......@@ -313,7 +313,7 @@ Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
... extends = fancy.cfg
... offline = true
... """)
>>> print system(buildout)
>>> print_(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
......@@ -327,7 +327,7 @@ Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
... extends = %sbase.cfg
... offline = true
... """ % server_url)
>>> print system(buildout)
>>> print_(system(buildout))
Unused options for buildout: 'foo'.
The ``install-from-cache`` option is treated accordingly:
......@@ -337,7 +337,7 @@ The ``install-from-cache`` option is treated accordingly:
... extends = fancy_default.cfg
... install-from-cache = true
... """)
>>> print system(buildout)
>>> print_(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base_default.cfg' in offline mode.
......@@ -351,7 +351,7 @@ Error: Couldn't download 'http://localhost/base_default.cfg' in offline mode.
... extends = %sbase_default.cfg
... install-from-cache = true
... """ % server_url)
>>> print system(buildout)
>>> print_(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
......@@ -365,7 +365,7 @@ Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
... extends = fancy.cfg
... install-from-cache = true
... """)
>>> print system(buildout)
>>> print_(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
......@@ -379,7 +379,7 @@ Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
... extends = %sbase.cfg
... install-from-cache = true
... """ % server_url)
>>> print system(buildout)
>>> print_(system(buildout))
While:
Installing.
Checking for upgrades.
......@@ -406,7 +406,7 @@ is already present locally. If we run buildout in newest mode
... extends-cache = cache
... extends = %sbase.cfg
... """ % server_url)
>>> print system(buildout)
>>> print_(system(buildout))
>>> ls('cache')
- 5aedc98d7e769290a29d654a591a3a45
>>> cat('cache', os.listdir(cache)[0])
......@@ -420,7 +420,7 @@ A change to ``base.cfg`` is picked up on the next buildout run:
... parts =
... foo = bar
... """)
>>> print system(buildout + " -n")
>>> print_(system(buildout + " -n"))
Unused options for buildout: 'foo'.
>>> cat('cache', os.listdir(cache)[0])
[buildout]
......@@ -434,7 +434,7 @@ already present in the extends cache will not be updated:
... [buildout]
... parts =
... """)
>>> print system(buildout + " -N")
>>> print_(system(buildout + " -N"))
Unused options for buildout: 'foo'.
>>> cat('cache', os.listdir(cache)[0])
[buildout]
......@@ -463,7 +463,7 @@ used:
... newest = true
... extends = %sbaseA.cfg %sbaseB.cfg
... """ % (server_url, server_url))
>>> print system(buildout + " -n")
>>> print_(system(buildout + " -n"))
Unused options for buildout: 'bar' 'foo'.
(XXX We patch download utility's API to produce readable output for the test;
......@@ -472,7 +472,7 @@ a better solution would utilise the logging already done by the utility.)
>>> import zc.buildout
>>> old_download = zc.buildout.download.Download.download
>>> def wrapper_download(self, url, md5sum=None, path=None):
... print "The URL %s was downloaded." % url
... print_("The URL %s was downloaded." % url)
... return old_download(url, md5sum, path)
>>> zc.buildout.download.Download.download = wrapper_download
......@@ -499,7 +499,7 @@ UserError is raised if that option is encountered now:
... parts =
... extended-by = foo.cfg
... """)
>>> print system(buildout)
>>> print_(system(buildout))
While:
Initializing.
Error: No-longer supported "extended-by" option found in http://localhost/base.cfg.
......
......@@ -38,7 +38,8 @@ This document tests the 3rd option.
>>> sample_buildout = tmpdir('sample')
>>> cd(sample_buildout)
>>> import sys
>>> print system("%s -S %s init demo" % (sys.executable, bootstrap_py)),
>>> print_(system("%s -S %s init demo" % (sys.executable, bootstrap_py)),
... end='')
... # doctest: +ELLIPSIS
Downloading http://pypi.python.org/packages/source/d/distribute/...
Creating '/sample/buildout.cfg'.
......@@ -78,10 +79,10 @@ The -S option is also used when invoking setup scripts.
>>> write('proj', 'setup.py', """
... from distutils.core import setup
... import sys
... print 'site:', 'site' in sys.modules
... print_('site:', 'site' in sys.modules)
... setup(name='hassite')
... """)
>>> print system(join('bin', 'buildout')+' setup proj sdist')
>>> print_(system(join('bin', 'buildout')+' setup proj sdist'))
... # doctest: +ELLIPSIS
Running setup script 'proj/setup.py'.
site: True
......@@ -95,7 +96,7 @@ The -S option is also used when invoking setup scripts.
... recipe = zc.recipe.egg
... eggs = hassite
... """ % join('proj', 'dist'))
>>> print system(join('bin', 'buildout'))
>>> print_(system(join('bin', 'buildout')))
... # doctest: +ELLIPSIS
Uninstalling py.
Installing egg.
......@@ -110,7 +111,7 @@ The -S option is also used when invoking setup scripts.
... parts =
... develop = %s
... """ % join('proj'))
>>> print system(join('bin', 'buildout'))
>>> print_(system(join('bin', 'buildout')))
... # doctest: +ELLIPSIS
Develop: '/sample/proj'
site: True
......
......@@ -21,10 +21,12 @@ To see how this works, we'll create two versions of a recipe egg:
>>> mkdir('recipe')
>>> write('recipe', 'recipe.py',
... '''
... import sys
... print_ = lambda *a: sys.stdout.write(' '.join(map(str, a))+'\n')
... class Recipe:
... def __init__(*a): pass
... def install(self):
... print 'recipe v1'
... print_('recipe v1')
... return ()
... update = install
... ''')
......@@ -39,7 +41,7 @@ To see how this works, we'll create two versions of a recipe egg:
>>> 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'.
...
......@@ -47,10 +49,12 @@ To see how this works, we'll create two versions of a recipe egg:
>>> write('recipe', 'recipe.py',
... '''
... import sys
... print_ = lambda *a: sys.stdout.write(' '.join(map(str, a))+'\n')
... class Recipe:
... def __init__(*a): pass
... def install(self):
... print 'recipe v2'
... print_('recipe v2')
... return ()
... update = install
... ''')
......@@ -64,7 +68,7 @@ To see how this works, we'll create two versions of a recipe egg:
... ''')
>>> print system(buildout+' setup recipe bdist_egg'), # doctest: +ELLIPSIS
>>> print_(system(buildout+' setup recipe bdist_egg')) # doctest: +ELLIPSIS
Running setup script 'recipe/setup.py'.
...
......@@ -82,7 +86,7 @@ and we'll configure a buildout to use it:
If we run the buildout, it will use version 2:
>>> print system(buildout),
>>> print_(system(buildout), end='')
Getting distribution for 'spam'.
Got spam 2.
Installing foo.
......@@ -112,7 +116,7 @@ as in the versions option.
Now, if we run the buildout, we'll use version 1 of the spam recipe:
>>> print system(buildout),
>>> print_(system(buildout), end='')
Getting distribution for 'spam==1'.
Got spam 1.
Uninstalling foo.
......@@ -123,7 +127,7 @@ Running the buildout in verbose mode will help us get information
about versions used. If we run the buildout in verbose mode without
specifying a versions section:
>>> print system(buildout+' buildout:versions= -v'), # doctest: +ELLIPSIS
>>> print_(system(buildout+' buildout:versions= -v'), end='')
Installing 'zc.buildout', 'distribute'.
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'distribute'.
......@@ -145,7 +149,7 @@ that we can fix them in a versions section.
If we run the buildout with the versions section:
>>> print system(buildout+' -v'), # doctest: +ELLIPSIS
>>> print_(system(buildout+' -v'), end='')
Installing 'zc.buildout', 'distribute'.
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'distribute'.
......
......@@ -42,7 +42,7 @@ def rmtree (path):
and make it unwriteable
>>> os.chmod (foo, 0400)
>>> os.chmod (foo, 0o400)
rmtree should be able to remove it:
......@@ -54,7 +54,7 @@ def rmtree (path):
0
"""
def retry_writeable (func, path, exc):
os.chmod (path, 0600)
os.chmod (path, 0o600)
func (path)
shutil.rmtree (path, onerror = retry_writeable)
......@@ -64,3 +64,4 @@ def test_suite():
if "__main__" == __name__:
doctest.testmod()
......@@ -17,7 +17,8 @@ commands, like bdist_egg even with packages that don't use setuptools.
To illustrate this, we'll create a package in a sample buildout:
>>> mkdir('hello')
>>> write('hello', 'hello.py', 'print "Hello World!"')
>>> write('hello', 'hello.py',
... 'import sys; sys.stdout.write("Hello World!\n")\n')
>>> write('hello', 'README', 'This is hello')
>>> write('hello', 'setup.py',
... """
......@@ -32,7 +33,7 @@ To illustrate this, we'll create a package in a sample buildout:
We can use the buildout command to generate the hello egg:
>>> print system(buildout +' setup hello -q bdist_egg'),
>>> print_(system(buildout +' setup hello -q bdist_egg'), end='')
Running setup script 'hello/setup.py'.
zip_safe flag not set; analyzing archive contents...
......
......@@ -28,14 +28,14 @@ We've created a super simple (stupid) setup script. Note that it
doesn't import setuptools. Let's try running it to create an egg.
We'll use the buildout script from our sample buildout:
>>> print system(buildout+' setup'),
>>> print_(system(buildout+' setup'), end='')
... # doctest: +NORMALIZE_WHITESPACE
Error: The setup command requires the path to a setup script or
directory containing a setup script, and its arguments.
Oops, we forgot to give the name of the setup script:
>>> print system(buildout+' setup setup.py bdist_egg'),
>>> print_(system(buildout+' setup setup.py bdist_egg'))
... # doctest: +ELLIPSIS
Running setup script 'setup.py'.
...
......@@ -46,6 +46,6 @@ Oops, we forgot to give the name of the setup script:
Note that we can specify a directory name. This is often shorter and
preferred by the lazy :)
>>> print system(buildout+' setup . bdist_egg'), # doctest: +ELLIPSIS
>>> print_(system(buildout+' setup . bdist_egg')) # doctest: +ELLIPSIS
Running setup script './setup.py'.
...
......@@ -14,7 +14,7 @@
"""Various test-support utility functions
"""
import BaseHTTPServer
import http.server
import errno
import logging
import os
......@@ -28,12 +28,14 @@ import sys
import tempfile
import threading
import time
import urllib2
import urllib.request, urllib.error, urllib.parse
import zc.buildout.buildout
import zc.buildout.easy_install
from zc.buildout.rmtree import rmtree
print_ = zc.buildout.buildout.print_
fsync = getattr(os, 'fsync', lambda fileno: None)
is_win32 = sys.platform == 'win32'
......@@ -47,7 +49,7 @@ def cat(dir, *names):
and os.path.exists(path+'-script.py')
):
path = path+'-script.py'
print open(path).read(),
print_(open(path).read(), end='')
def ls(dir, *subs):
if subs:
......@@ -56,12 +58,12 @@ def ls(dir, *subs):
names.sort()
for name in names:
if os.path.isdir(os.path.join(dir, name)):
print 'd ',
print_('d ', end=' ')
elif os.path.islink(os.path.join(dir, name)):
print 'l ',
print_('l ', end=' ')
else:
print '- ',
print name
print_('- ', end=' ')
print_(name)
def mkdir(*path):
os.mkdir(os.path.join(*path))
......@@ -96,15 +98,15 @@ def system(command, input=''):
close_fds=MUST_CLOSE_FDS)
i, o, e = (p.stdin, p.stdout, p.stderr)
if input:
i.write(input)
i.write(input.encode())
i.close()
result = o.read() + e.read()
o.close()
e.close()
return result
return result.decode()
def get(url):
return urllib2.urlopen(url).read()
return urllib.request.urlopen(url).read().decode()
def _runsetup(setup, *args):
if os.path.isdir(setup):
......@@ -254,6 +256,7 @@ def buildoutSetUp(test):
start_server = start_server,
buildout = os.path.join(sample, 'bin', 'buildout'),
wait_until = wait_until,
print_ = print_,
))
zc.buildout.easy_install.prefer_final(prefer_final)
......@@ -262,10 +265,10 @@ def buildoutTearDown(test):
for f in test.globs['__tear_downs']:
f()
class Server(BaseHTTPServer.HTTPServer):
class Server(http.server.HTTPServer):
def __init__(self, tree, *args):
BaseHTTPServer.HTTPServer.__init__(self, *args)
http.server.HTTPServer.__init__(self, *args)
self.tree = os.path.abspath(tree)
__run = True
......@@ -276,14 +279,14 @@ class Server(BaseHTTPServer.HTTPServer):
def handle_error(self, *_):
self.__run = False
class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
class Handler(http.server.BaseHTTPRequestHandler):
Server.__log = False
def __init__(self, request, address, server):
self.__server = server
self.tree = server.tree
BaseHTTPServer.BaseHTTPRequestHandler.__init__(
http.server.BaseHTTPRequestHandler.__init__(
self, request, address, server)
def do_GET(self):
......@@ -308,7 +311,7 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
):
self.send_response(404, 'Not Found')
#self.send_response(200)
out = '<html><body>Not Found</body></html>'
out = '<html><body>Not Found</body></html>'.encode()
#out = '\n'.join(self.tree, self.path, path)
self.send_header('Content-Length', str(len(out)))
self.send_header('Content-Type', 'text/html')
......@@ -326,7 +329,7 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
name += '/'
out.append('<a href="%s">%s</a><br>\n' % (name, name))
out.append('</body></html>\n')
out = ''.join(out)
out = ''.join(out).encode()
self.send_header('Content-Length', str(len(out)))
self.send_header('Content-Type', 'text/html')
else:
......@@ -346,7 +349,7 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
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)
......@@ -364,7 +367,7 @@ def get_port():
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()
......@@ -379,7 +382,7 @@ def start_server(tree):
def stop_server(url, thread=None):
try:
urllib2.urlopen(url+'__stop__')
urllib.request.urlopen(url+'__stop__')
except Exception:
pass
if thread is not None:
......@@ -395,7 +398,7 @@ def wait(port, up):
s.close()
if up:
break
except socket.error, e:
except socket.error as e:
if e[0] not in (errno.ECONNREFUSED, errno.ECONNRESET):
raise
s.close()
......@@ -408,7 +411,7 @@ def wait(port, up):
raise SystemError("Couln't stop server")
def install(project, destination):
if not isinstance(destination, basestring):
if not isinstance(destination, str):
destination = os.path.join(destination.globs['sample_buildout'],
'eggs')
......@@ -428,7 +431,7 @@ def install(project, destination):
).write(dist.location)
def install_develop(project, destination):
if not isinstance(destination, basestring):
if not isinstance(destination, str):
destination = os.path.join(destination.globs['sample_buildout'],
'develop-eggs')
......@@ -462,3 +465,7 @@ normalize_egg_py = (
re.compile('-py\d[.]\d(-\S+)?.egg'),
'-pyN.N.egg',
)
normalize_exception_type_for_python_2_and_3 = (
re.compile(r'^(\w+\.)*([A-Z][A-Za-z0-9]+Error: )'),
'\2')
from zc.buildout.buildout import print_
class Debug:
......@@ -7,10 +8,10 @@ class Debug:
self.options = options
def install(self):
items = self.options.items()
items = list(self.options.items())
items.sort()
for option, value in items:
print " %s=%r" % (option, value)
print_(" %s=%r" % (option, value))
return ()
update = install
This diff is collapsed.
......@@ -34,6 +34,8 @@ zc.buildout used:
>>> write(sample_buildout, 'showversions', 'showversions.py',
... """
... import pkg_resources
... import sys
... print_ = lambda *a: sys.stdout.write(' '.join(map(str, a))+'\n')
...
... class Recipe:
...
......@@ -43,7 +45,7 @@ zc.buildout used:
... def install(self):
... for project in 'zc.buildout', 'distribute':
... req = pkg_resources.Requirement.parse(project)
... print project, pkg_resources.working_set.find(req).version
... print_(project, pkg_resources.working_set.find(req).version)
... return ()
... update = install
... """)
......@@ -63,7 +65,7 @@ zc.buildout used:
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), end='')
Getting distribution for 'distribute'.
Got distribute 99.99.
Upgraded:
......@@ -111,7 +113,7 @@ will install earlier versions of these packages:
Now we can see that we actually "upgrade" to an earlier version.
>>> print system(buildout),
>>> print_(system(buildout), end='')
Upgraded:
distribute version 0.6;
restarting.
......@@ -138,7 +140,7 @@ We won't upgrade in offline mode:
... recipe = showversions
... """ % dict(new_releases=new_releases))
>>> print system(buildout+' -o'),
>>> print_(system(buildout+' -o'), ed='')
Develop: '/sample-buildout/showversions'
Updating show-versions.
zc.buildout 1.0.0
......@@ -146,7 +148,7 @@ We won't upgrade in offline mode:
Or in non-newest mode:
>>> print system(buildout+' -N'),
>>> print_(system(buildout+' -N'), end='')
Develop: '/sample-buildout/showversions'
Updating show-versions.
zc.buildout 1.0.0
......@@ -166,7 +168,7 @@ directory:
... """ % dict(new_releases=new_releases))
>>> cd(sample_buildout2)
>>> print system(buildout),
>>> print_(system(buildout), end='')
Creating directory '/sample_buildout2/bin'.
Creating directory '/sample_buildout2/parts'.
Creating directory '/sample_buildout2/eggs'.
......
......@@ -14,6 +14,8 @@ can't delete.
>>> write('recipe', 'recipe.py',
... '''
... import os
... import sys
... print_ = lambda *a: sys.stdout.write(' '.join(map(str, a))+'\n')
... class Recipe:
... def __init__(self, buildout, name, options):
... self.location = os.path.join(
......@@ -21,7 +23,7 @@ can't delete.
... name)
...
... def install(self):
... print "can't remove read only files"
... print_("can't remove read only files")
... if not os.path.exists (self.location):
... os.makedirs (self.location)
...
......@@ -43,7 +45,7 @@ can't delete.
>>> 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'.
...
......@@ -59,7 +61,7 @@ and we'll configure a buildout to use it:
... recipe = spam
... ''' % join('recipe', 'dist'))
>>> print system(buildout),
>>> print_(system(buildout), end='')
Getting distribution for 'spam'.
Got spam 1.
Installing foo.
......
......@@ -61,7 +61,7 @@ class Custom(Base):
self.environment = buildout[environment_section]
else:
self.environment = {}
environment_data = self.environment.items()
environment_data = list(self.environment.items())
environment_data.sort()
options['_environment-data'] = repr(environment_data)
......@@ -98,7 +98,7 @@ class Custom(Base):
def _set_environment(self):
self._saved_environment = {}
for key, value in self.environment.items():
for key, value in list(self.environment.items()):
if key in os.environ:
self._saved_environment[key] = os.environ[key]
# Interpolate value with variables from environment. Maybe there
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment