Commit 9340cc53 authored by Jim Fulton's avatar Jim Fulton

Merge branch 'master' of github.com:buildout/buildout

parents ceb9dcd6 9632be86
...@@ -98,7 +98,6 @@ if find_links: ...@@ -98,7 +98,6 @@ if find_links:
distribute_path = ws.find( distribute_path = ws.find(
pkg_resources.Requirement.parse('distribute')).location pkg_resources.Requirement.parse('distribute')).location
env = dict(os.environ, PYTHONPATH=distribute_path)
requirement = 'zc.buildout' requirement = 'zc.buildout'
version = options.version version = options.version
...@@ -135,7 +134,7 @@ if version: ...@@ -135,7 +134,7 @@ if version:
cmd.append(requirement) cmd.append(requirement)
import subprocess import subprocess
if subprocess.call(cmd, env=env) != 0: if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=distribute_path)) != 0:
raise Exception( raise Exception(
"Failed to execute command:\n%s", "Failed to execute command:\n%s",
repr(cmd)[1:-1]) repr(cmd)[1:-1])
......
...@@ -10,6 +10,7 @@ zope.exceptions = 4.0.1 ...@@ -10,6 +10,7 @@ zope.exceptions = 4.0.1
[py] [py]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = zc.buildout eggs = zc.buildout
zc.recipe.egg
zope.testing zope.testing
interpreter = py interpreter = py
......
...@@ -53,11 +53,10 @@ import pkg_resources ...@@ -53,11 +53,10 @@ import pkg_resources
###################################################################### ######################################################################
# Install buildout # Install buildout
if subprocess.call( if subprocess.call(
[sys.executable] + [sys.executable] +
['setup.py', '-q', 'develop', '-m', '-x', '-d', 'develop-eggs'], ['setup.py', '-q', 'develop', '-m', '-x', '-d', 'develop-eggs'],
env = {'PYTHONPATH': os.path.dirname(pkg_resources.__file__)}): env=dict(os.environ, PYTHONPATH=os.path.dirname(pkg_resources.__file__))):
raise RuntimeError("buildout build failed.") raise RuntimeError("buildout build failed.")
pkg_resources.working_set.add_entry('src') pkg_resources.working_set.add_entry('src')
......
...@@ -94,6 +94,7 @@ setup( ...@@ -94,6 +94,7 @@ setup(
'Intended Audience :: Developers', 'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License', 'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python', 'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 2.4', 'Programming Language :: Python :: 2.4',
'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.6',
......
...@@ -393,8 +393,10 @@ class Buildout(DictMixin): ...@@ -393,8 +393,10 @@ class Buildout(DictMixin):
sep = re.compile(r'[\\/]') sep = re.compile(r'[\\/]')
if args: if args:
eggs = '\n '.join(a for a in args if not sep.search(a)) eggs = '\n '.join(a for a in args if not sep.search(a))
sepsub = os.path.sep == '/' and '/' or re.escape(os.path.sep)
paths = '\n '.join( paths = '\n '.join(
sep.sub(os.path.sep, a) for a in args if sep.search(a)) sep.sub(sepsub, a)
for a in args if sep.search(a))
f.write('[buildout]\n' f.write('[buildout]\n'
'parts = py\n' 'parts = py\n'
'\n' '\n'
......
...@@ -2575,10 +2575,8 @@ or paths to use: ...@@ -2575,10 +2575,8 @@ or paths to use:
>>> cd(sample_bootstrapped) >>> cd(sample_bootstrapped)
>>> remove('setup.cfg') >>> remove('setup.cfg')
>>> remove('bin', 'buildout')
>>> print_(system(buildout + ' -csetup.cfg init demo other ./src'), end='') >>> print_(system(buildout + ' -csetup.cfg init demo other ./src'), end='')
Creating '/sample-bootstrapped/setup.cfg'. Creating '/sample-bootstrapped/setup.cfg'.
Generated script '/sample-bootstrapped/bin/buildout'.
Getting distribution for 'zc.recipe.egg'. Getting distribution for 'zc.recipe.egg'.
Got zc.recipe.egg 1.3.3dev. Got zc.recipe.egg 1.3.3dev.
Installing py. Installing py.
......
...@@ -181,22 +181,20 @@ class Download(object): ...@@ -181,22 +181,20 @@ 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-')
os.close(handle)
try: try:
try: tmp_path, headers = urlretrieve(url, tmp_path)
tmp_path, headers = urlretrieve(url, tmp_path) if not check_md5sum(tmp_path, md5sum):
if not check_md5sum(tmp_path, md5sum): raise ChecksumError(
raise ChecksumError( 'MD5 checksum mismatch downloading %r' % url)
'MD5 checksum mismatch downloading %r' % url) except IOError:
except IOError: e = sys.exc_info()[1]
e = sys.exc_info()[1] os.remove(tmp_path)
os.remove(tmp_path) raise zc.buildout.UserError("Error downloading extends for URL "
raise zc.buildout.UserError("Error downloading extends for URL " "%s: %s" % (url, e))
"%s: %s" % (url, e)) except Exception:
except Exception: os.remove(tmp_path)
os.remove(tmp_path) raise
raise
finally:
os.close(handle)
if path: if path:
shutil.move(tmp_path, path) shutil.move(tmp_path, path)
......
...@@ -94,6 +94,8 @@ def _get_index(index_url, find_links, allow_hosts=('*',)): ...@@ -94,6 +94,8 @@ def _get_index(index_url, find_links, allow_hosts=('*',)):
if index_url is None: if index_url is None:
index_url = default_index_url index_url = default_index_url
if index_url.startswith('file://'):
index_url = index_url[7:]
index = AllowHostsPackageIndex(index_url, hosts=allow_hosts) index = AllowHostsPackageIndex(index_url, hosts=allow_hosts)
if find_links: if find_links:
...@@ -433,6 +435,7 @@ class Installer: ...@@ -433,6 +435,7 @@ class Installer:
# Retrieve the dist: # Retrieve the dist:
if avail is None: if avail is None:
self._index.obtain(requirement)
raise MissingDistribution(requirement, ws) raise MissingDistribution(requirement, ws)
# We may overwrite distributions, so clear importer # We may overwrite distributions, so clear importer
...@@ -1049,7 +1052,10 @@ def _create_script(contents, dest): ...@@ -1049,7 +1052,10 @@ def _create_script(contents, dest):
if changed: if changed:
open(dest, 'w').write(contents) open(dest, 'w').write(contents)
logger.info("Generated script %r.", script) logger.info(
"Generated script %r.",
# Normalize for windows
script.endswith('-script.py') and script[:-10] or script)
try: try:
os.chmod(dest, 493) # 0755 os.chmod(dest, 493) # 0755
......
...@@ -503,3 +503,9 @@ normalize_exception_type_for_python_2_and_3 = ( ...@@ -503,3 +503,9 @@ normalize_exception_type_for_python_2_and_3 = (
re.compile(r'^(\w+\.)*([A-Z][A-Za-z0-9]+Error: )'), re.compile(r'^(\w+\.)*([A-Z][A-Za-z0-9]+Error: )'),
'\2') '\2')
not_found = (re.compile(r'Not found: [^\n]+/\w+/\r?\n'), '')
ignore_not_upgrading = (
re.compile(
'Not upgrading because not running a local buildout command.\n'
), '')
...@@ -2912,6 +2912,7 @@ def test_suite(): ...@@ -2912,6 +2912,7 @@ def test_suite():
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
zc.buildout.testing.normalize_script, zc.buildout.testing.normalize_script,
zc.buildout.testing.normalize_egg_py, zc.buildout.testing.normalize_egg_py,
zc.buildout.testing.not_found,
(re.compile('__buildout_signature__ = recipes-\S+'), (re.compile('__buildout_signature__ = recipes-\S+'),
'__buildout_signature__ = recipes-SSSSSSSSSSS'), '__buildout_signature__ = recipes-SSSSSSSSSSS'),
(re.compile('executable = [\S ]+python\S*', re.I), (re.compile('executable = [\S ]+python\S*', re.I),
...@@ -2945,6 +2946,7 @@ def test_suite(): ...@@ -2945,6 +2946,7 @@ def test_suite():
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
zc.buildout.testing.normalize_script, zc.buildout.testing.normalize_script,
zc.buildout.testing.normalize_egg_py, zc.buildout.testing.normalize_egg_py,
zc.buildout.testing.not_found,
(re.compile('__buildout_signature__ = recipes-\S+'), (re.compile('__buildout_signature__ = recipes-\S+'),
'__buildout_signature__ = recipes-SSSSSSSSSSS'), '__buildout_signature__ = recipes-SSSSSSSSSSS'),
(re.compile('[-d] distribute-\S+[.]egg'), 'distribute.egg'), (re.compile('[-d] distribute-\S+[.]egg'), 'distribute.egg'),
...@@ -2974,6 +2976,7 @@ def test_suite(): ...@@ -2974,6 +2976,7 @@ def test_suite():
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
zc.buildout.testing.normalize_exception_type_for_python_2_and_3, zc.buildout.testing.normalize_exception_type_for_python_2_and_3,
zc.buildout.testing.not_found,
(re.compile('zc.buildout.buildout.MissingOption'), (re.compile('zc.buildout.buildout.MissingOption'),
'MissingOption'), 'MissingOption'),
(re.compile(r'\S+buildout.py'), 'buildout.py'), (re.compile(r'\S+buildout.py'), 'buildout.py'),
...@@ -2994,6 +2997,7 @@ def test_suite(): ...@@ -2994,6 +2997,7 @@ def test_suite():
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
zc.buildout.testing.normalize_script, zc.buildout.testing.normalize_script,
zc.buildout.testing.normalize_egg_py, zc.buildout.testing.normalize_egg_py,
zc.buildout.testing.not_found,
normalize_bang, normalize_bang,
normalize_S, normalize_S,
(re.compile('99[.]99'), 'NINETYNINE.NINETYNINE'), (re.compile('99[.]99'), 'NINETYNINE.NINETYNINE'),
...@@ -3010,20 +3014,25 @@ def test_suite(): ...@@ -3010,20 +3014,25 @@ def test_suite():
setUp=easy_install_SetUp, setUp=easy_install_SetUp,
tearDown=zc.buildout.testing.buildoutTearDown, tearDown=zc.buildout.testing.buildoutTearDown,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_script,
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
zc.buildout.testing.normalize_script,
zc.buildout.testing.normalize_egg_py, zc.buildout.testing.normalize_egg_py,
zc.buildout.testing.normalize_exception_type_for_python_2_and_3, zc.buildout.testing.normalize_exception_type_for_python_2_and_3,
zc.buildout.testing.not_found,
normalize_bang, normalize_bang,
normalize_S, normalize_S,
(re.compile('[-d] distribute-\S+[.]egg'), 'distribute.egg'), (re.compile('[-d] distribute-\S+[.]egg'), 'distribute.egg'),
(re.compile(r'\\[\\]?'), '/'), (re.compile(r'\\[\\]?'), '/'),
(re.compile('(\n?)- ([a-zA-Z_.-]+)\n- \\2.exe\n'),
'\\1- \\2\n'),
]+(sys.version_info < (2, 5) and [ ]+(sys.version_info < (2, 5) and [
(re.compile('.*No module named runpy.*', re.S), ''), (re.compile('.*No module named runpy.*', re.S), ''),
(re.compile('.*usage: pdb.py scriptfile .*', re.S), ''), (re.compile('.*usage: pdb.py scriptfile .*', re.S), ''),
(re.compile('.*Error: what does not exist.*', re.S), ''), (re.compile('.*Error: what does not exist.*', re.S), ''),
] or [])), ] or [])),
), ),
doctest.DocFileSuite( doctest.DocFileSuite(
...@@ -3032,13 +3041,15 @@ def test_suite(): ...@@ -3032,13 +3041,15 @@ def test_suite():
tearDown=zc.buildout.testing.buildoutTearDown, tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS, optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_exception_type_for_python_2_and_3, zc.buildout.testing.normalize_exception_type_for_python_2_and_3,
(re.compile(' at -?0x[^>]+'), '<MEM ADDRESS>'), zc.buildout.testing.not_found,
(re.compile('http://localhost:[0-9]{4,5}/'), (re.compile(' at -?0x[^>]+'), '<MEM ADDRESS>'),
'http://localhost/'), (re.compile('http://localhost:[0-9]{4,5}/'),
(re.compile('[0-9a-f]{32}'), '<MD5 CHECKSUM>'), 'http://localhost/'),
zc.buildout.testing.normalize_path, (re.compile('[0-9a-f]{32}'), '<MD5 CHECKSUM>'),
]), zc.buildout.testing.normalize_path,
zc.buildout.testing.ignore_not_upgrading,
]),
), ),
doctest.DocTestSuite( doctest.DocTestSuite(
...@@ -3050,6 +3061,7 @@ def test_suite(): ...@@ -3050,6 +3061,7 @@ def test_suite():
zc.buildout.testing.normalize_script, zc.buildout.testing.normalize_script,
zc.buildout.testing.normalize_egg_py, zc.buildout.testing.normalize_egg_py,
zc.buildout.testing.normalize___pycache__, zc.buildout.testing.normalize___pycache__,
zc.buildout.testing.not_found,
(re.compile(r'^(\w+\.)*(Missing\w+: )'), '\2'), (re.compile(r'^(\w+\.)*(Missing\w+: )'), '\2'),
(re.compile("buildout: Running \S*setup.py"), (re.compile("buildout: Running \S*setup.py"),
'buildout: Running setup.py'), 'buildout: Running setup.py'),
...@@ -3086,6 +3098,7 @@ def test_suite(): ...@@ -3086,6 +3098,7 @@ def test_suite():
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
zc.buildout.testing.normalize_script, zc.buildout.testing.normalize_script,
zc.buildout.testing.normalize_egg_py, zc.buildout.testing.normalize_egg_py,
zc.buildout.testing.not_found,
(re.compile('__buildout_signature__ = recipes-\S+'), (re.compile('__buildout_signature__ = recipes-\S+'),
'__buildout_signature__ = recipes-SSSSSSSSSSS'), '__buildout_signature__ = recipes-SSSSSSSSSSS'),
(re.compile('[-d] distribute-\S+[.]egg'), 'distribute.egg'), (re.compile('[-d] distribute-\S+[.]egg'), 'distribute.egg'),
...@@ -3120,6 +3133,7 @@ def test_suite(): ...@@ -3120,6 +3133,7 @@ def test_suite():
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
zc.buildout.testing.normalize_script, zc.buildout.testing.normalize_script,
zc.buildout.testing.not_found,
normalize_bang, normalize_bang,
(re.compile('Downloading.*distribute.*egg\n'), ''), (re.compile('Downloading.*distribute.*egg\n'), ''),
]), ]),
......
...@@ -48,6 +48,7 @@ def test_suite(): ...@@ -48,6 +48,7 @@ def test_suite():
zc.buildout.testing.normalize_egg_py, zc.buildout.testing.normalize_egg_py,
zc.buildout.tests.normalize_bang, zc.buildout.tests.normalize_bang,
zc.buildout.tests.normalize_S, zc.buildout.tests.normalize_S,
zc.buildout.testing.not_found,
(re.compile('[d-] zc.buildout(-\S+)?[.]egg(-link)?'), (re.compile('[d-] zc.buildout(-\S+)?[.]egg(-link)?'),
'zc.buildout.egg'), 'zc.buildout.egg'),
(re.compile('[d-] distribute-[^-]+-'), 'distribute-X-'), (re.compile('[d-] distribute-[^-]+-'), 'distribute-X-'),
...@@ -61,6 +62,7 @@ def test_suite(): ...@@ -61,6 +62,7 @@ def test_suite():
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
zc.buildout.testing.not_found,
(re.compile('__buildout_signature__ = ' (re.compile('__buildout_signature__ = '
'sample-\S+\s+' 'sample-\S+\s+'
'zc.recipe.egg-\S+\s+' 'zc.recipe.egg-\S+\s+'
...@@ -80,6 +82,7 @@ def test_suite(): ...@@ -80,6 +82,7 @@ def test_suite():
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
zc.buildout.testing.not_found,
(re.compile("(d ((ext)?demo(needed)?|other)" (re.compile("(d ((ext)?demo(needed)?|other)"
"-\d[.]\d-py)\d[.]\d(-\S+)?[.]egg"), "-\d[.]\d-py)\d[.]\d(-\S+)?[.]egg"),
'\\1V.V.egg'), '\\1V.V.egg'),
......
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