[Zope3-Users] Re: How to organize common code for Z2 and Z3

Philipp von Weitershausen philipp at weitershausen.de
Fri Apr 15 08:56:13 EDT 2005


Lennart Regebro wrote:
>>I think the trick would be to write code for Zope 3 and put it
>>in a top-level package, like "textindexng". Inside this package you add a
>>package "TextIndexNG" that is expected to be added to Zope 2's
>>lib/python/Products.
> 
> 
> Seems reasonable. But my gut reaction is to have this type of cvs/svn layout:
> 
> TextIndexNG/
> TextIndexNG/setup.py # distutils stuff
> TextIndexNG/TextIndexNG # for Zope2
> TextIndexNG/src
> TextIndexNG/src/textindexng
> 
> That way you just check it out and tar it for distrubution.
> 
> You install it for zope3 with "python setup.py". setup.py will be
> constructed to completely ignores everything in
> TextIndexNG/TextIndexNG.
> 
> You install it for Zope2 by copying TextIndexNG/TextIndexNG to
> Products and running distutils again.
> 
> If src/textindexng is all python and no C or other funny business you
> could actually copy it to Products/TextIndexNG/ as well. If that is
> the case, as Zope2 distribution with that layout could be provided as
> well.

Well, actually, if there's no reason to have something in 
Products/TextIndexNG, then you don't actually need anything in the good 
ol' Products directory. In other words, if TNG3 contains no Zope 
2-specific code and Products/TextIndexNG would just be a facade anyway, 
it really only needs to be a top-level package.

You can load top-level packages through Zope3-style package-includes 
ZCML slugs in Five, too. You simply need to copy Five/skel/* to your 
$INSTANCE/etc directory...

Philipp



More information about the Zope3-users mailing list