[Distutils] zc.buildout: Declare options in a recipe and use it in another recipe

Udo Spallek udono at gmx.net
Tue Aug 10 16:27:50 CEST 2010


Hello,

like to write a custom recipe. The recipe should be able to introduce a
new variable (or option) which can be used in another part of
buildout.cfg.
I try to catch this with the buildout.cfg and recipe attached below. The
recipe is found, installed and called with part1 right before part2. So
far so good.

My problem is in part2.  New_option is always empty and not filled with
the result (testresult) in recipe test-new-option. 

How can I declare and transport options from one recipe script to
another?

Regards Udo

Sample buildout.cfg

[buildout]
parts = 
    part1
    part2

[part1]
recipe = recipes:test-new-option

[part2]
recipe = collective.recipe.template == 1.8
new_option = ${part1:new_option}
...

----

Recipe: test-new-option:

class TestNewOption(object):
    """zc.buildout recipe"""

    def __init__(self, buildout, name, options):
        self.buildout, self.name, self.options = buildout, name, options

    def install(self):
        """Installer"""
        # Does not work:
        self.options['new_option'] = 'testresult'
        return tuple()

    def update(self):
        """Updater"""
        pass



More information about the Distutils-SIG mailing list