Commit 000d5e5f authored by Julien Muchembled's avatar Julien Muchembled

Update tests and README

parent a79d01fc
*pyc
.installed.cfg
bin/
build
develop-eggs/
dist
eggs/
parts/
slapos.rebootstrap.egg-info
*.pyc
/slapos.rebootstrap.egg-info/
/.eggs/
/.installed.cfg
/bin/
/build/
/develop-eggs/
/dist
/eggs/
/parts/
......@@ -33,19 +33,13 @@ Example profile and invocation
parts =
realrun
# Uncomment the following to use a dedicated buildout directory to
# build rebootstrap python # that is mandatory if the major version
# of python is different # between buildout's python and rebootstrap
# python.
#
# rebootstrap-directory = rebootstrap
[slapospython]
recipe = plone.recipe.command
stop-on-error = true
command = mkdir -p ${buildout:parts-directory}/${:__section_name__}/bin &&
cp -f /usr/bin/python ${:executable}
bin_dir = ${buildout:parts-directory}/${:_buildout_section_name_}/bin
executable = ${:bin_dir}/python
command = mkdir -p ${:bin_dir} && cp -f /usr/bin/python ${:executable}
[realrun]
recipe = plone.recipe.command
......@@ -55,7 +49,7 @@ Example profile and invocation
After bootstrapping and running this buildout it will print:
Running with python /path/to/buildout/parts/slapospython/bin/slapospython
Running with python /path/to/buildout/parts/slapospython/bin/python
Running tests
-------------
......
......@@ -4,14 +4,7 @@ name = "slapos.rebootstrap"
long_description = open("README.txt").read() + '\n\n'
long_description += open("CHANGES.txt").read()
long_description += """
Technical documentation
=======================
"""
import glob
import os
for f in glob.glob(os.path.join('slapos', 'rebootstrap', '*.txt')):
long_description += '\n' + open(f).read() + '\n'
setup(
name=name,
version=version,
......@@ -38,9 +31,12 @@ setup(
namespace_packages=['slapos'],
packages=find_packages(),
zip_safe=True,
dependency_links=[
'http://www.nexedi.org/static/packages/source/slapos.buildout/',
],
install_requires=[
'setuptools',
'zc.buildout >=2.0.0'
'zc.buildout >=2.5.2+slapos005, <2.5.3',
],
tests_require=[
'zope.testing',
......
Default invocation
------------------
>>> import sys
>>> mkdir(sample_buildout, 'recipes')
>>> write(sample_buildout, 'recipes', 'setup.py',
... """
... from setuptools import setup
...
... setup(
... name = "recipes",
... entry_points = {'zc.buildout':[
... 'pyinstall = pyinstall:Pyinstall',
... 'pyshow = pyshow:Pyshow',
... ]},
... )
... """)
>>> write(sample_buildout, 'recipes', 'README.txt', " ")
>>> write(sample_buildout, 'recipes', 'pyinstall.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyinstall:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
... self.destination = os.path.join(buildout['buildout'][
... 'parts-directory'], self.options.get('python', name))
...
... def install(self):
... for d in [self.destination, os.path.join(self.destination, 'bin')]:
... if not os.path.exists(d):
... os.mkdir(d)
... python = os.path.join(self.destination, 'bin', self.name)
... if not os.path.exists(python):
... shutil.copy(sys.executable, python)
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'recipes', 'pyshow.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyshow:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
...
... def install(self):
... print 'Running with:', sys.executable
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... parts =
... """)
>>> print system(buildout),
Develop: '/sample-buildout/recipes'
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... extensions = slapos.rebootstrap
...
... parts =
... realrun
...
... [rebootstrap]
... section =
... installpython
... version =
... 1
...
... [installpython]
... recipe = recipes:pyinstall
...
... [realrun]
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout),
slapos.rebootstrap: Installing section 'installpython' to provide '/sample-buildout/rebootstrap.1.parts/installpython/bin/installpython' in '/sample-buildout/rebootstrap.1.parts'
slapos.rebootstrap: Rerunning buildout to install section installpython with arguments ['/sample-buildout/bin/buildout', 'buildout:parts=installpython', 'buildout:extensions=', '/sample-buildout/rebootstrap.1.parts', 'buildout:installed=.rebootstrap.1.installed.cfg'].
Creating directory '/sample-buildout/rebootstrap.1.parts'.
Develop: '/sample-buildout/recipes'
Installing installpython.
slapos.rebootstrap:
************ REBOOTSTRAP: IMPORTANT NOTICE ************
bin/buildout is being reinstalled right now, as new python:
/sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
is available, and buildout is using another python:
/system_python
Buildout will be restarted automatically to have this change applied.
************ REBOOTSTRAP: IMPORTANT NOTICE ************
<BLANKLINE>
Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/recipes'
Installing realrun.
Running with: /sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
Rebootstrap with a different major/minor version of Python
----------------------------------------------------------
TODO: The test is incomplete for 2 reasons:
- The test environment must be prepared with a directory containing the source
tarballs of several eggs, at least `setuptools` and `zc.buildout`.
Hence the failure that it couldn't find a distribution for `setuptools`.
- To go further, we'd need a really different version of Python instead of
tricking `slapos.rebootstrap` that we have one, to reproduce the
reinstallation of many eggs in `/eggs/` for the wanted version, and check
that the change of signatures is ignored for the parts required to build
Python.
>>> import sys
>>> write(sample_buildout, 'recipes', 'setup.py',
... """
... from setuptools import setup
...
... setup(
... name = "recipes",
... entry_points = {'zc.buildout':[
... 'pyinstall = pyinstall:Pyinstall',
... 'pyshow = pyshow:Pyshow',
... ],
... 'zc.buildout.extension': ['ext = extension:extension'],},
... )
... """)
>>> write(sample_buildout, 'recipes', 'extension.py',
... """
... import sys
... class extension(object):
... version_info = ()
... def __init__(self, buildout):
... from slapos import rebootstrap
... assert sys is rebootstrap.sys
... rebootstrap.sys = self
... def __getattr__(self, attr):
... return getattr(sys, attr)
... """)
>>> print system(buildout),
Develop: '/sample-buildout/recipes'
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... extensions = slapos.rebootstrap recipes
... python = installpython
...
... parts =
... realrun
...
... [installpython]
... recipe = recipes:pyinstall
...
... [realrun]
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout), # doctest: +ELLIPSIS
slapos.rebootstrap: Make sure that the section 'installpython' won't be reinstalled after rebootstrap.
Develop: '/sample-buildout/recipes'
Installing installpython.
slapos.rebootstrap:
************ REBOOTSTRAP: IMPORTANT NOTICE ************
bin/buildout is being reinstalled right now, as new python:
/sample_buildout/parts/installpython/bin/python
is available, and buildout is using another python:
/system_python
Buildout will be restarted automatically to have this change applied.
************ REBOOTSTRAP: IMPORTANT NOTICE ************
<BLANKLINE>
While:
Installing.
Error: Couldn't find a distribution for 'setuptools==...'
Support for additional eggs
---------------------------
>>> import sys
>>> mkdir(sample_buildout, 'addegg')
>>> write(sample_buildout, 'addegg', 'setup.py',
... """
... from setuptools import setup
...
... setup(
... name = "additionalegg",
... entry_points = {'zc.buildout.extension':[
... 'extension = extension:extension',
... ]},
... )
... """)
>>> write(sample_buildout, 'addegg', 'extension.py',
... """
... def extension(buildout):
... print 'Extension available in buildout.'
... """)
>>> write(sample_buildout, 'addegg', 'README.txt', " ")
>>> mkdir(sample_buildout, 'recipes')
>>> write(sample_buildout, 'recipes', 'setup.py',
... """
... from setuptools import setup
...
... setup(
... name = "recipes",
... entry_points = {'zc.buildout':[
... 'pyinstall = pyinstall:Pyinstall',
... 'pyshow = pyshow:Pyshow',
... ]},
... )
... """)
>>> write(sample_buildout, 'recipes', 'README.txt', " ")
>>> write(sample_buildout, 'recipes', 'pyinstall.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyinstall:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
... self.destination = os.path.join(buildout['buildout'][
... 'parts-directory'], self.options.get('python', name))
...
... def install(self):
... for d in [self.destination, os.path.join(self.destination, 'bin')]:
... if not os.path.exists(d):
... os.mkdir(d)
... python = os.path.join(self.destination, 'bin', self.name)
... if not os.path.exists(python):
... shutil.copy(sys.executable, python)
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'recipes', 'pyshow.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyshow:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
...
... def install(self):
... print 'Running with:', sys.executable
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes addegg
... parts =
... """)
>>> print system(buildout),
Develop: '/sample-buildout/recipes'
Develop: '/sample-buildout/addegg'
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes addegg
... extensions = slapos.rebootstrap
...
... parts =
... realrun
...
... [rebootstrap]
... section =
... installpython
... version =
... 1
... eggs =
... additionalegg
...
... [installpython]
... recipe = recipes:pyinstall
...
... [realrun]
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout),
slapos.rebootstrap: Installing section 'installpython' to provide '/sample-buildout/rebootstrap.1.parts/installpython/bin/installpython' in '/sample-buildout/rebootstrap.1.parts'
slapos.rebootstrap: Rerunning buildout to install section installpython with arguments ['/sample-buildout/bin/buildout', 'buildout:parts=installpython', 'buildout:extensions=', '/sample-buildout/rebootstrap.1.parts', 'buildout:installed=.rebootstrap.1.installed.cfg'].
Creating directory '/sample-buildout/rebootstrap.1.parts'.
Develop: '/sample-buildout/recipes'
Develop: '/sample-buildout/addegg'
Installing installpython.
slapos.rebootstrap:
************ REBOOTSTRAP: IMPORTANT NOTICE ************
bin/buildout is being reinstalled right now, as new python:
/sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
is available, and buildout is using another python:
/system_python
Buildout will be restarted automatically to have this change applied.
************ REBOOTSTRAP: IMPORTANT NOTICE ************
<BLANKLINE>
Generated script '/sample-buildout/bin/buildout'.
Extension available in buildout.
Develop: '/sample-buildout/recipes'
Develop: '/sample-buildout/addegg'
Installing realrun.
Running with: /sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
Support for extensions
----------------------
>>> import sys
>>> mkdir(sample_buildout, 'recipes')
>>> write(sample_buildout, 'recipes', 'setup.py',
... """
... from setuptools import setup
...
... setup(
... name = "recipes",
... entry_points = {'zc.buildout':[
... 'pyinstall = pyinstall:Pyinstall',
... 'pyshow = pyshow:Pyshow',
... ],
... 'zc.buildout.extension': ['ext = extension:extension'],},
... )
... """)
>>> write(sample_buildout, 'recipes', 'README.txt', " ")
>>> write(sample_buildout, 'recipes', 'extension.py',
... """
... def extension(buildout):
... print 'Special extension run'
... """)
>>> write(sample_buildout, 'recipes', 'pyinstall.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyinstall:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
... self.destination = os.path.join(buildout['buildout'][
... 'parts-directory'], self.options.get('python', name))
...
... def install(self):
... for d in [self.destination, os.path.join(self.destination, 'bin')]:
... if not os.path.exists(d):
... os.mkdir(d)
... python = os.path.join(self.destination, 'bin', self.name)
... if not os.path.exists(python):
... shutil.copy(sys.executable, python)
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'recipes', 'pyshow.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyshow:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
...
... def install(self):
... print 'Running with:', sys.executable
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... parts =
... """)
>>> print system(buildout),
Develop: '/sample-buildout/recipes'
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... extensions = slapos.rebootstrap recipes
...
... parts =
... realrun
...
... [rebootstrap]
... section =
... installpython
... version =
... 1
...
... [installpython]
... recipe = recipes:pyinstall
...
... [realrun]
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout),
slapos.rebootstrap: Installing section 'installpython' to provide '/sample-buildout/rebootstrap.1.parts/installpython/bin/installpython' in '/sample-buildout/rebootstrap.1.parts'
slapos.rebootstrap: Rerunning buildout to install section installpython with arguments ['/sample-buildout/bin/buildout', 'buildout:parts=installpython', 'buildout:extensions=recipes', '/sample-buildout/rebootstrap.1.parts', 'buildout:installed=.rebootstrap.1.installed.cfg'].
Special extension run
Creating directory '/sample-buildout/rebootstrap.1.parts'.
Develop: '/sample-buildout/recipes'
Installing installpython.
slapos.rebootstrap:
************ REBOOTSTRAP: IMPORTANT NOTICE ************
bin/buildout is being reinstalled right now, as new python:
/sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
is available, and buildout is using another python:
/system_python
Buildout will be restarted automatically to have this change applied.
************ REBOOTSTRAP: IMPORTANT NOTICE ************
<BLANKLINE>
Generated script '/sample-buildout/bin/buildout'.
Special extension run
Develop: '/sample-buildout/recipes'
Installing realrun.
Running with: /sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
Support of cases when reboostrap part exists
--------------------------------------------
>>> import sys
>>> mkdir(sample_buildout, 'recipes')
>>> write(sample_buildout, 'recipes', 'setup.py',
... """
... from setuptools import setup
...
... setup(
... name = "recipes",
... entry_points = {'zc.buildout':[
... 'pyinstall = pyinstall:Pyinstall',
... 'pyshow = pyshow:Pyshow',
... ]},
... )
... """)
>>> write(sample_buildout, 'recipes', 'README.txt', " ")
>>> write(sample_buildout, 'recipes', 'pyinstall.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyinstall:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
... self.destination = os.path.join(buildout['buildout'][
... 'parts-directory'], self.options.get('python', name))
...
... def install(self):
... for d in [self.destination, os.path.join(self.destination, 'bin')]:
... if not os.path.exists(d):
... os.mkdir(d)
... python = os.path.join(self.destination, 'bin', self.name)
... if not os.path.exists(python):
... shutil.copy(sys.executable, python)
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'recipes', 'pyshow.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyshow:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
...
... def install(self):
... print 'Running with:', sys.executable
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... parts =
... """)
>>> print system(buildout),
Develop: '/sample-buildout/recipes'
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... extensions = slapos.rebootstrap
...
... parts =
... realrun
...
... [rebootstrap]
... section =
... installpython
... version =
... 1
...
... [installpython]
... recipe = recipes:pyinstall
...
... [realrun]
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> import os
>>> os.mkdir('rebootstrap.1.parts')
>>> print system(buildout),
slapos.rebootstrap: Installing section 'installpython' to provide '/sample-buildout/rebootstrap.1.parts/installpython/bin/installpython' in '/sample-buildout/rebootstrap.1.parts'
slapos.rebootstrap: Rerunning buildout to install section installpython with arguments ['/sample-buildout/bin/buildout', 'buildout:parts=installpython', 'buildout:extensions=', '/sample-buildout/rebootstrap.1.parts', 'buildout:installed=.rebootstrap.1.installed.cfg'].
Develop: '/sample-buildout/recipes'
Installing installpython.
slapos.rebootstrap:
************ REBOOTSTRAP: IMPORTANT NOTICE ************
bin/buildout is being reinstalled right now, as new python:
/sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
is available, and buildout is using another python:
/system_python
Buildout will be restarted automatically to have this change applied.
************ REBOOTSTRAP: IMPORTANT NOTICE ************
<BLANKLINE>
Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/recipes'
Installing realrun.
Running with: /sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
Simple case: switch to a Python with same major/minor version
-------------------------------------------------------------
>>> import sys
>>> print system(buildout),
Develop: '/sample-buildout/recipes'
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... extensions = slapos.rebootstrap
... python = installpython
...
... parts =
... realrun
...
... [installpython]
... recipe = recipes:pyinstall
...
... [realrun]
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout),
slapos.rebootstrap: Make sure that the section 'installpython' won't be reinstalled after rebootstrap.
Develop: '/sample-buildout/recipes'
Installing installpython.
slapos.rebootstrap:
************ REBOOTSTRAP: IMPORTANT NOTICE ************
bin/buildout is being reinstalled right now, as new python:
/sample_buildout/parts/installpython/bin/python
is available, and buildout is using another python:
/system_python
Buildout will be restarted automatically to have this change applied.
************ REBOOTSTRAP: IMPORTANT NOTICE ************
<BLANKLINE>
Generated script '/sample-buildout/bin/buildout-rebootstrap'.
Develop: '/sample-buildout/recipes'
Updating installpython.
Installing realrun.
Running with: /sample_buildout/parts/installpython/bin/python
>>> print system(buildout),
Develop: '/sample-buildout/recipes'
Updating installpython.
Updating realrun.
Running with: /sample_buildout/parts/installpython/bin/python
>>> cp(buildout + '-orig', buildout)
>>> print system(buildout),
slapos.rebootstrap: Make sure that the section 'installpython' won't be reinstalled after rebootstrap.
Develop: '/sample-buildout/recipes'
Updating installpython.
slapos.rebootstrap:
************ REBOOTSTRAP: IMPORTANT NOTICE ************
bin/buildout is being reinstalled right now, as new python:
/sample_buildout/parts/installpython/bin/python
is available, and buildout is using another python:
/system_python
Buildout will be restarted automatically to have this change applied.
************ REBOOTSTRAP: IMPORTANT NOTICE ************
<BLANKLINE>
Develop: '/sample-buildout/recipes'
Updating installpython.
Updating realrun.
Running with: /sample_buildout/parts/installpython/bin/python
......@@ -15,15 +15,73 @@ from zope.testing import renormalizing
import doctest
import pkg_resources
import re
import shutil
import sys
import unittest
import zc.buildout
import zc.buildout.testing
import zc.buildout.tests
def _setUp(cp, mkdir, write, buildout, sample_buildout, **kw):
cp(buildout, buildout + '-orig')
mkdir(sample_buildout, 'recipes')
write(sample_buildout, 'recipes', 'setup.py', """
from setuptools import setup
setup(
name = "recipes",
entry_points = {'zc.buildout':[
'pyinstall = pyinstall:Pyinstall',
'pyshow = pyshow:Pyshow',
]},
)
""")
write(sample_buildout, 'recipes', 'README.txt', " ")
write(sample_buildout, 'recipes', 'pyinstall.py', """
import os, zc.buildout, shutil, sys
class Pyinstall:
def __init__(self, buildout, name, options):
self.options = options
options['executable'] = os.path.join(buildout['buildout'][
'parts-directory'], name, 'bin', 'python')
def install(self):
python = self.options['executable']
if not os.path.exists(python):
d = os.path.dirname(python)
os.path.exists(d) or os.makedirs(d)
shutil.copy(sys.executable, python)
return []
update = install
""")
write(sample_buildout, 'recipes', 'pyshow.py', """
import os, zc.buildout, shutil, sys
class Pyshow:
def __init__(self, buildout, name, options):
pass
def install(self):
print 'Running with:', sys.executable
return []
update = install
""")
write(sample_buildout, 'buildout.cfg', """
[buildout]
develop = recipes
parts =
""")
def setUp(test):
zc.buildout.testing.buildoutSetUp(test)
zc.buildout.testing.install_develop('slapos.rebootstrap', test)
test.globs['cp'] = shutil.copy
_setUp(**test.globs)
def test_suite():
# Note: Doctests are used, as this is the good way to test zc.buildout based
......@@ -39,6 +97,7 @@ def test_suite():
(re.compile(sys.executable),
'/system_python'),
zc.buildout.testing.normalize_path,
zc.buildout.testing.not_found,
]),
)
test_list = []
......
Support of upgrade
------------------
>>> import sys
>>> mkdir(sample_buildout, 'recipes')
>>> write(sample_buildout, 'recipes', 'setup.py',
... """
... from setuptools import setup
...
... setup(
... name = "recipes",
... entry_points = {'zc.buildout':[
... 'pyinstall = pyinstall:Pyinstall',
... 'pyshow = pyshow:Pyshow',
... ]},
... )
... """)
>>> write(sample_buildout, 'recipes', 'README.txt', " ")
>>> write(sample_buildout, 'recipes', 'pyinstall.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyinstall:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
... self.destination = os.path.join(buildout['buildout'][
... 'parts-directory'], self.options.get('python', name))
...
... def install(self):
... for d in [self.destination, os.path.join(self.destination, 'bin')]:
... if not os.path.exists(d):
... os.mkdir(d)
... python = os.path.join(self.destination, 'bin', self.name)
... if not os.path.exists(python):
... shutil.copy(sys.executable, python)
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'recipes', 'pyshow.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyshow:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
...
... def install(self):
... print 'Running with:', sys.executable
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... parts =
... """)
>>> print system(buildout),
Develop: '/sample-buildout/recipes'
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... extensions = slapos.rebootstrap
...
... parts =
... realrun
...
... [rebootstrap]
... section =
... installpython
... version =
... 1
...
... [installpython]
... recipe = recipes:pyinstall
...
... [realrun]
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout),
slapos.rebootstrap: Installing section 'installpython' to provide '/sample-buildout/rebootstrap.1.parts/installpython/bin/installpython' in '/sample-buildout/rebootstrap.1.parts'
slapos.rebootstrap: Rerunning buildout to install section installpython with arguments ['/sample-buildout/bin/buildout', 'buildout:parts=installpython', 'buildout:extensions=', '/sample-buildout/rebootstrap.1.parts', 'buildout:installed=.rebootstrap.1.installed.cfg'].
Creating directory '/sample-buildout/rebootstrap.1.parts'.
Develop: '/sample-buildout/recipes'
Installing installpython.
slapos.rebootstrap:
************ REBOOTSTRAP: IMPORTANT NOTICE ************
bin/buildout is being reinstalled right now, as new python:
/sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
is available, and buildout is using another python:
/system_python
Buildout will be restarted automatically to have this change applied.
************ REBOOTSTRAP: IMPORTANT NOTICE ************
<BLANKLINE>
Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/recipes'
Installing realrun.
Running with: /sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... extensions = slapos.rebootstrap
...
... parts =
... realrun
...
... [rebootstrap]
... section =
... installpython
... version =
... 2
...
... [installpython]
... recipe = recipes:pyinstall
...
... [realrun]
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout),
slapos.rebootstrap: Installing section 'installpython' to provide '/sample-buildout/rebootstrap.2.parts/installpython/bin/installpython' in '/sample-buildout/rebootstrap.2.parts'
slapos.rebootstrap: Rerunning buildout to install section installpython with arguments ['/sample-buildout/bin/buildout', 'buildout:parts=installpython', 'buildout:extensions=', '/sample-buildout/rebootstrap.2.parts', 'buildout:installed=.rebootstrap.2.installed.cfg'].
Creating directory '/sample-buildout/rebootstrap.2.parts'.
Develop: '/sample-buildout/recipes'
Installing installpython.
slapos.rebootstrap:
************ REBOOTSTRAP: IMPORTANT NOTICE ************
bin/buildout is being reinstalled right now, as new python:
/sample_buildout/rebootstrap.2.parts/installpython/bin/installpython
is available, and buildout is using another python:
/sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
Buildout will be restarted automatically to have this change applied.
************ REBOOTSTRAP: IMPORTANT NOTICE ************
<BLANKLINE>
Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/recipes'
Updating realrun.
Running with: /sample_buildout/rebootstrap.2.parts/installpython/bin/installpython
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... extensions = slapos.rebootstrap
...
... parts =
... realrun
...
... [rebootstrap]
... section =
... installpython
... version =
... 1
...
... [installpython]
... recipe = recipes:pyinstall
...
... [realrun]
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout),
slapos.rebootstrap:
************ REBOOTSTRAP: IMPORTANT NOTICE ************
bin/buildout is being reinstalled right now, as new python:
/sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
is available, and buildout is using another python:
/sample_buildout/rebootstrap.2.parts/installpython/bin/installpython
Buildout will be restarted automatically to have this change applied.
************ REBOOTSTRAP: IMPORTANT NOTICE ************
<BLANKLINE>
Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/recipes'
Updating realrun.
Running with: /sample_buildout/rebootstrap.1.parts/installpython/bin/installpython
Support of own python path
--------------------------
>>> import sys
>>> mkdir(sample_buildout, 'recipes')
>>> write(sample_buildout, 'recipes', 'setup.py',
... """
... from setuptools import setup
...
... setup(
... name = "recipes",
... entry_points = {'zc.buildout':[
... 'pyinstall = pyinstall:Pyinstall',
... 'pyshow = pyshow:Pyshow',
... ]},
... )
... """)
>>> write(sample_buildout, 'recipes', 'README.txt', " ")
>>> write(sample_buildout, 'recipes', 'pyinstall.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyinstall:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
... self.destination = os.path.join(buildout['buildout'][
... 'parts-directory'], name)
...
... def install(self):
... for d in [self.destination, os.path.join(self.destination, 'bin')]:
... if not os.path.exists(d):
... os.mkdir(d)
... python = self.options.get('python', os.path.join('bin', self.name))
... python = os.path.join(self.destination, python)
... if not os.path.exists(python):
... shutil.copy(sys.executable, python)
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'recipes', 'pyshow.py',
... """
... import os, zc.buildout, shutil, sys
...
... class Pyshow:
...
... def __init__(self, buildout, name, options):
... self.name, self.options = name, options
...
... def install(self):
... print 'Running with:', sys.executable
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... parts =
... """)
>>> print system(buildout),
Develop: '/sample-buildout/recipes'
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... extensions = slapos.rebootstrap
...
... parts =
... realrun
...
... [rebootstrap]
... section =
... installpython
... version =
... 1
... python-path =
... anotherpython
...
... [installpython]
... recipe = recipes:pyinstall
... python = anotherpython
...
... [realrun]
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout),
slapos.rebootstrap: Installing section 'installpython' to provide '/sample-buildout/rebootstrap.1.parts/installpython/anotherpython' in '/sample-buildout/rebootstrap.1.parts'
slapos.rebootstrap: Rerunning buildout to install section installpython with arguments ['/sample-buildout/bin/buildout', 'buildout:parts=installpython', 'buildout:extensions=', '/sample-buildout/rebootstrap.1.parts', 'buildout:installed=.rebootstrap.1.installed.cfg'].
Creating directory '/sample-buildout/rebootstrap.1.parts'.
Develop: '/sample-buildout/recipes'
Installing installpython.
slapos.rebootstrap:
************ REBOOTSTRAP: IMPORTANT NOTICE ************
bin/buildout is being reinstalled right now, as new python:
/sample_buildout/rebootstrap.1.parts/installpython/anotherpython
is available, and buildout is using another python:
/system_python
Buildout will be restarted automatically to have this change applied.
************ REBOOTSTRAP: IMPORTANT NOTICE ************
<BLANKLINE>
Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/recipes'
Installing realrun.
Running with: /sample_buildout/rebootstrap.1.parts/installpython/anotherpython
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