[Zodb-checkins] SVN: ZODB/trunk/s Bugs Fixed
Jim Fulton
jim at zope.com
Fri Jul 10 14:51:23 EDT 2009
Log message for revision 101798:
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.
Changed:
U ZODB/trunk/setup.py
U ZODB/trunk/src/CHANGES.txt
-=-
Modified: ZODB/trunk/setup.py
===================================================================
--- ZODB/trunk/setup.py 2009-07-10 18:51:19 UTC (rev 101797)
+++ ZODB/trunk/setup.py 2009-07-10 18:51:23 UTC (rev 101798)
@@ -22,13 +22,27 @@
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:
# Development Status :: 5 - Production/Stable
# Development Status :: 4 - Beta
# Development Status :: 3 - Alpha
classifiers = """\
-Development Status :: 3 - Alpha
Intended Audience :: Developers
License :: OSI Approved :: Zope Public License
Programming Language :: Python
@@ -38,8 +52,6 @@
Operating System :: Unix
"""
-from setuptools import setup
-
entry_points = """
[console_scripts]
fsdump = ZODB.FileStorage.fsdump:main
@@ -55,22 +67,7 @@
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 = ['src']
@@ -142,89 +139,44 @@
TimeStamp,
]
-# The ZODB.zodb4 code is not being packaged, because it is only
-# need to convert early versions of Zope3 databases to ZODB3.
+def _modname(path, base, name=''):
+ if path == base:
+ return name
+ dirname, basename = os.path.split(path)
+ return _modname(dirname, base, basename + '.' + name)
-packages = ["BTrees", "BTrees.tests",
- "ZEO", "ZEO.auth", "ZEO.zrpc", "ZEO.tests", "ZEO.scripts",
- "ZODB", "ZODB.FileStorage", "ZODB.tests",
- "ZODB.scripts",
- "persistent", "persistent.tests",
- ]
+def alltests():
+ import logging
+ import pkg_resources
+ import unittest
+ import ZEO.ClientStorage
-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 NullHandler(logging.Handler):
+ level = 50
+
+ def emit(self, record):
+ pass
-class MyLibInstaller(install_lib):
- """Custom library installer, used to put hosttab in the right place."""
+ logging.getLogger().addHandler(NullHandler())
- # 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.
+ 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
- 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():
- # use the zope.testing testrunner machinery to find all the
- # test suites we've put under ourselves
- from zope.testing.testrunner import get_options
- from zope.testing.testrunner import find_suites
- from zope.testing.testrunner import configure_logging
- configure_logging()
- from unittest import TestSuite
- here = os.path.abspath(os.path.dirname(sys.argv[0]))
- args = sys.argv[:]
- src = os.path.join(here, 'src')
- defaults = ['--test-path', src, '--all']
- options = get_options(args, defaults)
- suites = list(find_suites(options))
- return TestSuite(suites)
-
doclines = __doc__.split("\n")
def read_file(*path):
@@ -234,10 +186,9 @@
setup(name="ZODB3",
version=VERSION,
- maintainer="Zope Corporation",
+ maintainer="Zope Foundation and Contributors",
maintainer_email="zodb-dev at zope.org",
- url = "http://pypi.python.org/pypi/ZODB3",
- packages = packages,
+ packages = find_packages(),
package_dir = {'': 'src'},
ext_modules = exts,
headers = ['src/persistent/cPersistence.h',
@@ -251,14 +202,9 @@
".. contents::\n\n" +
read_file("README.txt") + "\n\n" +
read_file("src", "CHANGES.txt")),
- distclass = MyDistribution,
test_suite="__main__.alltests", # to support "setup.py test"
tests_require = [
- 'zope.interface',
- 'zope.proxy',
'zope.testing',
- 'transaction',
- 'zdaemon',
],
install_requires = [
'transaction',
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt 2009-07-10 18:51:19 UTC (rev 101797)
+++ ZODB/trunk/src/CHANGES.txt 2009-07-10 18:51:23 UTC (rev 101798)
@@ -8,6 +8,11 @@
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
management.
More information about the Zodb-checkins
mailing list