Commit b9138c32 authored by Jim Fulton's avatar Jim Fulton

tests (except for 1 that should fail) passing on Python (Mac OS X) 2.4-2.7, 3.2

parent 7b6fa058
...@@ -57,7 +57,10 @@ options, args = parser.parse_args() ...@@ -57,7 +57,10 @@ options, args = parser.parse_args()
# handle -S # handle -S
def normpath(p): def normpath(p):
return p[:-1] if p.endswith(os.path.sep) else p if p.endswith(os.path.sep):
return p[:-1]
else:
return p
nosite = 'site' not in sys.modules nosite = 'site' not in sys.modules
if nosite: if nosite:
......
[buildout] [buildout]
develop = zc.recipe.egg_ . develop = zc.recipe.egg_ .
parts = test oltest py parts = test oltest py
versions = versions
[versions]
zope.interface = 3.8.0
zope.exceptions = 3.7.1
[py] [py]
recipe = zc.recipe.egg recipe = zc.recipe.egg
......
...@@ -30,7 +30,10 @@ if os.path.isdir('build'): ...@@ -30,7 +30,10 @@ if os.path.isdir('build'):
# handle -S # handle -S
def normpath(p): def normpath(p):
return p[:-1] if p.endswith(os.path.sep) else p if p.endswith(os.path.sep):
return p[:-1]
else:
return p
nosite = 'site' not in sys.modules nosite = 'site' not in sys.modules
if nosite: if nosite:
......
...@@ -19,7 +19,11 @@ import zc.buildout.easy_install ...@@ -19,7 +19,11 @@ import zc.buildout.easy_install
no_site = zc.buildout.easy_install.no_site no_site = zc.buildout.easy_install.no_site
from zc.buildout.rmtree import rmtree from zc.buildout.rmtree import rmtree
from hashlib import md5
try:
from hashlib import md5
except ImportError:
from md5 import md5
try: try:
from UserDict import DictMixin from UserDict import DictMixin
...@@ -729,8 +733,9 @@ class Buildout(DictMixin): ...@@ -729,8 +733,9 @@ class Buildout(DictMixin):
def _read_installed_part_options(self): def _read_installed_part_options(self):
old = self['buildout']['installed'] old = self['buildout']['installed']
if old and os.path.isfile(old): if old and os.path.isfile(old):
with open(old) as fp: fp = open(old)
sections = zc.buildout.configparser.parse(fp, old) sections = zc.buildout.configparser.parse(fp, old)
fp.close()
result = {} result = {}
for section, options in sections.items(): for section, options in sections.items():
for option, value in options.items(): for option, value in options.items():
......
...@@ -182,18 +182,19 @@ class Download(object): ...@@ -182,18 +182,19 @@ class Download(object):
self.logger.info('Downloading %s' % url) self.logger.info('Downloading %s' % url)
handle, tmp_path = tempfile.mkstemp(prefix='buildout-') handle, tmp_path = tempfile.mkstemp(prefix='buildout-')
try: try:
tmp_path, headers = urlretrieve(url, tmp_path) try:
if not check_md5sum(tmp_path, md5sum): tmp_path, headers = urlretrieve(url, tmp_path)
raise ChecksumError( if not check_md5sum(tmp_path, md5sum):
'MD5 checksum mismatch downloading %r' % url) raise ChecksumError(
except IOError: 'MD5 checksum mismatch downloading %r' % url)
e = sys.exc_info()[1] except IOError:
os.remove(tmp_path) e = sys.exc_info()[1]
raise zc.buildout.UserError("Error downloading extends for URL " os.remove(tmp_path)
"%s: %s" % (url, e)) raise zc.buildout.UserError("Error downloading extends for URL "
except Exception: "%s: %s" % (url, e))
os.remove(tmp_path) except Exception:
raise os.remove(tmp_path)
raise
finally: finally:
os.close(handle) os.close(handle)
......
...@@ -1195,8 +1195,16 @@ runsetup_template = """ ...@@ -1195,8 +1195,16 @@ runsetup_template = """
import sys import sys
sys.path.insert(0, %(setupdir)r) sys.path.insert(0, %(setupdir)r)
sys.path.insert(0, %(distribute)r) sys.path.insert(0, %(distribute)r)
nosite = 'site' not in sys.modules
original_path = sys.path[:]
import os, setuptools import os, setuptools
if nosite and ('site' in sys.modules):
sys.path[:] = original_path
del sys.modules['site']
__file__ = %(__file__)r __file__ = %(__file__)r
os.chdir(%(setupdir)r) os.chdir(%(setupdir)r)
......
...@@ -668,7 +668,11 @@ We have a link server that has a number of eggs: ...@@ -668,7 +668,11 @@ We have a link server that has a number of eggs:
For Python 2.5 and higher, you can also use the -m option to run a For Python 2.5 and higher, you can also use the -m option to run a
module: module:
>>> print_(system(join(bin, 'py')+' -m pdb'), end='') # doctest: +ELLIPSIS >>> if sys.version_info < (2, 5):
... print ('usage: pdb.py blah blah blah')
... else:
... print_(system(join(bin, 'py')+' -m pdb'), end='')
... # doctest: +ELLIPSIS
usage: pdb.py ... usage: pdb.py ...
>>> print_(system(join(bin, 'py')+' -m pdb what'), end='') >>> print_(system(join(bin, 'py')+' -m pdb what'), end='')
......
...@@ -42,7 +42,7 @@ def rmtree (path): ...@@ -42,7 +42,7 @@ def rmtree (path):
and make it unwriteable and make it unwriteable
>>> os.chmod (foo, 0o400) >>> os.chmod (foo, 256) # 0400
rmtree should be able to remove it: rmtree should be able to remove it:
......
...@@ -404,7 +404,8 @@ def wait(port, up): ...@@ -404,7 +404,8 @@ def wait(port, up):
s.close() s.close()
if up: if up:
break break
except socket.error as e: except socket.error:
e = sys.exc_info()[1]
if e[0] not in (errno.ECONNREFUSED, errno.ECONNRESET): if e[0] not in (errno.ECONNREFUSED, errno.ECONNRESET):
raise raise
s.close() s.close()
......
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