[Checkins] SVN: relstorage/branches/1.1/ Made zodbconvert
buildout-friendly (hopefully) and set version to 1.1b1.
Shane Hathaway
shane at hathawaymix.org
Mon Apr 28 22:57:17 EDT 2008
Log message for revision 85839:
Made zodbconvert buildout-friendly (hopefully) and set version to 1.1b1.
Changed:
U relstorage/branches/1.1/CHANGELOG.txt
U relstorage/branches/1.1/notes/migrate-1.0.1.txt
U relstorage/branches/1.1/relstorage/tests/packstresstest.py
A relstorage/branches/1.1/relstorage/zodbconvert.py
D relstorage/branches/1.1/scripts/zodbconvert.py
U relstorage/branches/1.1/setup.py
-=-
Modified: relstorage/branches/1.1/CHANGELOG.txt
===================================================================
--- relstorage/branches/1.1/CHANGELOG.txt 2008-04-29 00:30:20 UTC (rev 85838)
+++ relstorage/branches/1.1/CHANGELOG.txt 2008-04-29 02:57:11 UTC (rev 85839)
@@ -1,7 +1,8 @@
-Next release
-- Fixed the use of setup.py without setuptools. Thanks Chris Withers.
+RelStorage 1.1b1
+- Fixed the use of setup.py without setuptools. Thanks to Chris Withers.
+
- Fixed type coercion of the transaction extension field. This fixes
an issue with converting databases. Thanks to Kevin Smith for
discovering this.
@@ -15,7 +16,10 @@
release the commit lock frequently. This should help large pack
operations.
+- Fixed buildout-based installation of the zodbconvert script. Thanks to
+ Jim Fulton.
+
RelStorage 1.0.1
- The speedtest script failed if run on a test database that has no tables.
Modified: relstorage/branches/1.1/notes/migrate-1.0.1.txt
===================================================================
--- relstorage/branches/1.1/notes/migrate-1.0.1.txt 2008-04-29 00:30:20 UTC (rev 85838)
+++ relstorage/branches/1.1/notes/migrate-1.0.1.txt 2008-04-29 02:57:11 UTC (rev 85839)
@@ -1,5 +1,5 @@
-Migrating from version 1.0.1 to version 1.1
+Migrating from version 1.0.1 to version 1.1b1
PostgreSQL:
Modified: relstorage/branches/1.1/relstorage/tests/packstresstest.py
===================================================================
--- relstorage/branches/1.1/relstorage/tests/packstresstest.py 2008-04-29 00:30:20 UTC (rev 85838)
+++ relstorage/branches/1.1/relstorage/tests/packstresstest.py 2008-04-29 02:57:11 UTC (rev 85839)
@@ -10,12 +10,21 @@
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
-if 1:
+use = 'oracle'
+
+if use == 'mysql':
from relstorage.adapters.mysql import MySQLAdapter
a = MySQLAdapter(db='packtest')
-else:
+elif use == 'postgresql':
from relstorage.adapters.postgresql import PostgreSQLAdapter
a = PostgreSQLAdapter(dsn="dbname='packtest'")
+elif use == 'oracle':
+ from relstorage.adapters.oracle import OracleAdapter
+ from relstorage.tests.testoracle import getOracleParams
+ user, password, dsn = getOracleParams()
+ a = OracleAdapter(user, password, dsn)
+else:
+ raise AssertionError("which database?")
s = RelStorage(a)
d = DB(s)
@@ -34,7 +43,7 @@
transaction.commit()
print 'generating transactions...'
- for trans in range(10000):
+ for trans in range(100):
print trans
sources = (random.randint(0, container_size - 1) for j in range(100))
for source in sources:
Copied: relstorage/branches/1.1/relstorage/zodbconvert.py (from rev 85259, relstorage/branches/1.1/scripts/zodbconvert.py)
===================================================================
--- relstorage/branches/1.1/relstorage/zodbconvert.py (rev 0)
+++ relstorage/branches/1.1/relstorage/zodbconvert.py 2008-04-29 02:57:11 UTC (rev 85839)
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+##############################################################################
+#
+# Copyright (c) 2008 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.
+#
+##############################################################################
+"""ZODB storage conversion utility.
+
+See http://wiki.zope.org/ZODB/ZODBConvert for details.
+"""
+
+import logging
+import optparse
+from persistent.TimeStamp import TimeStamp
+from StringIO import StringIO
+import sys
+import ZConfig
+from ZODB.utils import oid_repr
+
+schema_xml = """
+<schema>
+ <import package="ZODB"/>
+ <import package="relstorage"/>
+ <section type="ZODB.storage" name="source" attribute="source"
+ required="yes" />
+ <section type="ZODB.storage" name="destination" attribute="destination"
+ required="yes" />
+</schema>
+"""
+
+
+def storage_has_data(storage):
+ i = storage.iterator()
+ try:
+ i[0]
+ except IndexError:
+ return False
+ return True
+
+
+def main():
+ logging.basicConfig()
+
+ parser = optparse.OptionParser(description=__doc__,
+ usage="%prog [options] config_file")
+ parser.add_option(
+ "--dry-run", dest="dry_run", action="store_true",
+ help="Attempt to open the storages, then explain what would be done")
+ parser.add_option(
+ "--clear", dest="clear", action="store_true",
+ help="Clear the contents of the destination storage before copying")
+ parser.add_option(
+ "-v", "--verbose", dest="verbose", action="store_true",
+ help="Show verbose information while copying")
+ parser.set_defaults(dry_run=False, clear=False, verbose=False)
+ options, args = parser.parse_args()
+
+ if len(args) != 1:
+ parser.error("The name of one configuration file is required.")
+
+ schema = ZConfig.loadSchemaFile(StringIO(schema_xml))
+ config, handler = ZConfig.loadConfig(schema, args[0])
+ source = config.source.open()
+ destination = config.destination.open()
+
+ print "Storages opened successfully."
+
+ if options.dry_run:
+ print "Dry run mode: not changing the destination."
+ if storage_has_data(destination):
+ print "Warning: the destination storage has data"
+ count = 0
+ for txn in source.iterator():
+ print '%s user=%s description=%s' % (
+ TimeStamp(txn.tid), txn.user, txn.description)
+ for rec in txn:
+ print ' oid=%s length=%d' % (oid_repr(rec.oid), len(rec.data))
+ count += 1
+ print "Would copy %d transactions." % count
+ sys.exit(0)
+
+ if options.clear:
+ if hasattr(destination, 'zap_all'):
+ destination.zap_all()
+ else:
+ msg = ("Error: no API is known for clearing this type of storage."
+ " Use another method.")
+ sys.exit(msg)
+
+ if storage_has_data(destination):
+ msg = "Error: the destination storage has data. Try --clear."
+ sys.exit(msg)
+
+ destination.copyTransactionsFrom(source, verbose=options.verbose)
+
+ source.close()
+ destination.close()
+
+ print 'All transactions copied successfully.'
+
+
+if __name__ == '__main__':
+ main()
+
Deleted: relstorage/branches/1.1/scripts/zodbconvert.py
===================================================================
--- relstorage/branches/1.1/scripts/zodbconvert.py 2008-04-29 00:30:20 UTC (rev 85838)
+++ relstorage/branches/1.1/scripts/zodbconvert.py 2008-04-29 02:57:11 UTC (rev 85839)
@@ -1,111 +0,0 @@
-#!/usr/bin/env python
-##############################################################################
-#
-# Copyright (c) 2008 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.
-#
-##############################################################################
-"""ZODB storage conversion utility.
-
-See http://wiki.zope.org/ZODB/ZODBConvert for details.
-"""
-
-import logging
-import optparse
-from persistent.TimeStamp import TimeStamp
-from StringIO import StringIO
-import sys
-import ZConfig
-from ZODB.utils import oid_repr
-
-schema_xml = """
-<schema>
- <import package="ZODB"/>
- <import package="relstorage"/>
- <section type="ZODB.storage" name="source" attribute="source"
- required="yes" />
- <section type="ZODB.storage" name="destination" attribute="destination"
- required="yes" />
-</schema>
-"""
-
-
-def storage_has_data(storage):
- i = storage.iterator()
- try:
- i[0]
- except IndexError:
- return False
- return True
-
-
-def main():
- parser = optparse.OptionParser(description=__doc__,
- usage="%prog [options] config_file")
- parser.add_option(
- "--dry-run", dest="dry_run", action="store_true",
- help="Attempt to open the storages, then explain what would be done")
- parser.add_option(
- "--clear", dest="clear", action="store_true",
- help="Clear the contents of the destination storage before copying")
- parser.add_option(
- "-v", "--verbose", dest="verbose", action="store_true",
- help="Show verbose information while copying")
- parser.set_defaults(dry_run=False, clear=False, verbose=False)
- options, args = parser.parse_args()
-
- if len(args) != 1:
- parser.error("The name of one configuration file is required.")
-
- schema = ZConfig.loadSchemaFile(StringIO(schema_xml))
- config, handler = ZConfig.loadConfig(schema, args[0])
- source = config.source.open()
- destination = config.destination.open()
-
- print "Storages opened successfully."
-
- if options.dry_run:
- print "Dry run mode: not changing the destination."
- if storage_has_data(destination):
- print "Warning: the destination storage has data"
- count = 0
- for txn in source.iterator():
- print '%s user=%s description=%s' % (
- TimeStamp(txn.tid), txn.user, txn.description)
- for rec in txn:
- print ' oid=%s length=%d' % (oid_repr(rec.oid), len(rec.data))
- count += 1
- print "Would copy %d transactions." % count
- sys.exit(0)
-
- if options.clear:
- if hasattr(destination, 'zap_all'):
- destination.zap_all()
- else:
- msg = ("Error: no API is known for clearing this type of storage."
- " Use another method.")
- sys.exit(msg)
-
- if storage_has_data(destination):
- msg = "Error: the destination storage has data. Try --clear."
- sys.exit(msg)
-
- destination.copyTransactionsFrom(source, verbose=options.verbose)
-
- source.close()
- destination.close()
-
- print 'All transactions copied successfully.'
-
-
-if __name__ == '__main__':
- logging.basicConfig()
- main()
-
Modified: relstorage/branches/1.1/setup.py
===================================================================
--- relstorage/branches/1.1/setup.py 2008-04-29 00:30:20 UTC (rev 85838)
+++ relstorage/branches/1.1/setup.py 2008-04-29 02:57:11 UTC (rev 85839)
@@ -27,7 +27,7 @@
with RelStorage.
"""
-VERSION = "1.0.2dev"
+VERSION = "1.1b1"
classifiers = """\
Development Status :: 5 - Production/Stable
@@ -44,7 +44,9 @@
from setuptools import setup
except ImportError:
from distutils.core import setup
- setuptools_args = {}
+ setuptools_args = dict(
+ scripts=['relstorage/zodbconvert.py'],
+ )
else:
setuptools_args = dict(
zip_safe=False, # otherwise ZConfig can't see component.xml
@@ -54,6 +56,9 @@
'postgresql': ['psycopg2>=2.0'],
'oracle': ['cx_Oracle>=4.3.1'],
},
+ entry_points = {'console_scripts': [
+ 'zodbconvert = relstorage.zodbconvert:main',
+ ]},
test_suite='relstorage.tests.alltests.make_suite',
)
@@ -69,7 +74,6 @@
package_data={
'relstorage': ['component.xml'],
},
- scripts=['scripts/zodbconvert.py'],
license="ZPL 2.1",
platforms=["any"],
description=doclines[0],
More information about the Checkins
mailing list