setuptools has removed Feature

Issue #2986 resolved
Mike Bayer repo owner created an issue

lets wait and see if there's another way to get this, otherwise we have to take the --without-cextensions flag out of the documentation.

backport to 0.8, 0.7

diff --git a/doc/build/changelog/changelog_07.rst b/doc/build/changelog/changelog_07.rst
index da89bbd..14849fe 100644
--- a/doc/build/changelog/changelog_07.rst
+++ b/doc/build/changelog/changelog_07.rst
@@ -7,6 +7,15 @@
     :version: 0.7.11

     .. change::
+        :tags: bug, general
+        :versions: 0.8.6, 0.9.4
+
+        Made a critical fix in the ``setup.py`` file due to the removal
+        of the ``setuptools.Feature`` extension.  For the moment,
+        the ``--without-cextensions`` flag will not function with
+        the latest versions of setuptools.
+
+    .. change::
         :tags: bug, engine
         :tickets: 2851
         :versions: 0.8.3, 0.9.0b1
diff --git a/setup.py b/setup.py
index f682081..0b32522 100644
--- a/setup.py
+++ b/setup.py
@@ -11,8 +11,13 @@ from distutils.command.build_ext import build_ext
 from distutils.errors import (CCompilerError, DistutilsExecError,
                               DistutilsPlatformError)
 try:
-    from setuptools import setup, Extension, Feature
+    from setuptools import setup, Extension
     has_setuptools = True
+
+    try:
+        from setuptools import Feature
+    except ImportError:
+        Feature = None
 except ImportError:
     has_setuptools = False
     from distutils.core import setup, Extension

Comments (5)

  1. Mike Bayer reporter
    • changed status to open

    Based on recent discussions I think we should plan to move away from Feature in any case as it seems like setuptools still wants to get rid of it. We should implement and document a simple environment variable check for "no c extensions" and backport this to 0.8 and 0.7.

    it also might be nice to start getting windows builds up on pypi at some point.

  2. Mike Bayer reporter
    • Adjusted setup.py file to support the possible future removal of the setuptools.Feature extension from setuptools. If this keyword isn't present, the setup will still succeed with setuptools rather than falling back to distutils. C extension building can be disabled now also by setting the DISABLE_SQLALCHEMY_CEXT environment variable. This variable works whether or not setuptools is even available. fixes #2986
    • using platform.python_implementation() in setup.py to detect CPython. I've tested this function on OSX and linux on Python 2.6 through 3.4, including 3.1, 3.2, 3.3. Unfortunately, on OSX + 3.2 only, it seems to segfault. I've tried installing 3.2.5 from the python.org .dmg, building it from source, and also blew away the whole 3.2 directory, something seems to be wrong with the "platform" module on that platform only, and there's also no issue on bugs.python.org; however, I'm going with it anyway. If someone is using 3.2 on OSX they really should be upgrading.

    → <<cset ec97911ed915>>

  3. Mike Bayer reporter
    • Adjusted setup.py file to support the possible future removal of the setuptools.Feature extension from setuptools. If this keyword isn't present, the setup will still succeed with setuptools rather than falling back to distutils. C extension building can be disabled now also by setting the DISABLE_SQLALCHEMY_CEXT environment variable. This variable works whether or not setuptools is even available. fixes #2986
    • using platform.python_implementation() in setup.py to detect CPython. I've tested this function on OSX and linux on Python 2.6 through 3.4, including 3.1, 3.2, 3.3. Unfortunately, on OSX + 3.2 only, it seems to segfault. I've tried installing 3.2.5 from the python.org .dmg, building it from source, and also blew away the whole 3.2 directory, something seems to be wrong with the "platform" module on that platform only, and there's also no issue on bugs.python.org; however, I'm going with it anyway. If someone is using 3.2 on OSX they really should be upgrading.
    • adjusted the logic for platform_implementation(), apparently "platform" is there in python 2.5, so we are doing a version check. Conflicts: doc/build/intro.rst setup.py

    → <<cset 0dddcf924ead>>

  4. Log in to comment