[Checkins] SVN: zope.bforest/trunk/ add in long versions;
update some style; prepare for release
Gary Poster
gary at zope.com
Sat Mar 8 15:07:06 EST 2008
Log message for revision 84546:
add in long versions; update some style; prepare for release
Changed:
_U zope.bforest/trunk/
A zope.bforest/trunk/CHANGES.txt
D zope.bforest/trunk/bootstrap.py
U zope.bforest/trunk/buildout.cfg
U zope.bforest/trunk/setup.py
U zope.bforest/trunk/src/zope/bforest/__init__.py
U zope.bforest/trunk/src/zope/bforest/bforest.py
U zope.bforest/trunk/src/zope/bforest/periodic.py
U zope.bforest/trunk/src/zope/bforest/tests.py
-=-
Property changes on: zope.bforest/trunk
___________________________________________________________________
Name: svn:externals
+ bootstrap svn://svn.zope.org/repos/main/zc.buildout/trunk/bootstrap
Added: zope.bforest/trunk/CHANGES.txt
===================================================================
--- zope.bforest/trunk/CHANGES.txt (rev 0)
+++ zope.bforest/trunk/CHANGES.txt 2008-03-08 20:07:06 UTC (rev 84546)
@@ -0,0 +1,17 @@
+=======
+CHANGES
+=======
+
+1.1 (2008-03-08)
+----------------
+
+Features:
+
+- added periodic variant
+
+- added L-variants
+
+1.0 (?)
+-------
+
+Initial release
Property changes on: zope.bforest/trunk/CHANGES.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: zope.bforest/trunk/bootstrap.py
===================================================================
--- zope.bforest/trunk/bootstrap.py 2008-03-08 17:54:47 UTC (rev 84545)
+++ zope.bforest/trunk/bootstrap.py 2008-03-08 20:07:06 UTC (rev 84546)
@@ -1,52 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Bootstrap a buildout-based project
-
-Simply run this script in a directory containing a buildout.cfg.
-The script accepts buildout command-line options, so you can
-use the -c option to specify an alternate configuration file.
-
-$Id: bootstrap.py 69908 2006-08-31 21:53:00Z jim $
-"""
-
-import os, shutil, sys, tempfile, urllib2
-
-tmpeggs = tempfile.mkdtemp()
-
-ez = {}
-exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
- ).read() in ez
-ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
-
-import pkg_resources
-
-cmd = 'from setuptools.command.easy_install import main; main()'
-if sys.platform == 'win32':
- cmd = '"%s"' % cmd # work around spawn lamosity on windows
-
-ws = pkg_resources.working_set
-assert os.spawnle(
- os.P_WAIT, sys.executable, sys.executable,
- '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
- dict(os.environ,
- PYTHONPATH=
- ws.find(pkg_resources.Requirement.parse('setuptools')).location
- ),
- ) == 0
-
-ws.add_entry(tmpeggs)
-ws.require('zc.buildout')
-import zc.buildout.buildout
-zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
-shutil.rmtree(tmpeggs)
Modified: zope.bforest/trunk/buildout.cfg
===================================================================
--- zope.bforest/trunk/buildout.cfg 2008-03-08 17:54:47 UTC (rev 84545)
+++ zope.bforest/trunk/buildout.cfg 2008-03-08 20:07:06 UTC (rev 84546)
@@ -11,5 +11,6 @@
[py]
recipe = zc.recipe.egg
eggs = setuptools
+ zope.bforest
interpreter = py
scripts = py
Modified: zope.bforest/trunk/setup.py
===================================================================
--- zope.bforest/trunk/setup.py 2008-03-08 17:54:47 UTC (rev 84545)
+++ zope.bforest/trunk/setup.py 2008-03-08 20:07:06 UTC (rev 84546)
@@ -2,7 +2,7 @@
setup(
name="zope.bforest",
- version="1.1dev",
+ version="1.1",
license="ZPL 2.1",
author="Zope Project",
author_email="zope3-dev at zope.org",
@@ -11,7 +11,11 @@
packages=["zope", "zope.bforest"],
package_dir={"": "src"},
include_package_data=True,
- install_requires=["zope.interface", "ZODB3"],
+ install_requires=[
+ "zope.interface",
+ "ZODB3",
+ "setuptools",
+ ],
tests_require=["zope.testing"],
description=open('README.txt').read(),
long_description=open("src/zope/bforest/bforest.txt").read(),
Modified: zope.bforest/trunk/src/zope/bforest/__init__.py
===================================================================
--- zope.bforest/trunk/src/zope/bforest/__init__.py 2008-03-08 17:54:47 UTC (rev 84545)
+++ zope.bforest/trunk/src/zope/bforest/__init__.py 2008-03-08 20:07:06 UTC (rev 84546)
@@ -15,4 +15,6 @@
$Id: __init__.py 29023 2005-02-02 21:39:04Z poster $
"""
-from bforest import IOBForest, OIBForest, IIBForest, OOBForest
+from bforest import (IOBForest, OIBForest, IIBForest,
+ LOBForest, OLBForest, LLBForest,
+ OOBForest)
Modified: zope.bforest/trunk/src/zope/bforest/bforest.py
===================================================================
--- zope.bforest/trunk/src/zope/bforest/bforest.py 2008-03-08 17:54:47 UTC (rev 84545)
+++ zope.bforest/trunk/src/zope/bforest/bforest.py 2008-03-08 20:07:06 UTC (rev 84546)
@@ -15,14 +15,13 @@
$Id: bforest.py 33325 2005-07-15 01:09:43Z poster $
"""
-from persistent import Persistent
-from BTrees import IOBTree, OOBTree, OIBTree, IIBTree
-from persistent.list import PersistentList
+import persistent
+import persistent.list
+import BTrees
-class AbstractBForest(Persistent):
+class AbstractBForest(persistent.Persistent):
_treemodule = None # override
- _treeclass = None # override
_marker = object()
def __init__(self, d=None, count=2):
@@ -32,16 +31,16 @@
if d is not None:
raise ValueError(
"cannot set initial values without a bucket")
- l = PersistentList()
+ l = persistent.list.PersistentList()
else:
- Tree = self._treeclass
+ Tree = self._treemodule.BTree
if d is not None:
first = Tree(d)
else:
first = Tree()
l = [Tree() for i in range(count - 1)]
l.insert(0, first)
- l = PersistentList(l)
+ l = persistent.list.PersistentList(l)
self.buckets = l
def __getitem__(self, key):
@@ -91,7 +90,7 @@
def tree(self):
# convert to a tree; do as much in C as possible.
buckets = self.buckets
- res = self._treeclass(buckets[-1])
+ res = self._treemodule.BTree(buckets[-1])
for b in buckets[-2::-1]:
res.update(b)
return res
@@ -234,17 +233,22 @@
buckets.insert(0, b)
class IOBForest(AbstractBForest):
- _treemodule = IOBTree
- _treeclass = IOBTree.IOBTree
+ _treemodule = BTrees.family32.IO
class OIBForest(AbstractBForest):
- _treemodule = OIBTree
- _treeclass = OIBTree.OIBTree
+ _treemodule = BTrees.family32.OI
+class IIBForest(AbstractBForest):
+ _treemodule = BTrees.family32.II
+
+class LOBForest(AbstractBForest):
+ _treemodule = BTrees.family64.IO
+
+class OLBForest(AbstractBForest):
+ _treemodule = BTrees.family64.OI
+
+class LLBForest(AbstractBForest):
+ _treemodule = BTrees.family64.II
+
class OOBForest(AbstractBForest):
- _treemodule = OOBTree
- _treeclass = OOBTree.OOBTree
-
-class IIBForest(AbstractBForest):
- _treemodule = IIBTree
- _treeclass = IIBTree.IIBTree
+ _treemodule = BTrees.family32.OO
Modified: zope.bforest/trunk/src/zope/bforest/periodic.py
===================================================================
--- zope.bforest/trunk/src/zope/bforest/periodic.py 2008-03-08 17:54:47 UTC (rev 84545)
+++ zope.bforest/trunk/src/zope/bforest/periodic.py 2008-03-08 20:07:06 UTC (rev 84546)
@@ -1,20 +1,21 @@
import datetime
-from BTrees import IOBTree, OOBTree, OIBTree, IIBTree
-from zope.bforest import bforest, utils
+import BTrees
+import zope.bforest.bforest
+import zope.bforest.utils
def mutating(name):
def mutate(self, *args, **kwargs):
- if (datetime.datetime.now(utils.UTC) -
+ if (datetime.datetime.now(zope.bforest.utils.UTC) -
self.last_rotation) >= self._inner_period:
self.rotateBucket()
return getattr(super(Abstract, self), name)(*args, **kwargs)
return mutate
-class Abstract(bforest.AbstractBForest):
+class Abstract(zope.bforest.bforest.AbstractBForest):
def __init__(self, period, d=None, count=2):
super(Abstract, self).__init__(d, count)
self.period = period
- self.last_rotation = datetime.datetime.now(utils.UTC)
+ self.last_rotation = datetime.datetime.now(zope.bforest.utils.UTC)
_inner_period = _period = None
def period(self, value):
@@ -35,7 +36,7 @@
def rotateBucket(self):
super(Abstract, self).rotateBucket()
- self.last_rotation = datetime.datetime.now(utils.UTC)
+ self.last_rotation = datetime.datetime.now(zope.bforest.utils.UTC)
__setitem__ = mutating('__setitem__')
__delitem__ = mutating('__delitem__')
@@ -44,17 +45,22 @@
update = mutating('update')
class IOBForest(Abstract):
- _treemodule = IOBTree
- _treeclass = IOBTree.IOBTree
+ _treemodule = BTrees.family32.IO
class OIBForest(Abstract):
- _treemodule = OIBTree
- _treeclass = OIBTree.OIBTree
+ _treemodule = BTrees.family32.OI
+class IIBForest(Abstract):
+ _treemodule = BTrees.family32.II
+
+class LOBForest(Abstract):
+ _treemodule = BTrees.family64.IO
+
+class OLBForest(Abstract):
+ _treemodule = BTrees.family64.OI
+
+class LLBForest(Abstract):
+ _treemodule = BTrees.family64.II
+
class OOBForest(Abstract):
- _treemodule = OOBTree
- _treeclass = OOBTree.OOBTree
-
-class IIBForest(Abstract):
- _treemodule = IIBTree
- _treeclass = IIBTree.IIBTree
+ _treemodule = BTrees.family32.OO
Modified: zope.bforest/trunk/src/zope/bforest/tests.py
===================================================================
--- zope.bforest/trunk/src/zope/bforest/tests.py 2008-03-08 17:54:47 UTC (rev 84545)
+++ zope.bforest/trunk/src/zope/bforest/tests.py 2008-03-08 20:07:06 UTC (rev 84546)
@@ -17,10 +17,13 @@
import unittest
import datetime
-from zope import bforest
-from zope.bforest import periodic
-from zope.testing import doctest
+import BTrees
+import zope.testing
+
+import zope.bforest
+import zope.bforest.periodic
+
def StringGenerator(src='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'):
"infinite-ish unique string generator"
for el in src:
@@ -35,6 +38,7 @@
yield number
number += interval
+
oldDatetime = datetime.datetime
class _datetime(oldDatetime):
_now = None
@@ -73,61 +77,100 @@
def test_suite():
suite = unittest.TestSuite()
numgen = iter(NumberGenerator()).next
+ longgen = iter(NumberGenerator(BTrees.family32.maxint)).next
strgen = iter(StringGenerator()).next
suite.addTest(
- doctest.DocFileSuite(
+ zope.testing.doctest.DocFileSuite(
'bforest.txt',
- globs={'BForest': bforest.IOBForest,
+ globs={'BForest': zope.bforest.IOBForest,
'KeyGenerator': numgen,
'ValueGenerator': strgen}))
suite.addTest(
- doctest.DocFileSuite(
+ zope.testing.doctest.DocFileSuite(
'bforest.txt',
- globs={'BForest': bforest.OIBForest,
+ globs={'BForest': zope.bforest.OIBForest,
'KeyGenerator': strgen,
'ValueGenerator': numgen}))
suite.addTest(
- doctest.DocFileSuite(
+ zope.testing.doctest.DocFileSuite(
'bforest.txt',
- globs={'BForest': bforest.IIBForest,
+ globs={'BForest': zope.bforest.IIBForest,
'KeyGenerator': numgen,
'ValueGenerator': numgen}))
suite.addTest(
- doctest.DocFileSuite(
+ zope.testing.doctest.DocFileSuite(
'bforest.txt',
- globs={'BForest': bforest.OOBForest,
+ globs={'BForest': zope.bforest.LOBForest,
+ 'KeyGenerator': longgen,
+ 'ValueGenerator': strgen}))
+ suite.addTest(
+ zope.testing.doctest.DocFileSuite(
+ 'bforest.txt',
+ globs={'BForest': zope.bforest.OLBForest,
'KeyGenerator': strgen,
+ 'ValueGenerator': longgen}))
+ suite.addTest(
+ zope.testing.doctest.DocFileSuite(
+ 'bforest.txt',
+ globs={'BForest': zope.bforest.LLBForest,
+ 'KeyGenerator': longgen,
+ 'ValueGenerator': longgen}))
+ suite.addTest(
+ zope.testing.doctest.DocFileSuite(
+ 'bforest.txt',
+ globs={'BForest': zope.bforest.OOBForest,
+ 'KeyGenerator': strgen,
'ValueGenerator': strgen}))
suite.addTest(
- doctest.DocFileSuite(
+ zope.testing.doctest.DocFileSuite(
'periodic.txt',
- globs={'BForest': periodic.IOBForest,
+ globs={'BForest': zope.bforest.periodic.IOBForest,
'KeyGenerator': numgen,
'ValueGenerator': strgen},
setUp=setUp, tearDown=tearDown))
suite.addTest(
- doctest.DocFileSuite(
+ zope.testing.doctest.DocFileSuite(
'periodic.txt',
- globs={'BForest': periodic.OIBForest,
+ globs={'BForest': zope.bforest.periodic.OIBForest,
'KeyGenerator': strgen,
'ValueGenerator': numgen},
setUp=setUp, tearDown=tearDown))
suite.addTest(
- doctest.DocFileSuite(
+ zope.testing.doctest.DocFileSuite(
'periodic.txt',
- globs={'BForest': periodic.IIBForest,
+ globs={'BForest': zope.bforest.periodic.IIBForest,
'KeyGenerator': numgen,
'ValueGenerator': numgen},
setUp=setUp, tearDown=tearDown))
suite.addTest(
- doctest.DocFileSuite(
+ zope.testing.doctest.DocFileSuite(
+ 'periodic.txt',
+ globs={'BForest': zope.bforest.periodic.LOBForest,
+ 'KeyGenerator': longgen,
+ 'ValueGenerator': strgen},
+ setUp=setUp, tearDown=tearDown))
+ suite.addTest(
+ zope.testing.doctest.DocFileSuite(
'periodic.txt',
- globs={'BForest': periodic.OOBForest,
+ globs={'BForest': zope.bforest.periodic.OLBForest,
'KeyGenerator': strgen,
+ 'ValueGenerator': longgen},
+ setUp=setUp, tearDown=tearDown))
+ suite.addTest(
+ zope.testing.doctest.DocFileSuite(
+ 'periodic.txt',
+ globs={'BForest': zope.bforest.periodic.LLBForest,
+ 'KeyGenerator': longgen,
+ 'ValueGenerator': longgen},
+ setUp=setUp, tearDown=tearDown))
+ suite.addTest(
+ zope.testing.doctest.DocFileSuite(
+ 'periodic.txt',
+ globs={'BForest': zope.bforest.periodic.OOBForest,
+ 'KeyGenerator': strgen,
'ValueGenerator': strgen},
setUp=setUp, tearDown=tearDown))
return suite
if __name__ == '__main__':
- import unittest
unittest.main(defaultTest='test_suite')
More information about the Checkins
mailing list