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
-------------
"""
-# 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
)
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 = []
VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read()).group(1)
v.close()
-
setup(name = "SQLAlchemy",
version = VERSION,
description = "Database Abstraction Library",
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',