[Zope-ZEO] BTree setup script, and import wackiness
Andrew Kuchling
akuchlin@mems-exchange.org
Mon, 03 Jul 2000 09:51:53 -0400
Adding to the collection of setup.py scripts, one for the BTree
directory is appended.
After installing the BTree modules, I noticed some wackiness with
importing it:
>>> import BTree
import ExtensionClass # dynamically loaded from /www/python/lib/python1.5/site-packages/ExtensionClass.so
Traceback (innermost last):
File "<stdin>", line 1, in ?
ImportError: No module named cPersistence
cPersistence.so is in the ZODB package. If you start a new
interpreter and import ZODB first, then importing BTree works:
>>> import ZODB
import ZODB # directory /www/python/lib/python1.5/site-packages/ZODB
# /www/python/lib/python1.5/site-packages/ZODB/__init__.pyc matches /www/python/lib/python1.5/site-packages/ZODB/__init__.py
import ZODB # precompiled from /www/python/lib/python1.5/site-packages/ZODB/__init__.pyc
... much deleted ...
>>> import BTree
import BTree # dynamically loaded from /www/python/lib/python1.5/site-packages/BTree.so
I see dependencies on import order as a Bad Thing. I wonder if the
following line in BTree.c should be changed to use ZODB.cPersistence?
if(cPersistenceCAPI=PyCObject_Import("cPersistence","CAPI"))
--amk
# Setup script for the BTree modules
from distutils.core import setup
from distutils.extension import Extension
INC_DIRS = ['../ExtensionClass', '../../python/ZODB']
BTree = Extension(name = 'BTree', include_dirs = INC_DIRS,
sources = ['BTree.c'] )
IIBTree = Extension(name = 'IIBTree', include_dirs = INC_DIRS,
sources = ['IIBTree.c'] )
IOBTree = Extension(name = 'IOBTree', include_dirs = INC_DIRS,
sources = ['IOBTree.c'] )
OIBTree = Extension(name = 'OIBTree', include_dirs = INC_DIRS,
sources = ['OIBTree.c'] )
intSet = Extension(name = 'intSet', include_dirs = INC_DIRS,
sources = ['intSet.c'] )
setup(name = 'BTree',
version = "XXX",
description = "XXX",
author = "Jim Fulton",
author_email = "XXX",
url = "XXX",
ext_modules = [BTree, IIBTree, IOBTree, OIBTree, intSet] )