[Zope-dev] env var support for zc.buildout

Florian Friesdorf flo at chaoflow.net
Thu Apr 8 09:32:22 EDT 2010


On Thu, Apr 08, 2010 at 02:24:53PM +0200, Christian Theune wrote:
> Hi,
> 
> On 04/08/2010 12:59 PM, Florian Friesdorf wrote:
> > On Thu, Apr 08, 2010 at 08:56:18AM +0200, Christian Theune wrote:
> >> On 04/08/2010 04:27 AM, Florian Friesdorf wrote:
> >>> environment variable support for zc.buildout, including extends!
> >>>
> >>> https://bugs.launchpad.net/zc.buildout/+bug/557769
> >>>
> >>> works for me so far
> 
> Actually the env recipe was more of a hack to get going and then we 
> forgot to propose getting it into buildout.
> 
> OTOH handling it as a recipe allows for some other nice tricks, e.g. 
> overriding by extensions.
> 
> Maybe a specialised part-name, like versions would be helpful so that 
> buildout could pre-populate that part during initialisation and then 
> allow configurations to override individual values.

that would be nice indeed, but again would not work for extends

We currently use it for 5 very similar sites that share one repository
but use 5 checkouts of it:

base.cfg
[buildout]
parts = instance

develop = ...
eggs = ...
zcml = ...

[instance]
...


site-1.cfg
[buildout]
eggs +=
zcml +=


testenv.cfg
[buildout]
extends =
    base.cfg
    ${env:site}.cfg

<stuff for testenv>


deploy.cfg
[buildout]
extends =
    base.cfg
    ${env:site}.cfg

<stuff for deploy>


% site=site-1 ./bin/buildout -c deploy.cfg

> On your specific patch: you sure about that direct regex match for the 
> expanding variables in the extends option?

I'd prefer using the logic from Options, but that relies on
self.buildout being an actual buildout already. I patched that up and
actually succeeded to use Options for extends, but had some failing
tests.

The direct regex is only used at _open-time on extends.

The only thing coming to my mind, why one would avoid a direct regex, is
performance and the performance penalty should be minimal like that.
However, I'm happy to be told different.

> I wonder what Jim thinks about the topic.

me too

> >> Uhm ... interesting. I never noticed our recipe not to work with
> >> extends. Can you give me an example?
> >
> > actually, i just assumed from looking at buildout.py - extends is
> > processed before the whole Buildout ist up. As far as I understand your
> > recipe is not even loaded when buildout would need that variable lookup.
> >
> > But, I saw you recipe after I implemented and never tried it...
> 
> I just played with that scenario. Something that doesn't work with our 
> recipe:
> 
> a.cfg:
> [buildout]
> parts = x
>  
> 
> [x]
> recipe = zc.recipe.egg
> eggs = zope.interface
> foo = ${env:bar}
> 
> buildout.cfg:
> [buildout]
> extends = a.cfg
>  
> 
> [env]
> recipe = gocept.recipe.env

In the tests contained in the patches are even more sophisticated
scenarios :)

-- 
Florian Friesdorf <flo at chaoflow.net>
  GPG FPR: EA5C F2B4 FBBB BA65 3DCD  E8ED 82A1 6522 4A1F 4367
Jabber/XMPP: flo at chaoflow.net
  OTR FPR: 9E191746 213321FE C896B37D 24B118C0 31785700
IRC: chaoflow on freenode,ircnet,blafasel,OFTC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20100408/67481870/attachment.bin 


More information about the Zope-Dev mailing list