[Numpy-discussion] Setuptools leftover junk (original) (raw)

Fernando Perez fperez.net at gmail.com
Wed Jun 28 15:11:36 EDT 2006


On 6/28/06, Robert Kern <robert.kern at gmail.com> wrote:

numpy.distutils uses setuptools if it is importable in order to make sure that the two don't stomp on each other. It's probable that that test could probably be done with Andrew Straw's method:

if 'setuptools' in sys.modules: havesetuptools = True from setuptools import setup as oldsetup else: havesetuptools = False from distutils.core import setup as oldsetup Tested patches welcome.

Well, tested as in 'I wrote a unittest for installation', no. But tested as in 'I built numpy, scipy, matplotlib, and my f2py-using code', yes. They all build/install fine, and no more *egg-info directories are strewn around.

If this satisfies your 'tested patches', the code is:

Index: numpy/distutils/core.py

--- numpy/distutils/core.py (revision 2698) +++ numpy/distutils/core.py (working copy) @@ -1,16 +1,30 @@

import sys from distutils.core import * -try:

-except ImportError: + +# Don't pull setuptools in unless the user explicitly requests by having it +# imported (Andrew's trick). +have_setuptools = 'setuptools' in sys.modules + +# Even if setuptools is in, do a few things carefully to make sure the version +# is recent enough to have everything we need before assuming we can proceed +# using setuptools throughout +if have_setuptools:

+# basic distutils support +if not have_setuptools: from distutils.core import setup as old_setup

from numpy.distutils.extension import Extension from numpy.distutils.command import config

May I?

keeping-the-world-setuptools-free-one-script-at-a-time-ly yours,

f



More information about the NumPy-Discussion mailing list