Log message for revision 76208:
  backported btree fixes
  

Changed:
  U   Zope/branches/Zope211-3.4-integration/setup.py

-=-
Modified: Zope/branches/Zope211-3.4-integration/setup.py
===================================================================
--- Zope/branches/Zope211-3.4-integration/setup.py      2007-06-03 11:55:42 UTC 
(rev 76207)
+++ Zope/branches/Zope211-3.4-integration/setup.py      2007-06-03 12:27:07 UTC 
(rev 76208)
@@ -307,29 +307,6 @@
                        'ExtensionClass/pickle/pickle.c',
                        'Acquisition/Acquisition.h']),
 
-    # BTrees
-    Extension(name='BTrees._OOBTree',
-              include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
-              sources=['BTrees/_OOBTree.c']),
-    Extension(name='BTrees._OIBTree',
-              include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
-              sources=['BTrees/_OIBTree.c']),
-    Extension(name='BTrees._IIBTree',
-              include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
-              define_macros=[('EXCLUDE_INTSET_SUPPORT', None)],
-              sources=['BTrees/_IIBTree.c']),
-    Extension(name='BTrees._IOBTree',
-              include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
-              define_macros=[('EXCLUDE_INTSET_SUPPORT', None)],
-              sources=['BTrees/_IOBTree.c']),
-    Extension(name='BTrees._IFBTree',
-              include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
-              define_macros=[('EXCLUDE_INTSET_SUPPORT', None)],
-              sources=['BTrees/_IFBTree.c']),
-    Extension(name='BTrees._fsBTree',
-              include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
-              define_macros=[('EXCLUDE_INTSET_SUPPORT', None)],
-              sources=['BTrees/_fsBTree.c']),
 
     # DocumentTemplate
     Extension(name='DocumentTemplate.cDocumentTemplate',
@@ -457,6 +434,51 @@
 
     ]
 
+# BTree extension modules (code borrowed from ZODB/setup.py)
+
+# Include directories for C extensions
+include = ['.']
+
+# Set up dependencies for the BTrees package
+base_btrees_depends = [
+    "BTrees/BTreeItemsTemplate.c",
+    "BTrees/BTreeModuleTemplate.c",
+    "BTrees/BTreeTemplate.c",
+    "BTrees/BucketTemplate.c",
+    "BTrees/MergeTemplate.c",
+    "BTrees/SetOpTemplate.c",
+    "BTrees/SetTemplate.c",
+    "BTrees/TreeSetTemplate.c",
+    "BTrees/sorters.c",
+    "persistent/cPersistence.h",
+    ]
+
+_flavors = {"O": "object", "I": "int", "F": "float", 'L': 'int'}
+
+KEY_H = "BTrees/%skeymacros.h"
+VALUE_H = "BTrees/%svaluemacros.h"
+
+def BTreeExtension(flavor):
+    key = flavor[0]
+    value = flavor[1]
+    name = "BTrees._%sBTree" % flavor
+    sources = ["BTrees/_%sBTree.c" % flavor]
+    kwargs = {"include_dirs": include}
+    if flavor != "fs":
+        kwargs["depends"] = (base_btrees_depends + [KEY_H % _flavors[key],
+                                                    VALUE_H % _flavors[value]])
+    else:
+        kwargs["depends"] = base_btrees_depends
+    if key != "O":
+        kwargs["define_macros"] = [('EXCLUDE_INTSET_SUPPORT', None)]
+    return Extension(name, sources, **kwargs)
+
+ext_modules += [BTreeExtension(flavor)
+        for flavor in ("OO", "IO", "OI", "II", "IF",
+                       "fs", "LO", "OL", "LL", "LF",
+                       )]
+
+
 # We're using the module docstring as the distutils descriptions.
 doclines = __doc__.split("\n")
 

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to