[Zope-dev] Re: Mixing recipes (zc.recipe.cmmi reuse)

2007-09-24 Thread Jim Fulton


On Sep 18, 2007, at 6:25 PM, Sidnei da Silva wrote:


Hi there,

Not sure this is the right list, but let's give it a try.

I would like to use the 'patches' functionality from zc.recipe.cmmi
together with other recipes. I believe this is useful functionality
and is interesting to all sorts of recipes, not only to cmmi-based
ones.

So the question is, does the zc.buildout architecture support reusing
options from a recipe on other recipes?


It is just Python.  Buildout doesn't provide any support fro this  
because it isn't really needed.



Or would it require the recipe
writer to explicitly 'subclass' (?) cmmi to get patch functionality?


I prefer composition. A number of recipes reuse the egg recipe  
through composition.


Generally, an egg will need to explicitly provide a Python API for  
other eggs. See, for example, http://pypi.python.org/pypi/ 
zc.recipe.egg/1.0.0b6#egg-recipe-api-for-other-recipes



Or even, would a 'post-fetch'/'pre-build' generalization be desired,
'patch' being one such application?


I have no idea what that is. :)

Jim

--
Jim Fulton
Zope Corporation


___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Re: Mixing recipes (zc.recipe.cmmi reuse)

2007-09-24 Thread Sidnei da Silva
On 9/24/07, Jim Fulton [EMAIL PROTECTED] wrote:
  Or would it require the recipe
  writer to explicitly 'subclass' (?) cmmi to get patch functionality?

 I prefer composition. A number of recipes reuse the egg recipe
 through composition.

 Generally, an egg will need to explicitly provide a Python API for
 other eggs. See, for example, http://pypi.python.org/pypi/
 zc.recipe.egg/1.0.0b6#egg-recipe-api-for-other-recipes

Gotcha, that makes sense.

  Or even, would a 'post-fetch'/'pre-build' generalization be desired,
  'patch' being one such application?

 I have no idea what that is. :)

My intent is:

Given any recipe, no matter where data is coming from (be it an egg
in PyPI, a Subversion checkout or a tarball), I would like to be able
to perform an operation in the 'local copy' of the data, without
depending on the person that wrote the recipe to have allowed me to do
so

An example being, after a recipe that does a Subversion checkout runs,
my custom operation kicks in and applies a patch to the local copy
before the buildout processing continues.

I believe that this might be doable today by writing custom
configuration, but maybe it's such a common case that could be
simplified.

Maybe something along the lines of (note: this is all pseudo-config):


[Step1]
recipe = some.recipe.checkout
url = svn://url-to-repo/package

[Step2]
recipe = zc.recipe.cmmi
source = {Step1:location}
patch = /path/to/my/patch

[zope2]
products = {Step2:location}


I believe that something like this might already work today, if not it
might be easy to make it work that way. But what I'm after is to avoid
Step2 above by listing the patch to be applied in Step1 even if
'some.recipe.checkout' does not support the 'patch' option directly.

All in all, if you tell me that the hypotetical Step2 above really
can't be avoided and that the best option is to make
'some.recipe.checkout' and any other recipes out support the 'patch'
option directly, I would be fine with that too.

Does it make more sense now?

-- 
Sidnei da Silva
Enfold Systemshttp://enfoldsystems.com
Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Re: Mixing recipes (zc.recipe.cmmi reuse)

2007-09-24 Thread Martin Aspeli

Sidnei da Silva wrote:


My intent is:

Given any recipe, no matter where data is coming from (be it an egg
in PyPI, a Subversion checkout or a tarball), I would like to be able
to perform an operation in the 'local copy' of the data, without
depending on the person that wrote the recipe to have allowed me to do
so

An example being, after a recipe that does a Subversion checkout runs,
my custom operation kicks in and applies a patch to the local copy
before the buildout processing continues.

I believe that this might be doable today by writing custom
configuration, but maybe it's such a common case that could be
simplified.

Maybe something along the lines of (note: this is all pseudo-config):


[Step1]
recipe = some.recipe.checkout
url = svn://url-to-repo/package

[Step2]
recipe = zc.recipe.cmmi
source = {Step1:location}


Do ${Step1:location}


patch = /path/to/my/patch

[zope2]
products = {Step2:location}


I believe that something like this might already work today,


It does. Again, this is just Python. You have a dict-like variable 
'buildout' passed to your recipe's __init__(). This has keys for each 
section, which contains a dict with keys for each option. So above, you 
could address buildout['Step1']['url'], say. You can also put things 
into this dict-of-dicts. Once a recipe has been run, subsequent recipes 
will be able to see things put into the dict.



if not it
might be easy to make it work that way. But what I'm after is to avoid
Step2 above by listing the patch to be applied in Step1 even if
'some.recipe.checkout' does not support the 'patch' option directly.


How would you avoid naming conflicts? How would you declare where that 
option comes from? I really don't think the overhead of having to 
specify a new recipe (as in your Step2 above) is very much, and it's a 
lot more explicit.



All in all, if you tell me that the hypotetical Step2 above really
can't be avoided and that the best option is to make
'some.recipe.checkout' and any other recipes out support the 'patch'
option directly, I would be fine with that too.


I'd suggest that's the best way. Only a limited number of recipes would 
really need 'path' - those could re-use your patch recipe via 
composition if necessary, but you have a fallback of using the recipe on 
its own.


Martin


--
Acquisition is a jealous mistress

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Re: Mixing recipes (zc.recipe.cmmi reuse)

2007-09-18 Thread Martin Aspeli

Sidnei da Silva wrote:

Hi there,

Not sure this is the right list, but let's give it a try.

I would like to use the 'patches' functionality from zc.recipe.cmmi
together with other recipes. I believe this is useful functionality
and is interesting to all sorts of recipes, not only to cmmi-based
ones.

So the question is, does the zc.buildout architecture support reusing
options from a recipe on other recipes? Or would it require the recipe
writer to explicitly 'subclass' (?) cmmi to get patch functionality?
Or even, would a 'post-fetch'/'pre-build' generalization be desired,
'patch' being one such application?


I've seen subclassing, or explicit instantiation, e.g. instantiate the 
dependent recipe class as an instance variable and just call its 
methods. I don't think you really need any magic from buildout here. 
Recipes are pretty simple Python classes. Just make sure you pass the 
options etc from __init__.py and you should be fine.


I think plone.recipe.plone uses plone.recipe.distro and plone.recipe.egg 
in various ways. You may want to look at that.


Martin

--
Acquisition is a jealous mistress

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )