[Distutils] setuptools special case Pyrex and break Cython

Stefan Behnel stefan_ml at behnel.de
Mon Sep 3 18:51:57 CEST 2007


Phillip J. Eby wrote:
> At 06:21 PM 9/3/2007 +0200, Stefan Behnel wrote:
>> The point is that current setuptools break developer builds. You
>> can't change the sources without having (a fake) Pyrex installed, because
>> setuptools will not let you run Cython.
> 
> If you want to use the native Extension type, do this:
> 
>    from distutils.core import Extension
>    from setuptools import setup

Have you tested this lately? I mean, with Python 2.5 distutils?

What I get is

Traceback (most recent call last):
  File "setup.py", line 89, in <module>
    **extra_options
  File "distutils/core.py", line 151, in setup
  File "distutils/dist.py", line 974, in run_commands
  File "distutils/dist.py", line 994, in run_command
  File "distutils/command/build_ext.py", line 290, in run
  File "distutils/command/build_ext.py", line 413, in build_extensions
  File "distutils/command/build_ext.py", line 315, in check_extensions_list
TypeError: iteration over non-sequence

this is the failing code:

            if isinstance(ext, Extension):
                continue                # OK! (assume type-checking done
                                        # by Extension constructor)
==>         (ext_name, build_info) = ext


> Alternately, you can use:
> 
>    from setuptools.extension _import Extension as Extension

I assume you meant

    from setuptools.extension import _Extension as Extension

That's definitely a hack, but it yields the same error as above.


> I will add this information to the existing setuptools documentation
> regarding Pyrex detection.
> 
> Meanwhile, if you'd like to suggest a way of detecting Cython's
> presence, I can probably add that to the setuptools.extension module.

    import Cython

should do the trick.

I still prefer the "only fiddle with extensions if build_ext wasn't replaced"
way, though.

Stefan


More information about the Distutils-SIG mailing list