Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A zc.buildout extension to solve chicken-and-egg problem of using python which is built by itself

Project description

Rerun buildout with a python provided by buildout

Buildout 2.0 no-longer supports using multiple versions of Python in a single buildout. This extension makes it possible to use ‘yet another single’ version of python, by building a specified python part and its dependencies first then reinvoking buildout with the executable.


A part to build python is required. You need to specify it by python parameter in buildout section, just same as buildout 1.x. The python section must provide executable option that gives the path to a Python executable.

And add slapos.rebootstrap to extensions parameter in buildout section.

Use whatever python to bootstrap and run buildout. If this extension detects that sys.executable used to run buildout is different than executable provided in python section, it will try to find this executable. If it does not exists, it will install this section and then reinstall buildout using new python executable. Later buildout run will continue using new python.

Example profile and invocation

extensions = slapos.rebootstrap
python = slapospython

parts =

recipe = plone.recipe.command
stop-on-error = true
bin_dir = ${buildout:parts-directory}/${:_buildout_section_name_}/bin
executable = ${:bin_dir}/python
command = mkdir -p ${:bin_dir} && cp -f /usr/bin/python ${:executable}

recipe = plone.recipe.command
command =
  echo Running with python ${buildout:executable}
update-command = ${:command}

After bootstrapping and running this buildout it will print:

Running with python /path/to/buildout/parts/slapospython/bin/python

Running tests

Test for this package can be run as simple as:

$ python test

Please keep in mind that clean python environment is required – the best one is provided by buildout or virtualenv WITHOUT site packages.


4.1 (2017-06-06)

  • Fix some files were missing.

4.0 (2017-06-05)

Complete reimplementation:

  • Work entirely in-place, even to switch to a different version of Python.
  • Update bin/buildout to immediately use the wanted Python on subsequent buildout runs.

For SlapOS, the second point is required to have the instanciation done with the built Python.

3.10 (2017-03-15)

  • Drop zc.buildout version pinning to prevent loop in case of version change.

3.9 (2017-03-15)

  • Drop zc.buildout version pinning in reboot() to prevent loop in case of version change.

3.8 (2017-03-13)

  • Use a dedicated rebootstrap directory only if buildout:rebootstrap-directory is set.

3.7 (2016-08-18)

  • Preserve bin-directory for generate bin/buildout on the appropriate location.

3.6 (2016-06-30)

  • Add more parameters for the use case with slapos.package.

3.5 (2016-06-10)

  • Explicitly specify the python interpreter and the config file when invoking a new buildout process to build rebootstrap directory.

3.4 (2016-06-10)

  • Use a dedicated buildout directory for building a rebootstrap python. The change in 3.2 was wrong because it causes infinite loop of rebootstrap and build for different version of python.

3.3 (2016-01-20)

  • Ignore MissingSection exception in _uninstall_part().

3.2 (2015-11-10)

  • Support zc.buildout >= 2.0.0.
  • Same parts directory as the normal buildout is used so that we can build faster and also make the code simpler.
  • Python part is now specified by python parameter in buildout section.
  • Restart automatically with the original python when running python part is removed.

3.1 (2011-06-24)

  • Support eggs parameter in rebootstrap section in order to add additional eggs for rebootstrapped buildout.

3.0 (2011-05-27)

  • Renamed from slapos.tool.rebootstrap 2.4

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
slapos.rebootstrap-4.1.tar.gz (7.9 kB) Copy SHA256 hash SHA256 Source None Jun 6, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page