Add --without-speedups option.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 25 Jan 2010 09:10:07 +0000 (10:10 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 25 Jan 2010 09:10:07 +0000 (10:10 +0100)
NEWS
setup.py

diff --git a/NEWS b/NEWS
index 63069b26484e75e730239b0c500599434676c5d5..e0fb9c5555c91724ec11238a6d221b316d9bffff 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,11 @@
 
   * Support custom fields in commits.
 
+ FEATURES
+
+  * --without-speedups option to setup.py to allow building/installing 
+    without the C extensions. (Hal Wine, Jelmer Vernooij)
+
 0.4.1  2010-01-03
 
  FEATURES
index 2bac894e436b4804d8edeba81a1dff373550f1fd..7f87c018e83616e02b73c31db7bc57640b3c65f3 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -3,10 +3,9 @@
 # Copyright (C) 2008-2009 Jelmer Vernooij <jelmer@samba.org>
 
 try:
-    from setuptools import setup
+    from setuptools import setup, Extension
 except ImportError:
-    from distutils.core import setup
-from distutils.extension import Extension
+    from distutils.core import setup, Extension
 
 dulwich_version_string = '0.4.2'
 
@@ -16,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',
@@ -33,10 +52,6 @@ setup(name='dulwich',
       """,
       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,
       )