[Zodb-checkins] SVN: ZODB/branches/tseaver-persistent_as_egg/ Smoother workaround for missing headers from 'persistent'.
Tres Seaver
cvs-admin at zope.org
Tue Jul 10 12:27:29 UTC 2012
Log message for revision 127294:
Smoother workaround for missing headers from 'persistent'.
Use a 'lazy string' class to compute the path to the persistent egg for
injection into the 'include_dirs' argument of the extensions.
Changed:
D ZODB/branches/tseaver-persistent_as_egg/include/
U ZODB/branches/tseaver-persistent_as_egg/setup.py
-=-
Modified: ZODB/branches/tseaver-persistent_as_egg/setup.py
===================================================================
--- ZODB/branches/tseaver-persistent_as_egg/setup.py 2012-07-10 06:48:48 UTC (rev 127293)
+++ ZODB/branches/tseaver-persistent_as_egg/setup.py 2012-07-10 12:27:26 UTC (rev 127294)
@@ -35,6 +35,7 @@
sys.exit(0)
+
if sys.version_info < (2, 6):
transaction_version = 'transaction == 1.1.1'
manuel_version = 'manuel < 1.6dev'
@@ -59,8 +60,27 @@
"""
# Include directories for C extensions
-include = ['include', 'src']
+# Sniff the location of the headers in 'persistent'.
+class ModuleHeaderDir(object):
+
+ def __init__(self, require_spec, where='..'):
+ # By default, assume top-level pkg has the same name as the dist.
+ # Also assume that headers are located in the package dir, and
+ # are meant to be included as follows:
+ # #include "module/header_name.h"
+ self._require_spec = require_spec
+ self._where = where
+
+ def __str__(self):
+ from pkg_resources import require
+ from pkg_resources import resource_filename
+ require(self._require_spec)
+ return os.path.abspath(
+ resource_filename(self._require_spec, self._where))
+
+include = [ModuleHeaderDir('persistent'), 'src']
+
# Set up dependencies for the BTrees package
base_btrees_depends = [
"src/BTrees/BTreeItemsTemplate.c",
@@ -72,7 +92,6 @@
"src/BTrees/SetTemplate.c",
"src/BTrees/TreeSetTemplate.c",
"src/BTrees/sorters.c",
- "include/persistent/cPersistence.h",
]
_flavors = {"O": "object", "I": "int", "F": "float", 'L': 'int'}
@@ -80,6 +99,7 @@
KEY_H = "src/BTrees/%skeymacros.h"
VALUE_H = "src/BTrees/%svaluemacros.h"
+
def BTreeExtension(flavor):
key = flavor[0]
value = flavor[1]
@@ -155,6 +175,7 @@
setup(name="ZODB3",
version=VERSION,
+ setup_requires=['persistent'],
maintainer="Zope Foundation and Contributors",
maintainer_email="zodb-dev at zope.org",
packages = find_packages('src'),
More information about the Zodb-checkins
mailing list