[Numpy-discussion] Setuptools leftover junk

David M. Cooke cookedm at physics.mcmaster.ca
Wed Jun 28 15:37:34 EDT 2006


On Wed, 28 Jun 2006 13:18:35 -0600
"Fernando Perez" <fperez.net at gmail.com> wrote:

> On 6/28/06, David M. Cooke <cookedm at physics.mcmaster.ca> wrote:
> 
> > Done. I've also added a 'setupegg.py' module that wraps running 'setup.py'
> > with an import of setuptools (it's based on the one used in matplotlib).
> >
> > easy_install still works, also.
> 
> You beat me to it :)
> 
> However, your patch has slightly different semantics from mine: if
> bdist_egg fails to import, the rest of setuptools is still used.  I
> don't know if that's safe.  My patch would consider /any/ failure in
> the setuptools imports as a complete setuptools failure, and revert
> out to basic distutils.

Note that your patch will still import setuptools if the import of bdist_egg
fails. And you can't get around that by putting the bdist_egg import first,
as that imports setuptools first.

(I think bdist_egg was added sometime after 0.5; if your version of
setuptools is *that* old, you'd be better off not having it installed.)

The use of setuptools by numpy.distutils is in two forms: explicitly
(controlled by this patch of code), and implicitly (because setuptools goes
and patches distutils). Disabling the explicit use won't actually fix your
problem with the 'install' command leaving .egg_info directories (which,
incidentally, are pretty small), as that's done by the implicit behaviour.

[Really, distutils sucks. I think (besides refactoring) it needs it's API
documented better, or least good conventions on where to hook into.
setuptools and numpy.distutils do their best, but there's only so much you
can do before everything goes fragile and breaks in unexpected ways.]

With the "if 'setuptools' in sys.modules" test, if you *are* using
setuptools, you must have explicitly requested that, and so I think a failure
on import of setuptools shouldn't be silently passed over.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca




More information about the NumPy-Discussion mailing list