[Zodb-checkins] CVS: ZODB3 - setup.py:1.39
Jeremy Hylton
jeremy@zope.com
Fri, 17 Jan 2003 13:28:58 -0500
Update of /cvs-repository/ZODB3
In directory cvs.zope.org:/tmp/cvs-serv31502
Modified Files:
setup.py
Log Message:
Refactor the setup script.
Two features that are only useful with 2.3 distutils: Add BTrees
dependency code from Zope3. Add classifiers for PEP 301-style
registration.
Add some helper functions to make Extension definitions less tedious.
Remove support for installing ZEO1.
Add a bunch of scripts to the install list.
=== ZODB3/setup.py 1.38 => 1.39 ===
--- ZODB3/setup.py:1.38 Fri Jan 10 13:24:27 2003
+++ ZODB3/setup.py Fri Jan 17 13:28:56 2003
@@ -20,6 +20,17 @@
interface, rich transaction support, and undo.
"""
+classifiers = """\
+Development Status :: 5 - Production/Stable
+Intended Audience :: Developers
+License :: OSI Approved :: Zope Public License
+Programming Language :: Python
+Topic :: Database
+Topic :: Software Development :: Libraries :: Python Modules
+Operating System :: Microsoft :: Windows
+Operating System :: Unix
+"""
+
import glob
import os
import sys
@@ -31,30 +42,70 @@
from distutils.command.install_lib import install_lib
from distutils.command.build_py import build_py
-ExtensionClass = Extension(name = 'ExtensionClass',
- sources = ['ExtensionClass/src/ExtensionClass.c'])
-
-Acquisition = Extension(name = 'Acquisition',
- sources = ['ExtensionClass/src/Acquisition.c'])
-
-ComputedAttribute = Extension(name = 'ComputedAttribute',
- sources = ['ExtensionClass/src/ComputedAttribute.c'])
-
-MethodObject = Extension(name = 'MethodObject',
- sources = ['ExtensionClass/src/MethodObject.c'])
+# distutils doesn't currently support graceful future evolution,
+# because all commands are configured by keyword args and distutils
+# complains about keywords it doesn't know about.
+
+if not "depends" in Extension.__init__.func_code.co_varnames:
+ # If it doesn't, create a local replacement that removes depends from the
+ # kwargs before calling the regular constructor.
+ _Extension = Extension
+ class Extension(_Extension):
+ def __init__(self, name, sources, **kwargs):
+ if kwargs.has_key("depends"):
+ del kwargs["depends"]
+ _Extension.__init__(self, name, sources, **kwargs)
-Missing = Extension(name = 'Missing',
- sources = ['ExtensionClass/src/Missing.c'])
-
-MultiMapping = Extension(name = 'MultiMapping',
- sources = ['ExtensionClass/src/MultiMapping.c'])
+if sys.version_info < (2, 3):
+ _setup = setup
+ def setup(**kwargs):
+ if kwargs.has_key("classifiers"):
+ del kwargs["classifiers"]
+ _setup(**kwargs)
+
+def ExtClassExt(name):
+ """Return an Extension object for something in ExtensionClass/src."""
+ return Extension(name=name, sources=["ExtensionClass/src/%s.c" % name])
+
+exts = [ExtClassExt(name) for name in
+ ["ExtensionClass", "Acquisition", "ComputedAttribute", "MethodObject",
+ "Missing", "MultiMapping", "Record", "ThreadLock"]]
-Record = Extension(name = 'Record', sources = ['ExtensionClass/src/Record.c'])
+# Include directories for C extensions
+include = ['ExtensionClass/src', 'ZODB']
-ThreadLock = Extension(name = 'ThreadLock',
- sources = ['ExtensionClass/src/ThreadLock.c'])
+# 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",
+ ]
+
+_flavors = {"O": "object", "I": "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]])
+ if key != "O":
+ kwargs["define_macros"] = [('EXCLUDE_INTSET_SUPPORT', None)]
+ return Extension(name, sources, **kwargs)
-include = ['ExtensionClass/src', 'ZODB']
+exts += [BTreeExtension(flavor) for flavor in ["OO", "IO", "OI", "II", "fs"]]
cPersistence = Extension(name = 'ZODB.cPersistence',
include_dirs = include,
@@ -82,39 +133,18 @@
sources = ['ZODB/winlock.c']
)
-oob = Extension(name = "BTrees._OOBTree",
- include_dirs = include,
- sources = ['BTrees/_OOBTree.c'],
- )
-
-oib = Extension(name = "BTrees._OIBTree",
- include_dirs = include,
- sources = ['BTrees/_OIBTree.c'],
- )
-
-iib = Extension(name = "BTrees._IIBTree",
- include_dirs = include,
- sources = ['BTrees/_IIBTree.c'],
- define_macros = [('EXCLUDE_INTSET_SUPPORT', None)],
- )
-
-iob = Extension(name = "BTrees._IOBTree",
- include_dirs = include,
- sources = ['BTrees/_IOBTree.c'],
- define_macros = [('EXCLUDE_INTSET_SUPPORT', None)],
- )
-
-fsb = Extension(name = "BTrees._fsBTree",
- include_dirs = include,
- sources = ['BTrees/_fsBTree.c'],
- define_macros = [('EXCLUDE_INTSET_SUPPORT', None)],
- )
+exts += [cPersistence, cPickleCache, TimeStamp, coptimizations, winlock]
-bsddbhelper = Extension(name = 'BDBStorage._helper',
- sources = ['BDBStorage/_helper.c'])
-
-packages = ['BTrees', 'BTrees.tests',
- 'ZODB', 'ZODB.tests',
+# Don't build the helper unless using at least Python 2.2
+if sys.hexversion >= 0x020200F0:
+ bsddbhelper = Extension(name = 'BDBStorage._helper',
+ sources = ['BDBStorage/_helper.c'])
+ exts += [bsddbhelper]
+
+packages = ["BDBStorage", "BDBStorage.tests",
+ "BTrees", "BTrees.tests",
+ "ZEO", "ZEO.zrpc", "ZEO.tests",
+ "ZODB", "ZODB.tests",
"Persistence",
"ThreadedAsync",
"zLOG", "zLOG.tests",
@@ -122,48 +152,21 @@
"ZopeUndo", "ZopeUndo.tests",
"ZConfig", "ZConfig.tests",
]
+package_dir = {'BDBStorage': 'BDBStorage'}
if sys.version_info < (2, 3):
packages.append("logging")
-package_dir = {}
-
-packages.extend(["BDBStorage", "BDBStorage.tests"])
-package_dir['BDBStorage'] = 'BDBStorage'
-
-# This version of ZODB ships with two incompatible versions of ZEO.
-# The recommended version is ZEO 2.0, which is the focus of current
-# ZEO development. It is, however, incompatible with ZEO 1.0, which
-# shipped with earlier versions of ZODB. To upgrade, all ZEO clients
-# and servers must be upgraded at the same time.
-#
-# Since it may be inconvenient to upgrade at the same time this
-# software is installed, you can pass --with-zeo1 to setup.py on the
-# command-line. This will build, test, and install ZEO 1.0 instead of
-# ZEO 2.0.
-#
-# We've made no effort to make the -b option to test.py work. If you
-# pass --with-zeo1 to setup.py and then run test.py -b, it will
-# clobber ZEO 1.0 and install ZEO 2.0.
-
-# peek at the command-line arguments
-ZEO_VERSION = 2
-if "--with-zeo1" in sys.argv:
- ZEO_VERSION = 1
- sys.argv.remove("--with-zeo1")
-
-if ZEO_VERSION == 1:
- packages += ["ZEO", "ZEO.tests"]
- package_dir["ZEO"] = "ZEO1"
-else:
- packages += ["ZEO", "ZEO.zrpc", "ZEO.tests"]
-
-ext_modules = [ExtensionClass, Acquisition, ComputedAttribute,
- MethodObject, Missing, MultiMapping,
- ThreadLock, Record, cPersistence, cPickleCache,
- TimeStamp, coptimizations, winlock, oob, oib,
- iib, iob, fsb,
- ]
+scripts = ["Tools/fsdump.py",
+ "Tools/fsrefs.py",
+ "Tools/fstail.py",
+ "Tools/fstest.py",
+ "Tools/zeopack.py",
+ "ZEO/runzeo.py",
+ "zdaemon/zdaemon.py",
+ "zdaemon/zdctl.py",
+ "zdaemon/zdctl.sh",
+ ]
def copy_conf_files(cmd, outputbase):
for inputdir in [
@@ -210,24 +213,22 @@
self.cmdclass['build_py'] = MyPyBuilder
self.cmdclass['install_lib'] = MyLibInstaller
-# Don't build the helper unless using at least Python 2.2
-if sys.hexversion >= 0x020200F0:
- ext_modules.append(bsddbhelper)
-
doclines = __doc__.split("\n")
setup(name="ZODB3",
- version="3.2a0",
+ version="3.2a1",
maintainer="Zope Corporation",
maintainer_email="zodb-dev@zope.org",
url = "http://www.zope.org/Wikis/ZODB/FrontPage",
packages = packages,
package_dir = package_dir,
- ext_modules = ext_modules,
+ ext_modules = exts,
headers = ['ExtensionClass/src/ExtensionClass.h', 'ZODB/cPersistence.h'],
license = "http://www.zope.org/Resources/ZPL",
platforms = ["yes"], #
description = doclines[0],
+ classifiers = filter(None, classifiers.split("\n")),
long_description = "\n".join(doclines[2:]),
distclass = MyDistribution,
+ scripts = scripts,
)