Commit 4e6e62c1 authored by Tres Seaver's avatar Tres Seaver

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.
parent bc22a90b
...@@ -35,6 +35,7 @@ if sys.version_info < (2, 5): ...@@ -35,6 +35,7 @@ if sys.version_info < (2, 5):
sys.exit(0) sys.exit(0)
if sys.version_info < (2, 6): if sys.version_info < (2, 6):
transaction_version = 'transaction == 1.1.1' transaction_version = 'transaction == 1.1.1'
manuel_version = 'manuel < 1.6dev' manuel_version = 'manuel < 1.6dev'
...@@ -59,7 +60,26 @@ Framework :: ZODB ...@@ -59,7 +60,26 @@ Framework :: ZODB
""" """
# Include directories for C extensions # 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 # Set up dependencies for the BTrees package
base_btrees_depends = [ base_btrees_depends = [
...@@ -72,7 +92,6 @@ base_btrees_depends = [ ...@@ -72,7 +92,6 @@ base_btrees_depends = [
"src/BTrees/SetTemplate.c", "src/BTrees/SetTemplate.c",
"src/BTrees/TreeSetTemplate.c", "src/BTrees/TreeSetTemplate.c",
"src/BTrees/sorters.c", "src/BTrees/sorters.c",
"include/persistent/cPersistence.h",
] ]
_flavors = {"O": "object", "I": "int", "F": "float", 'L': 'int'} _flavors = {"O": "object", "I": "int", "F": "float", 'L': 'int'}
...@@ -80,6 +99,7 @@ _flavors = {"O": "object", "I": "int", "F": "float", 'L': 'int'} ...@@ -80,6 +99,7 @@ _flavors = {"O": "object", "I": "int", "F": "float", 'L': 'int'}
KEY_H = "src/BTrees/%skeymacros.h" KEY_H = "src/BTrees/%skeymacros.h"
VALUE_H = "src/BTrees/%svaluemacros.h" VALUE_H = "src/BTrees/%svaluemacros.h"
def BTreeExtension(flavor): def BTreeExtension(flavor):
key = flavor[0] key = flavor[0]
value = flavor[1] value = flavor[1]
...@@ -155,6 +175,7 @@ long_description = str( ...@@ -155,6 +175,7 @@ long_description = str(
setup(name="ZODB3", setup(name="ZODB3",
version=VERSION, version=VERSION,
setup_requires=['persistent'],
maintainer="Zope Foundation and Contributors", maintainer="Zope Foundation and Contributors",
maintainer_email="zodb-dev@zope.org", maintainer_email="zodb-dev@zope.org",
packages = find_packages('src'), packages = find_packages('src'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment