On 6/28/06, Robert Kern <[EMAIL PROTECTED]> 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: > have_setuptools = True > from setuptools import setup as old_setup > else: > have_setuptools = False > from distutils.core import setup as old_setup > > 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: - from setuptools import setup as old_setup - # very old setuptools don't have this - from setuptools.command import bdist_egg - # easy_install imports math, it may be picked up from cwd - from setuptools.command import develop, easy_install - have_setuptools = 1 -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: + try: + from setuptools import setup as old_setup + # very old setuptools don't have this + from setuptools.command import bdist_egg + # easy_install imports math, it may be picked up from cwd + from setuptools.command import develop, easy_install + except ImportError: + # Any failure here is probably due to an old or broken setuptools + # leftover in sys.modules, so treat it as if it simply weren't + # available. + have_setuptools = False + +# If setuptools was flagged as unavailable due to import problems, we need the +# basic distutils support +if not have_setuptools: from distutils.core import setup as old_setup - have_setuptools = 0 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 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion