[Distutils] Oddities in setuptools/distribute

Barry Warsaw barry at python.org
Tue Oct 5 22:31:06 CEST 2010


I'm working on some patches that allow for multiple builds of Python with
different options to coexist.  This is an extension to PEP 3149 and has been
discussed recently in python-dev:

http://mail.python.org/pipermail/python-dev/2010-October/104382.html

This has led me into the twisty maze of setuptools and distribute:

http://mail.python.org/pipermail/python-dev/2010-October/104430.html

I believe I've figured out a patch that *should* make this work, but doesn't,
and I have a few questions about some things I've noticed:

1) Why does setuptools write a stub loader for the .so in the first place?
   Why not just let the import of the shared library happen directly using the
   normal Python import rules?

   I had thought that build_ext.py was the place to modify but it turns out (I
   think) build_ext's stub writer only gets called when building an extension
   inplace.  Since I'm trying to install an extension, it's actually
   bdist_egg's stub writer that gets called.

2) Why does build_ext.py and bdist_egg.py have similar but slightly different
   stub writers?

   I'm sure there's an important reason for this, but at least in the case of
   shared library loading, it seems like the two stubs ought to be more
   similar than they are.

3) Why does site-packages/<package>.egg/ get deleted when the package is
   re-installed?  Can this be prevented?

   This is actually the show-stopper I'm stuck on because if I install my
   extension with build-A of Python, then try to install it with build-B of
   Python, the build-A version gets wiped.  Because the shared libraries now
   have build-flag discriminators in the file name, the two installs *should*
   be able to coexist, with this diff against distribute-0.6.15dev, but the
   blowing away of the .egg directory prevents this.

   http://pastebin.ubuntu.com/506759/

Thanks for any feedback you can provide.
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20101005/e1d91c49/attachment.pgp>


More information about the Distutils-SIG mailing list