Add --without-speedups option.
[jelmer/dulwich-libgit2.git] / setup.py
index b8e29f93d11a9b3377771519a04d977fd38997de..7f87c018e83616e02b73c31db7bc57640b3c65f3 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -2,10 +2,12 @@
 # Setup file for bzr-git
 # Copyright (C) 2008-2009 Jelmer Vernooij <jelmer@samba.org>
 
-from distutils.core import setup
-from distutils.extension import Extension
+try:
+    from setuptools import setup, Extension
+except ImportError:
+    from distutils.core import setup, Extension
 
-dulwich_version_string = '0.3.4'
+dulwich_version_string = '0.4.2'
 
 include_dirs = []
 # Windows MSVC support
@@ -13,6 +15,26 @@ import sys
 if sys.platform == 'win32':
     include_dirs.append('dulwich')
 
+ext_modules = [
+    Extension('dulwich._objects', ['dulwich/_objects.c'],
+              include_dirs=include_dirs),
+    Extension('dulwich._pack', ['dulwich/_pack.c'],
+              include_dirs=include_dirs),
+    ]
+
+try:
+    from setuptools import Feature
+except ImportError:
+    speedups = None
+    mandatory_ext_modules = ext_modules
+else:
+    mandatory_ext_modules = []
+    speedups = Feature(
+        "optional C speed-enhancements",
+        standard = True,
+        ext_modules=ext_modules,
+    )
+
 
 setup(name='dulwich',
       description='Pure-Python Git Library',
@@ -24,16 +46,12 @@ setup(name='dulwich',
       author='Jelmer Vernooij',
       author_email='jelmer@samba.org',
       long_description="""
-      Simple Pure-Python implementation of the Git file formats and 
-      protocols. Dulwich is the place where Mr. and Mrs. Git live 
+      Simple Pure-Python implementation of the Git file formats and
+      protocols. Dulwich is the place where Mr. and Mrs. Git live
       in one of the Monty Python sketches.
       """,
       packages=['dulwich', 'dulwich.tests'],
       scripts=['bin/dulwich', 'bin/dul-daemon'],
-      ext_modules=[
-          Extension('dulwich._objects', ['dulwich/_objects.c'],
-                    include_dirs=include_dirs),
-          Extension('dulwich._pack', ['dulwich/_pack.c'],
-                    include_dirs=include_dirs),
-          ],
+      features = {'speedups': speedups},
+      ext_modules = mandatory_ext_modules,
       )