Re: env var support for zc.buildout

Florian Friesdorf <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
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 <[email protected]>
  GPG FPR: EA5C F2B4 FBBB BA65 3DCD  E8ED 82A1 6522 4A1F 4367
Jabber/XMPP: [email protected]
  OTR FPR: 9E191746 213321FE C896B37D 24B118C0 31785700
IRC: chaoflow on freenode,ircnet,blafasel,OFTC

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEABECAAYFAku92uYACgkQgqFlIkofQ2cjuQCdHgCQmiD6TnEBs3w3SmmPvKIs
v7wAn3DIKxAeem3Nwn921SC1FYRlqMB1
=H8ge
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.