Commit 16a14ce8 authored by Jim Fulton's avatar Jim Fulton

Fixed: bootstraps weren't completed correctly if settings (X:Y=Z) were used.

parent 1c6bcc74
...@@ -134,13 +134,7 @@ parser.add_option("-c", None, action="store", dest="config_file", ...@@ -134,13 +134,7 @@ parser.add_option("-c", None, action="store", dest="config_file",
help=("Specify the path to the buildout configuration " help=("Specify the path to the buildout configuration "
"file to be used.")) "file to be used."))
options, orig_args = parser.parse_args() options, args = parser.parse_args()
args = []
# if -c was provided, we push it back into args for buildout's main function
if options.config_file is not None:
args += ['-c', options.config_file]
if options.eggs: if options.eggs:
eggs_dir = os.path.abspath(os.path.expanduser(options.eggs)) eggs_dir = os.path.abspath(os.path.expanduser(options.eggs))
...@@ -154,7 +148,7 @@ if options.setup_source is None: ...@@ -154,7 +148,7 @@ if options.setup_source is None:
options.setup_source = setuptools_source options.setup_source = setuptools_source
if options.accept_buildout_test_releases: if options.accept_buildout_test_releases:
args.append('buildout:accept-buildout-test-releases=true') args.insert(0, 'buildout:accept-buildout-test-releases=true')
try: try:
import pkg_resources import pkg_resources
...@@ -268,9 +262,16 @@ if exitcode != 0: ...@@ -268,9 +262,16 @@ if exitcode != 0:
ws.add_entry(eggs_dir) ws.add_entry(eggs_dir)
ws.require(requirement) ws.require(requirement)
import zc.buildout.buildout import zc.buildout.buildout
if orig_args:
# run buildout with commands passed to bootstrap.py, then actually bootstrap # If there isn't already a command in the args, add bootstrap
zc.buildout.buildout.main(args + orig_args) if not [a for a in args if '=' not in a]:
zc.buildout.buildout.main(args + ['bootstrap']) args.append('bootstrap')
# if -c was provided, we push it back into args for buildout's main function
if options.config_file is not None:
args[0:0] = ['-c', options.config_file]
zc.buildout.buildout.main(args)
if not options.eggs: # clean up temporary egg directory if not options.eggs: # clean up temporary egg directory
shutil.rmtree(eggs_dir) shutil.rmtree(eggs_dir)
Some people pass buildout settings to bootstrap.
>>> import os, sys
>>> from os.path import dirname, join
>>> import zc.buildout
>>> bootstrap_py = join(
... dirname(
... dirname(
... dirname(
... dirname(zc.buildout.__file__)
... )
... )
... ),
... 'bootstrap', 'bootstrap.py')
>>> top = tmpdir('top')
>>> mkdir(top, 'buildout')
>>> os.chdir(top)
>>> write('buildout', 'buildout.cfg',
... '''
... [buildout]
... parts =
... ''')
>>> write('bootstrap.py', open(bootstrap_py).read())
>>> print 'X'; print system(
... zc.buildout.easy_install._safe_arg(sys.executable) +
... ' bootstrap.py buildout:directory=' + top +
... ' -c'+join('buildout', 'buildout.cfg')
... ); print 'X' # doctest: +ELLIPSIS
X
Creating directory '/top/bin'.
Creating directory '/top/parts'.
Creating directory '/top/eggs'.
Creating directory '/top/develop-eggs'.
Generated script '/top/bin/buildout'.
...
X
They might do it with init, but no worries:
>>> remove(top)
>>> top = tmpdir('top')
>>> mkdir(top, 'buildout')
>>> os.chdir(top)
>>> write('bootstrap.py', open(bootstrap_py).read())
>>> print 'X'; print system(
... zc.buildout.easy_install._safe_arg(sys.executable) +
... ' bootstrap.py buildout:directory=' + top +
... ' -c'+join('buildout', 'buildout.cfg') +
... ' init'
... ); print 'X' # doctest: +ELLIPSIS
X
Creating '/top/buildout/buildout.cfg'.
Creating directory '/top/bin'.
Creating directory '/top/parts'.
Creating directory '/top/eggs'.
Creating directory '/top/develop-eggs'.
Generated script '/top/bin/buildout'.
...
X
...@@ -4328,7 +4328,7 @@ def test_suite(): ...@@ -4328,7 +4328,7 @@ def test_suite():
if os.path.exists(bootstrap_py): if os.path.exists(bootstrap_py):
test_suite.append(doctest.DocFileSuite( test_suite.append(doctest.DocFileSuite(
'bootstrap.txt', 'bootstrap1.txt', 'bootstrap.txt', 'bootstrap1.txt', 'bootstrap_cl_settings.test',
setUp=bootstrapSetup, setUp=bootstrapSetup,
tearDown=zc.buildout.testing.buildoutTearDown, tearDown=zc.buildout.testing.buildoutTearDown,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
......
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