Commit e04d43b9 authored by Jim Fulton's avatar Jim Fulton

Bugs Fixed

----------

- Simplified the setup script in hopes of working with bdist_rpm.

- Fixed the setup test command.  It previously depended on private
  functions in zope.testing.testrunner that don't exist any more.
parent ccc63fba
...@@ -22,13 +22,27 @@ interface, rich transaction support, and undo. ...@@ -22,13 +22,27 @@ interface, rich transaction support, and undo.
VERSION = "3.9.0dev" VERSION = "3.9.0dev"
from setuptools import setup, find_packages
import glob
import os
import sys
from setuptools.extension import Extension
from distutils import dir_util
from setuptools.dist import Distribution
from setuptools.command.install_lib import install_lib
from setuptools.command.build_py import build_py
from distutils.util import convert_path
if sys.version_info < (2, 4, 2):
print "This version of ZODB requires Python 2.4.2 or higher"
sys.exit(0)
# The (non-obvious!) choices for the Trove Development Status line: # The (non-obvious!) choices for the Trove Development Status line:
# Development Status :: 5 - Production/Stable # Development Status :: 5 - Production/Stable
# Development Status :: 4 - Beta # Development Status :: 4 - Beta
# Development Status :: 3 - Alpha # Development Status :: 3 - Alpha
classifiers = """\ classifiers = """\
Development Status :: 3 - Alpha
Intended Audience :: Developers Intended Audience :: Developers
License :: OSI Approved :: Zope Public License License :: OSI Approved :: Zope Public License
Programming Language :: Python Programming Language :: Python
...@@ -38,8 +52,6 @@ Operating System :: Microsoft :: Windows ...@@ -38,8 +52,6 @@ Operating System :: Microsoft :: Windows
Operating System :: Unix Operating System :: Unix
""" """
from setuptools import setup
entry_points = """ entry_points = """
[console_scripts] [console_scripts]
fsdump = ZODB.FileStorage.fsdump:main fsdump = ZODB.FileStorage.fsdump:main
...@@ -55,21 +67,6 @@ entry_points = """ ...@@ -55,21 +67,6 @@ entry_points = """
remove-old-zeo-cached-blobs = ZEO.ClientStorage:check_blob_size_script remove-old-zeo-cached-blobs = ZEO.ClientStorage:check_blob_size_script
""" """
scripts = []
import glob
import os
import sys
from setuptools.extension import Extension
from distutils import dir_util
from setuptools.dist import Distribution
from setuptools.command.install_lib import install_lib
from setuptools.command.build_py import build_py
from distutils.util import convert_path
if sys.version_info < (2, 4, 2):
print "This version of ZODB requires Python 2.4.2 or higher"
sys.exit(0)
# Include directories for C extensions # Include directories for C extensions
include = ['src'] include = ['src']
...@@ -142,88 +139,43 @@ exts += [cPersistence, ...@@ -142,88 +139,43 @@ exts += [cPersistence,
TimeStamp, TimeStamp,
] ]
# The ZODB.zodb4 code is not being packaged, because it is only def _modname(path, base, name=''):
# need to convert early versions of Zope3 databases to ZODB3. if path == base:
return name
packages = ["BTrees", "BTrees.tests", dirname, basename = os.path.split(path)
"ZEO", "ZEO.auth", "ZEO.zrpc", "ZEO.tests", "ZEO.scripts", return _modname(dirname, base, basename + '.' + name)
"ZODB", "ZODB.FileStorage", "ZODB.tests",
"ZODB.scripts",
"persistent", "persistent.tests",
]
def copy_other_files(cmd, outputbase):
# A delicate dance to copy files with certain extensions
# into a package just like .py files.
extensions = ["*.conf", "*.xml", "*.txt", "*.sh"]
directories = [
"BTrees",
"persistent/tests",
"ZEO",
"ZEO/scripts",
"ZODB",
"ZODB/scripts",
"ZODB/tests",
"ZODB/Blobs",
"ZODB/Blobs/tests",
]
for dir in directories:
exts = extensions
dir = convert_path(dir)
inputdir = os.path.join("src", dir)
outputdir = os.path.join(outputbase, dir)
if not os.path.exists(outputdir):
dir_util.mkpath(outputdir)
for pattern in exts:
for fn in glob.glob(os.path.join(inputdir, pattern)):
# glob is going to give us a path including "src",
# which must be stripped to get the destination dir
dest = os.path.join(outputbase, fn[4:])
cmd.copy_file(fn, dest)
class MyLibInstaller(install_lib):
"""Custom library installer, used to put hosttab in the right place."""
# We use the install_lib command since we need to put hosttab
# inside the library directory. This is where we already have the
# real information about where to install it after the library
# location has been set by any relevant distutils command line
# options.
def run(self):
install_lib.run(self)
copy_other_files(self, self.install_dir)
class MyPyBuilder(build_py):
def build_packages(self):
build_py.build_packages(self)
copy_other_files(self, self.build_lib)
class MyDistribution(Distribution):
# To control the selection of MyLibInstaller and MyPyBuilder, we
# have to set it into the cmdclass instance variable, set in
# Distribution.__init__().
def __init__(self, *attrs):
Distribution.__init__(self, *attrs)
self.cmdclass['build_py'] = MyPyBuilder
self.cmdclass['install_lib'] = MyLibInstaller
def alltests(): def alltests():
# use the zope.testing testrunner machinery to find all the import logging
# test suites we've put under ourselves import pkg_resources
from zope.testing.testrunner import get_options import unittest
from zope.testing.testrunner import find_suites import ZEO.ClientStorage
from zope.testing.testrunner import configure_logging
configure_logging() class NullHandler(logging.Handler):
from unittest import TestSuite level = 50
here = os.path.abspath(os.path.dirname(sys.argv[0]))
args = sys.argv[:] def emit(self, record):
src = os.path.join(here, 'src') pass
defaults = ['--test-path', src, '--all']
options = get_options(args, defaults) logging.getLogger().addHandler(NullHandler())
suites = list(find_suites(options))
return TestSuite(suites) suite = unittest.TestSuite()
base = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('ZODB3')).location
for dirpath, dirnames, filenames in os.walk(base):
if os.path.basename(dirpath) == 'tests':
for filename in filenames:
if filename != 'testZEO.py': continue
if filename.endswith('.py') and filename.startswith('test'):
mod = __import__(
_modname(dirpath, base, os.path.splitext(filename)[0]),
{}, {}, ['*'])
suite.addTest(mod.test_suite())
elif 'tests.py' in filenames:
continue
mod = __import__(_modname(dirpath, base, 'tests'), {}, {}, ['*'])
suite.addTest(mod.test_suite())
return suite
doclines = __doc__.split("\n") doclines = __doc__.split("\n")
...@@ -234,10 +186,9 @@ def read_file(*path): ...@@ -234,10 +186,9 @@ def read_file(*path):
setup(name="ZODB3", setup(name="ZODB3",
version=VERSION, version=VERSION,
maintainer="Zope Corporation", maintainer="Zope Foundation and Contributors",
maintainer_email="zodb-dev@zope.org", maintainer_email="zodb-dev@zope.org",
url = "http://pypi.python.org/pypi/ZODB3", packages = find_packages(),
packages = packages,
package_dir = {'': 'src'}, package_dir = {'': 'src'},
ext_modules = exts, ext_modules = exts,
headers = ['src/persistent/cPersistence.h', headers = ['src/persistent/cPersistence.h',
...@@ -251,14 +202,9 @@ setup(name="ZODB3", ...@@ -251,14 +202,9 @@ setup(name="ZODB3",
".. contents::\n\n" + ".. contents::\n\n" +
read_file("README.txt") + "\n\n" + read_file("README.txt") + "\n\n" +
read_file("src", "CHANGES.txt")), read_file("src", "CHANGES.txt")),
distclass = MyDistribution,
test_suite="__main__.alltests", # to support "setup.py test" test_suite="__main__.alltests", # to support "setup.py test"
tests_require = [ tests_require = [
'zope.interface',
'zope.proxy',
'zope.testing', 'zope.testing',
'transaction',
'zdaemon',
], ],
install_requires = [ install_requires = [
'transaction', 'transaction',
......
...@@ -8,6 +8,11 @@ ...@@ -8,6 +8,11 @@
Bugs Fixed Bugs Fixed
---------- ----------
- Simplified the setup script in hopes of working with bdist_rpm.
- Fixed the setup test command. It previously depended on private
functions in zope.testing.testrunner that don't exist any more.
- ZEO client threads were unnamed, making it hard to debug thread - ZEO client threads were unnamed, making it hard to debug thread
management. management.
......
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