]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
use a flag to build cextensions (thanks again to Genshi for the tip)
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 5 Mar 2010 15:33:21 +0000 (15:33 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 5 Mar 2010 15:33:21 +0000 (15:33 +0000)
README
setup.py

diff --git a/README b/README
index 4bbdd20a116d3eb1aac6ec77f1758b6a8a3d5096..ad618ad39f3fa934e0d33a0abf9a649e104bed3e 100644 (file)
--- a/README
+++ b/README
@@ -38,11 +38,13 @@ path.
 Installing the C extension
 --------------------------
 
-Edit "setup.py" and set ``BUILD_CEXTENSIONS`` to ``True``, then install it as
-above. If you want only to build the extension and not install it, you can do
-so with::
+If installing with Setuptools or Distribute, the C extensions are built 
+and installed using the --with-cextensions flag:
 
-  python setup.py build
+  python setup.py --with-cextensions install
+
+If using plain Distutils, change the BUILD_CEXTENSIONS flag in setup.py
+to "True".
 
 Running Tests
 -------------
index 37fc606f2ffeca9b63f31a21a427d54aa6972bfb..dd75c6fc65f70e2700a55a34754ff25388a28e97 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -4,8 +4,9 @@ Please see README for basic installation instructions.
 
 """
 
-# set this flag to True to compile
-# C extensions
+# If using distutils (not distribute/setuptools),
+# set this flag to True to compile C extensions.
+# Otherwise use --with-cextensions
 BUILD_CEXTENSIONS = False
 
 import os
@@ -25,10 +26,33 @@ if sys.version_info >= (3, 0):
     )
 
 try:
-    from setuptools import setup, Extension
+    from setuptools import setup, Extension, Feature
 except ImportError:
     from distutils.core import setup, Extension
+    Feature = None
 
+if Feature:
+    extra.update(
+        features = {'cextensions' : Feature(
+            "optional C speed-enhancements",
+            standard = False,
+            ext_modules = [
+                Extension('sqlalchemy.cprocessors',
+                       sources=['lib/sqlalchemy/cextension/processors.c']),
+                Extension('sqlalchemy.cresultproxy',
+                       sources=['lib/sqlalchemy/cextension/resultproxy.c'])
+            ],
+        )}
+    )
+elif BUILD_CEXTENSIONS:
+    extra.update(
+        ext_modules = [
+                Extension('sqlalchemy.cprocessors',
+                      sources=['lib/sqlalchemy/cextension/processors.c']),
+                Extension('sqlalchemy.cresultproxy',
+                      sources=['lib/sqlalchemy/cextension/resultproxy.c'])
+            ]
+    )
 
 def find_packages(dir_):
     packages = []
@@ -45,7 +69,6 @@ v = open(os.path.join(os.path.dirname(__file__), 'lib', 'sqlalchemy', '__init__.
 VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read()).group(1)
 v.close()
 
-
 setup(name = "SQLAlchemy",
       version = VERSION,
       description = "Database Abstraction Library",
@@ -57,12 +80,6 @@ setup(name = "SQLAlchemy",
       license = "MIT License",
       tests_require = ['nose >= 0.11'],
       test_suite = "nose.collector",
-      ext_modules = (BUILD_CEXTENSIONS and
-                     [Extension('sqlalchemy.cprocessors',
-                                sources=['lib/sqlalchemy/cextension/processors.c']),
-                      Extension('sqlalchemy.cresultproxy',
-                                sources=['lib/sqlalchemy/cextension/resultproxy.c'])
-                                ]),
       entry_points = {
           'nose.plugins.0.10': [
               'sqlalchemy = sqlalchemy.test.noseplugin:NoseSQLAlchemy',