Commit 88eb2032 authored by Domen Kožar's avatar Domen Kožar

fix bootstrap.py to correctly handle bootstrap and init commands

parent 126938e4
...@@ -4,6 +4,11 @@ Change History ...@@ -4,6 +4,11 @@ Change History
1.6.1 (xxx) 1.6.1 (xxx)
=========== ===========
- `bootstrap.py -d init` would invoke buildout with arguments
`init bootstrap` leading into installation of bootstrap package.
now bootstrap.py first runs any commands passed, then tries to
bootstrap. (Domen Kožar)
- fix Python 2.4 support (Domen Kožar) - fix Python 2.4 support (Domen Kožar)
- added travis-ci testing (Domen Kožar) - added travis-ci testing (Domen Kožar)
......
...@@ -134,7 +134,9 @@ parser.add_option("-c", None, action="store", dest="config_file", ...@@ -134,7 +134,9 @@ 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, args = parser.parse_args() options, orig_args = parser.parse_args()
args = []
# if -c was provided, we push it back into args for buildout's main function # if -c was provided, we push it back into args for buildout's main function
if options.config_file is not None: if options.config_file is not None:
...@@ -153,7 +155,6 @@ if options.setup_source is None: ...@@ -153,7 +155,6 @@ if options.setup_source is None:
if options.accept_buildout_test_releases: if options.accept_buildout_test_releases:
args.append('buildout:accept-buildout-test-releases=true') args.append('buildout:accept-buildout-test-releases=true')
args.append('bootstrap')
try: try:
import pkg_resources import pkg_resources
...@@ -257,6 +258,9 @@ if exitcode != 0: ...@@ -257,6 +258,9 @@ 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
zc.buildout.buildout.main(args) if orig_args:
# run buildout with commands passed to bootstrap.py, then actually bootstrap
zc.buildout.buildout.main(args + orig_args)
zc.buildout.buildout.main(args + ['bootstrap'])
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)
...@@ -347,3 +347,15 @@ Here's the entire help text. ...@@ -347,3 +347,15 @@ Here's the entire help text.
or betas. or betas.
-c CONFIG_FILE Specify the path to the buildout configuration file to -c CONFIG_FILE Specify the path to the buildout configuration file to
be used. be used.
Rebootstrap and create config file.
>>> remove('buildout.cfg')
>>> print system(
... zc.buildout.easy_install._safe_arg(sys.executable) +
... ' bootstrap.py init') # doctest: +NORMALIZE_WHITESPACE
Creating '/sample/buildout.cfg'.
>>> cat('buildout.cfg') # doctest: +NORMALIZE_WHITESPACE
[buildout]
parts =
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