[Numpy-discussion] Setuptools leftover junk (original) (raw)
Fernando Perez fperez.net at gmail.com
Wed Jun 28 15:11:36 EDT 2006
- Previous message (by thread): [Numpy-discussion] Setuptools leftover junk
- Next message (by thread): [Numpy-discussion] explanation of 'order' parameter for reshape
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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:
- 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
- Previous message (by thread): [Numpy-discussion] Setuptools leftover junk
- Next message (by thread): [Numpy-discussion] explanation of 'order' parameter for reshape
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]