[ZODB-Dev] RE: [Zope-Coders] revising layout of ZODB3 checkout

Jeremy Hylton jeremy at alum.mit.edu
Fri Jan 9 09:52:39 EST 2004


On Fri, 2004-01-09 at 01:04, Tim Peters wrote:
> [Fred L. Drake, Jr.]
> > ...
> > The current ZODB3 layout works because it matches what distutils
> > expects; I don't see any motivation to change it.
> 
> The motivation is what Jeremy said at the very start:  on the zodb-dev list,
> 
>     I ran the tests and they were OK.  Then I tried "import ZODB",
>     but it blew up with "ImportError: No module named cPersistence" --
>     eh?
> 
> is the most frequent of FAQs, from people using a ZODB3 checkout.  That
> problem doesn't exist if you do "build_ext -i", but does if you use "build".
> OTOH, unlike as in Zope2 and Zope3, ZODB3's test.py doesn't work if you use
> "build_ext -i".

I'd like to revise the initial problem statement.  It's actually people
who run "python setup.py install" that have problems.  If you just run
install, distuils runs the build command, then puts everything in
site-packages.  If you do that and then fire up a Python interpreter
from the same directory, you run into the problem.  There is a ZODB
package in site-packages, but Python finds the uncompiled source
directory first and tries to use it.

Even if you use build_ext -i to build and test ZODB, the install command
will still run build first and install from that.

That's what I was getting at when I said that build was the distutils
default.  It's deeply ingrained in distutils' notion of how to build and
install packages.  I'd rather play along with that notion, which ought
to make it easier for end users:  "Oh, it's get a setup.py.  I know how
that works."

Fred worried about the extra distutils cruft (and I would include
test.py cruft) that is a little different in every project.  If we make
ZODB3 and Zope3 use the same layout, I hope we can cut down on the
amount of variation.  I would expect we could use most of the same
tricks for the two packages if they both used a "src" directory.

Certainly, the Zope3 test.py works with an in-place build and a src
directory.  We would need to sync Zope3 and ZODB3's test.py scripts to
make sure they both handled it in the same way.

We would also change ZODB3's setup.py to have a package_dir argument to
setup() -- package_dir = {"": "src"}.  That says to look for all
packages in a directory named "src;" the empty string as a key is a
wildcard.

Jeremy





More information about the ZODB-Dev mailing list