[Zope-Checkins] SVN: Zope/trunk/ merged changes r29469:29727 from the five-integration branch

Brian Lloyd brian at zope.com
Wed Mar 30 17:00:49 EST 2005


Log message for revision 29738:
  merged changes r29469:29727 from the five-integration branch

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  A   Zope/trunk/doc/ZOPE3.txt
  U   Zope/trunk/inst/versions.py
  _U  Zope/trunk/lib/python/
  _U  Zope/trunk/lib/python/Products/
  A   Zope/trunk/lib/python/Products/Five/
  _U  Zope/trunk/lib/python/Products/Five/doc/products/FiveMiscTutorial/z3base.png
  _U  Zope/trunk/lib/python/Products/Five/doc/z3-banner.png
  _U  Zope/trunk/lib/python/Products/Five/tests/products/FiveTest/metaconfigure.py
  _U  Zope/trunk/lib/python/Products/Five/tests/products/FiveTest/pattern.png
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/PortalTestCase.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeLite.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeTestCase.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/base.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/doc/API.stx
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/doc/HOWTO.stx
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/framework.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/functional.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/interfaces.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/profiler.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/runalltests.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/sandbox.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testBaseTestCase.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testFunctional.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testInterfaces.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testPythonScript.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testShoppingCart.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testSkeleton.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testWebserver.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testZODBCompat.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testZopeTestCase.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/threadutils.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/utils.py
  D   Zope/trunk/lib/python/Testing/ZopeTestCase/warnhook.py
  A   Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/README.txt
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/WarningsTest.txt
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/ZopeDocTest.txt
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/__init__.py
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/framework.py
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/testAuthHeaderTest.py
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/testWarningsTest.py
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py
  A   Zope/trunk/lib/python/Testing/ZopeTestCase/zopetest/
  _U  Zope/trunk/lib/python/Testing/ZopeTestCase/zopetest/__init__.py
  D   Zope/trunk/lib/python/Testing/ZopeTestCase/ztc/
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/ztc_common.py
  U   Zope/trunk/lib/python/ZPublisher/HTTPRequest.py
  U   Zope/trunk/setup.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/doc/CHANGES.txt	2005-03-30 22:00:49 UTC (rev 29738)
@@ -56,6 +56,11 @@
         "javascript" as editable through the File edit form, just like
         text/<foo> types
 
+      - Zope X3 3.0.0's 'src/zope' package is included now.
+
+      - Five (Zope 3 integration technology for Zope 2) is included
+        now in Products/Five.
+
     Bugs fixed
 
       - ZPublisher would fail to recognize a XML-RPC request if the
@@ -80,6 +85,9 @@
       - Fixed Shared.DC.ZRDB.Results to behave with the new-style
         ExtensionClass. Added a test.
 
+      - 'setup.py' did not install the new 'Zope' compatibility module
+        (the 'Zope' package has been renamedd to 'Zope2').
+
       - Collector #1507: Zope now binds again to all available IP addresses if
         ip-address is unset
 

Copied: Zope/trunk/doc/ZOPE3.txt (from rev 29727, Zope/branches/five-integration/doc/ZOPE3.txt)


Property changes on: Zope/trunk/doc/ZOPE3.txt
___________________________________________________________________
Name: svn:executable
   + *

Modified: Zope/trunk/inst/versions.py
===================================================================
--- Zope/trunk/inst/versions.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/inst/versions.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -4,4 +4,4 @@
 
 # always start prerelease branches with '0' to avoid upgrade
 # issues in RPMs
-VERSION_RELEASE_TAG = 'a1'
+VERSION_RELEASE_TAG = 'b1'


Property changes on: Zope/trunk/lib/python
___________________________________________________________________
Name: svn:externals
   + zope   svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.0-Zope-2.8-pr1/src/zope




Property changes on: Zope/trunk/lib/python/Products
___________________________________________________________________
Name: svn:externals
   + 


Copied: Zope/trunk/lib/python/Products/Five (from rev 29727, Zope/branches/five-integration/lib/python/Products/Five)

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/PortalTestCase.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/PortalTestCase.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/PortalTestCase.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,21 +1,32 @@
+##############################################################################
 #
-# Abstract base test case for working with CMF-style portals
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# This base class maintains a fixture consisting of:
+# 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.
 #
-#   - a portal object (self.portal)
-#   - a user folder inside the portal
-#   - a default user with role 'Member' inside the user folder
-#   - the default user's memberarea (self.folder)
-#   - the default user is logged in
-#
-# The twist is that the portal object itself is *not* created
-# by the PortalTestCase class! Subclasses must make sure
-# getPortal() returns a usable portal object to the setup code.
-#
+##############################################################################
+"""Abstract base test case for working with CMF-style portals
 
-# $Id: PortalTestCase.py,v 1.38 2005/02/09 12:42:40 shh42 Exp $
+This class maintains a fixture consisting of:
 
+  - a portal object (self.portal)
+  - a user folder inside the portal
+  - a default user with role 'Member' inside the user folder
+  - the default user's memberarea (self.folder)
+  - the default user is logged in
+
+The twist is that the portal object itself is *not* created
+by the PortalTestCase class! Subclasses must make sure
+getPortal() returns a usable portal object to the setup code.
+
+$Id: PortalTestCase.py,v 1.38 2005/02/09 12:42:40 shh42 Exp $
+"""
+
 import base
 import interfaces
 import utils
@@ -135,18 +146,3 @@
         '''Logs out.'''
         noSecurityManager()
 
-    # b/w compatibility methods
-
-    def _setRoles(self, roles, name=user_name):
-        self.setRoles(roles, name)
-    def _setPermissions(self, permissions, role='Member'):
-        self.setPermissions(permissions, role)
-    def _login(self, name=user_name):
-        self.login(name)
-    def _logout(self):
-        self.logout()
-
-
-# b/w compatibility names
-_portal_name = portal_name
-

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeLite.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeLite.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeLite.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,19 +1,30 @@
+##############################################################################
 #
-# Lightweight Zope startup
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# Fast Zope startup is achieved by not installing (m)any
-# products. If your tests require a product you must
-# install it yourself using installProduct().
+# 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.
 #
-# Typically used as in
-#
-#   import ZopeLite as Zope2
-#   Zope2.installProduct('SomeProduct')
-#   app = Zope2.app()
-#
+##############################################################################
+"""Lightweight Zope startup
 
-# $Id: ZopeLite.py,v 1.24 2004/08/18 09:28:54 shh42 Exp $
+Fast Zope startup is achieved by not installing (m)any
+products. If your tests require a product you must
+install it yourself using installProduct().
 
+Typically used as in
+
+  import ZopeLite as Zope2
+  Zope2.installProduct('SomeProduct')
+  app = Zope2.app()
+
+$Id: ZopeLite.py,v 1.24 2004/08/18 09:28:54 shh42 Exp $
+"""
+
 import os, sys, time
 
 # Allow code to tell it is run by the test framework
@@ -45,19 +56,30 @@
 _write('Loading Zope, please stand by ')
 _start = time.time()
 
-# Configure logging
-if not sys.modules.has_key('logging'):
-    import logging
-    logging.basicConfig()
+def _configure_logging():
+    # Initialize the logging module
+    if not sys.modules.has_key('logging'):
+        import logging
+        logging.basicConfig()
 
-# Debug mode is dog slow ...
-import App.config
-config = App.config.getConfiguration()
-config.debug_mode = 0
-App.config.setConfiguration(config)
+def _configure_debug_mode():
+    # Switch off debug mode
+    import App.config
+    config = App.config.getConfiguration()
+    config.debug_mode = 0
+    App.config.setConfiguration(config)
 
-# Need to import Zope2 early on as the 
-# ZTUtils package relies on it
+def _configure_client_cache():
+    # Make sure we use a temporary client cache
+    import App.config
+    config = App.config.getConfiguration()
+    config.zeo_client_name = None
+    App.config.setConfiguration(config)
+
+_configure_logging()
+_configure_debug_mode()
+_configure_client_cache()
+
 _exec('import Zope2')
 import Zope2
 _exec('import ZODB')
@@ -75,26 +97,31 @@
 _exec('import OFS.Application')
 import OFS.Application
 import App.ProductContext
+_write('.')
 
-# Avoid expensive product import
-def _null_import_products(): pass
-OFS.Application.import_products = _null_import_products
+def _apply_patches():
+    # Avoid expensive product import
+    def null_import_products(): pass
+    OFS.Application.import_products = null_import_products
 
-# Avoid expensive product installation
-def _null_initialize(app): pass
-OFS.Application.initialize = _null_initialize
+    # Avoid expensive product installation
+    def null_initialize(app): pass
+    OFS.Application.initialize = null_initialize
 
-# Avoid expensive help registration
-def _null_register_topic(self,id,topic): pass
-App.ProductContext.ProductContext.registerHelpTopic = _null_register_topic
-def _null_register_title(self,title): pass
-App.ProductContext.ProductContext.registerHelpTitle = _null_register_title
-def _null_register_help(self,directory='',clear=1,title_re=None): pass
-App.ProductContext.ProductContext.registerHelp = _null_register_help
+    # Avoid expensive help registration
+    def null_register_topic(self,id,topic): pass
+    App.ProductContext.ProductContext.registerHelpTopic = null_register_topic
+    def null_register_title(self,title): pass
+    App.ProductContext.ProductContext.registerHelpTitle = null_register_title
+    def null_register_help(self,directory='',clear=1,title_re=None): pass
+    App.ProductContext.ProductContext.registerHelp = null_register_help
 
-# Make sure to use a temporary client cache
-if os.environ.get('ZEO_CLIENT'): del os.environ['ZEO_CLIENT']
+# Do not patch a running Zope
+if not Zope2._began_startup:
+    _apply_patches()
 
+# Allow test authors to install Zope products into the test environment. Note
+# that installProduct() must be called at module level -- never from tests.
 from OFS.Application import get_folder_permissions, get_products, install_product
 from OFS.Folder import Folder
 import Products
@@ -103,13 +130,12 @@
 _installedProducts = {}
 
 def hasProduct(name):
-    '''Tests if a product can be found along Products.__path__'''
+    '''Checks if a product can be found along Products.__path__'''
     return name in [n[1] for n in get_products()]
 
 def installProduct(name, quiet=0):
     '''Installs a Zope product.'''
     start = time.time()
-    app = _theApp
     meta_types = []
     if not _installedProducts.has_key(name):
         for priority, product_name, index, product_dir in get_products():
@@ -117,7 +143,7 @@
                 if not quiet: _print('Installing %s ... ' % product_name)
                 # We want to fail immediately if a product throws an exception
                 # during install, so we set the raise_exc flag.
-                install_product(app, product_dir, product_name, meta_types,
+                install_product(_theApp, product_dir, product_name, meta_types,
                                 get_folder_permissions(), raise_exc=1)
                 _installedProducts[product_name] = 1
                 Products.meta_types = Products.meta_types + tuple(meta_types)
@@ -128,24 +154,28 @@
             if name != 'SomeProduct':   # Ignore the skeleton tests :-P
                 if not quiet: _print('Installing %s ... NOT FOUND\n' % name)
 
-# Loading the Control_Panel of an existing ZODB may take 
-# a while; print another dot if it does.
-_s = time.time(); _max = (_s - _start) / 4
-_exec('_theApp.Control_Panel')
-_cp = _theApp.Control_Panel
-if hasattr(_cp, 'initialize_cache'):
-    _cp.initialize_cache()
-if (time.time() - _s) > _max: 
-    _write('.')
+def _load_control_panel():
+    # Loading the Control_Panel of an existing ZODB may take
+    # a while; print another dot if it does.
+    start = time.time()
+    max = (start - _start) / 4
+    _exec('_theApp.Control_Panel')
+    _theApp.Control_Panel
+    if (time.time() - start) > max:
+        _write('.')
 
-installProduct('PluginIndexes', 1)  # Must install first
-installProduct('OFSP', 1)
-#installProduct('ExternalMethod', 1)
-#installProduct('ZSQLMethods', 1)
-#installProduct('ZGadflyDA', 1)
-#installProduct('MIMETools', 1)
-#installProduct('MailHost', 1)
+def _install_products():
+    installProduct('PluginIndexes', 1)  # Must install first
+    installProduct('OFSP', 1)
+    #installProduct('ExternalMethod', 1)
+    #installProduct('ZSQLMethods', 1)
+    #installProduct('ZGadflyDA', 1)
+    #installProduct('MIMETools', 1)
+    #installProduct('MailHost', 1)
 
+_load_control_panel()
+_install_products()
+
 # So people can use ZopeLite.app()
 app = Zope2.app
 debug = Zope2.debug
@@ -153,9 +183,11 @@
 configure = Zope2.configure
 def startup(): pass
 
+# ZODB sandbox factory
 from ZODB.DemoStorage import DemoStorage
+
 def sandbox(base=None):
-    '''Returns what amounts to a sandbox copy of the base ZODB.'''
+    '''Returns a sandbox copy of the base ZODB.'''
     if base is None: base = Zope2.DB
     base_storage = base._storage
     quota = getattr(base_storage, '_quota', None)

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeTestCase.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeTestCase.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeTestCase.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,18 +1,29 @@
+##############################################################################
 #
-# Default test case & fixture for Zope testing
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# The fixture consists of:
+# 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.
 #
-#   - a folder (self.folder)
-#   - a user folder inside that folder
-#   - a default user inside the user folder
-#
-# The default user is logged in and has the 'Access contents information'
-# and 'View' permissions given to his role.
-#
+##############################################################################
+"""Default test case & fixture for Zope testing
 
-# $Id: ZopeTestCase.py,v 1.29 2005/02/09 12:42:40 shh42 Exp $
+The fixture consists of:
 
+  - a folder (self.folder)
+  - a user folder inside that folder
+  - a default user inside the user folder
+
+The default user is logged in and has the 'Access contents information'
+and 'View' permissions given to his role.
+
+$Id: ZopeTestCase.py,v 1.29 2005/02/09 12:42:40 shh42 Exp $
+"""
+
 import base
 import functional
 import interfaces
@@ -100,18 +111,7 @@
         '''Logs out.'''
         noSecurityManager()
 
-    # b/w compatibility methods
 
-    def _setRoles(self, roles, name=user_name):
-        self.setRoles(roles, name)
-    def _setPermissions(self, permissions, role=user_role):
-        self.setPermissions(permissions, role)
-    def _login(self, name=user_name):
-        self.login(name)
-    def _logout(self):
-        self.logout()
-
-
 class FunctionalTestCase(functional.Functional, ZopeTestCase):
     '''Base class for functional Zope tests'''
 
@@ -119,11 +119,6 @@
                       ZopeTestCase.__implements__)
 
 
-# b/w compatibility names
-_folder_name = folder_name
-_user_name = user_name
-_user_role = user_role
-_standard_permissions = standard_permissions
 from base import app
 from base import close
 from base import closeConnections

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,8 +1,19 @@
+##############################################################################
 #
-# Names exported by the ZopeTestCase package
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Names exported by the ZopeTestCase package
 
-# $Id: __init__.py,v 1.25 2005/02/22 14:59:16 shh42 Exp $
+$Id: __init__.py,v 1.25 2005/02/22 14:59:16 shh42 Exp $
+"""
 
 import ZopeLite as Zope2
 import utils
@@ -30,18 +41,11 @@
 from sandbox import Sandboxed
 from functional import Functional
 
-from warnhook import WarningsHook
+from ZODB.tests.warnhook import WarningsHook
 from unittest import main
 
-# TODO
-#from doctest import ZopeDocFileSuite
-#from doctest import FunctionalDocFileSuite
+from zopedoctest import ZopeDocTestSuite
+from zopedoctest import ZopeDocFileSuite
+from zopedoctest import FunctionalDocTestSuite
+from zopedoctest import FunctionalDocFileSuite
 
-# b/w compatibility names
-_folder_name = folder_name
-_user_name = user_name
-_user_role = user_role
-_standard_permissions = standard_permissions
-_portal_name = portal_name
-from base import closeConnections
-

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/base.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/base.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/base.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,8 +1,19 @@
+##############################################################################
 #
-# Test case for Zope testing
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""TestCase for Zope testing
 
-# $Id: base.py,v 1.1 2004/08/19 13:59:41 shh42 Exp $
+$Id: base.py,v 1.1 2004/08/19 13:59:41 shh42 Exp $
+"""
 
 import ZopeLite as Zope2
 

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/API.stx
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/API.stx	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/API.stx	2005-03-30 22:00:49 UTC (rev 29738)
@@ -55,8 +55,6 @@
 
         Functional
 
-        WarningsHook
-
     Modules
 
         ZopeLite as Zope
@@ -173,8 +171,8 @@
 
 Class FunctionalTestCase
 
-    Base class for functional unit tests
-    (derived from ZopeTestCase)
+    Convenience class for functional unit testing
+    (derived from Functional and ZopeTestCase)
 
     __implements__ = (Functional.__implements__,
                       ZopeTestCase.__implements__)
@@ -300,34 +298,6 @@
 
 
 
-Module warnhook
-
-    Support for capturing Python warning messages
-
-    Classes
-
-        WarningsHook
-
-
-
-Class WarningsHook
-
-    Facility to capture warnings generated by Python
-
-    Attributes
-
-        warnings
-
-    Methods
-
-        install()
-
-        uninstall()
-
-        clear()
-
-
-
 Module utils
 
     Utility functions to extend the test environment

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,3 +1,14 @@
+0.9.7 (Zope 2.8 edition)
+- Renamed 'doctest' package to 'zopedoctest' because of name-shadowing
+  issues discovered during integration into Zope 2.8.
+- Greatly improved the doctest story. ZopeTestCase now implements four test
+  suite factories: ZopeDocTestSuite, ZopeDocFileSuite, FunctionalDocTestSuite,
+  and FunctionalDocFileSuite.
+- Removed warnhook.py, we now use the one from ZODB.tests.
+- Removed doctest.py, we now use the one from zope.testing.
+- Removed dochttp.py + test, we now use the one from zope.app.tests.
+- ZopeLite now takes care not to monkey patch an already started Zope.
+
 0.9.6
 - Dropped support for Zope 2.5 as it lacks the setSecurityManager() API.
 - Moved interfaces from doc section to interfaces.py module.

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/HOWTO.stx
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/HOWTO.stx	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/HOWTO.stx	2005-03-30 22:00:49 UTC (rev 29738)
@@ -91,11 +91,11 @@
           Hooks for controlling transactions:
 
           - **'beforeSetUp'** is called before the ZODB connection is opened, at the start of setUp. 
-             The default behaviour of this hook is to call 'get_transaction().begin()'. 
+             The default behaviour of this hook is to call 'transaction.begin()'. 
              You will rarely want to override this.
 
           - **'beforeClose'** is called before the ZODB connection is closed, at the end of
-             tearDown. By default this method calls 'get_transaction().abort()' to discard
+             tearDown. By default this method calls 'transaction.abort()' to discard
              any changes made by the test. In some situations you may need to override 
              this hook and commit the transaction instead. Make sure you really know what 
              you are doing though.

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/framework.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/framework.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/framework.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,44 +1,53 @@
 ##############################################################################
 #
-# ZopeTestCase 
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# COPY THIS FILE TO YOUR 'tests' DIRECTORY.
+# 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.
 #
-# This version of framework.py will use the SOFTWARE_HOME
-# environment variable to locate Zope and the Testing package.
-#
-# If the tests are run in an INSTANCE_HOME installation of Zope,
-# Products.__path__ and sys.path with be adjusted to include the
-# instance's Products and lib/python directories respectively.
-#
-# If you explicitly set INSTANCE_HOME prior to running the tests,
-# auto-detection is disabled and the specified path will be used 
-# instead.
-#
-# If the 'tests' directory contains a custom_zodb.py file, INSTANCE_HOME
-# will be adjusted to use it.
-#
-# If you set the ZEO_INSTANCE_HOME environment variable a ZEO setup 
-# is assumed, and you can attach to a running ZEO server (via the 
-# instance's custom_zodb.py).
-#
 ##############################################################################
-#
-# The following code should be at the top of every test module:
-#
-# import os, sys
-# if __name__ == '__main__':
-#     execfile(os.path.join(sys.path[0], 'framework.py'))
-#
-# ...and the following at the bottom:
-#
-# if __name__ == '__main__':
-#     framework()
-#
-##############################################################################
+"""ZopeTestCase framework
 
-__version__ = '0.2.3'
+COPY THIS FILE TO YOUR 'tests' DIRECTORY.
 
+This version of framework.py will use the SOFTWARE_HOME
+environment variable to locate Zope and the Testing package.
+
+If the tests are run in an INSTANCE_HOME installation of Zope,
+Products.__path__ and sys.path with be adjusted to include the
+instance's Products and lib/python directories respectively.
+
+If you explicitly set INSTANCE_HOME prior to running the tests,
+auto-detection is disabled and the specified path will be used 
+instead.
+
+If the 'tests' directory contains a custom_zodb.py file, INSTANCE_HOME
+will be adjusted to use it.
+
+If you set the ZEO_INSTANCE_HOME environment variable a ZEO setup 
+is assumed, and you can attach to a running ZEO server (via the 
+instance's custom_zodb.py).
+
+The following code should be at the top of every test module:
+
+  import os, sys
+  if __name__ == '__main__':
+      execfile(os.path.join(sys.path[0], 'framework.py'))
+
+...and the following at the bottom:
+
+  if __name__ == '__main__':
+      framework()
+
+$Id:$
+"""
+
+__version__ = '0.2.4'
+
 # Save start state
 #
 __SOFTWARE_HOME = os.environ.get('SOFTWARE_HOME', '')

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/functional.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/functional.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/functional.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,10 +1,22 @@
+##############################################################################
 #
-# Support for functional unit testing in ZTC
-# After Marius Gedminas' functional.py module for Zope3.
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Support for functional unit testing in ZTC
 
-# $Id: functional.py,v 1.3 2004/09/12 16:49:59 shh42 Exp $
+After Marius Gedminas' functional.py module for Zope 3.
 
+$Id: functional.py,v 1.3 2004/09/12 16:49:59 shh42 Exp $
+"""
+
 import sys, re, base64
 import transaction
 import sandbox

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/interfaces.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/interfaces.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/interfaces.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,8 +1,19 @@
+##############################################################################
 #
-# ZopeTestCase interfaces
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""ZopeTestCase interfaces
 
-# $Id: interfaces.py,v 1.5 2005/02/07 21:59:35 shh42 Exp $
+$Id: interfaces.py,v 1.5 2005/02/07 21:59:35 shh42 Exp $
+"""
 
 try:
     from Interface import Interface

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/profiler.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/profiler.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/profiler.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,8 +1,19 @@
+##############################################################################
 #
-# Profiling support for ZTC
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Profiling support for ZTC
 
-# $Id: profiler.py,v 1.3 2005/01/01 14:02:44 shh42 Exp $
+$Id: profiler.py,v 1.3 2005/01/01 14:02:44 shh42 Exp $
+"""
 
 import os, sys
 import interfaces

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/runalltests.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/runalltests.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/runalltests.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,13 +1,25 @@
+##############################################################################
 #
-# Runs all tests in the current directory [and below]
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# Execute like:
-#   python runalltests.py [-R]
+# 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.
 #
-# Alternatively use the testrunner:
-#   python /path/to/Zope/bin/testrunner.py -qa
-#
+##############################################################################
+"""Runs all tests in the current directory [and below]
 
+Execute like:
+  python runalltests.py [-R]
+
+$Id:$
+"""
+
+__version__ = '0.2.1'
+
 import os, sys
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/sandbox.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/sandbox.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/sandbox.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,8 +1,19 @@
+##############################################################################
 #
-# Support for ZODB sandboxes in ZTC
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Support for ZODB sandboxes in ZTC
 
-# $Id: sandbox.py,v 1.2 2004/08/19 15:31:26 shh42 Exp $
+$Id: sandbox.py,v 1.2 2004/08/19 15:31:26 shh42 Exp $
+"""
 
 import ZopeLite as Zope2
 import transaction

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testBaseTestCase.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testBaseTestCase.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testBaseTestCase.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,16 +1,27 @@
+##############################################################################
 #
-# Tests the base.TestCase class
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# NOTE: This is *not* an example TestCase. Do not
-# use this file as a blueprint for your own tests!
+# 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.
 #
-# See testPythonScript.py and testShoppingCart.py for
-# example test cases. See testSkeleton.py for a quick
-# way of getting started.
-#
+##############################################################################
+"""Tests the base.TestCase class
 
-# $Id: testBaseTestCase.py,v 1.7 2005/02/09 12:42:40 shh42 Exp $
+NOTE: This is *not* an example TestCase. Do not
+use this file as a blueprint for your own tests!
 
+See testPythonScript.py and testShoppingCart.py for
+example test cases. See testSkeleton.py for a quick
+way of getting started.
+
+$Id: testBaseTestCase.py,v 1.7 2005/02/09 12:42:40 shh42 Exp $
+"""
+
 import os, sys
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testFunctional.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testFunctional.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testFunctional.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,8 +1,19 @@
+##############################################################################
 #
-# Example functional ZopeTestCase
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Example functional ZopeTestCase
 
-# $Id: testFunctional.py,v 1.16 2005/02/12 13:13:04 shh42 Exp $
+$Id: testFunctional.py,v 1.16 2005/02/12 13:13:04 shh42 Exp $
+"""
 
 import os, sys
 if __name__ == '__main__':

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testInterfaces.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testInterfaces.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testInterfaces.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,8 +1,19 @@
+##############################################################################
 #
-# Interface tests
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Interface tests
 
-# $Id: testInterfaces.py,v 1.3 2005/01/01 20:38:16 shh42 Exp $
+$Id: testInterfaces.py,v 1.3 2005/01/01 20:38:16 shh42 Exp $
+"""
 
 import os, sys
 if __name__ == '__main__':

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,16 +1,27 @@
+##############################################################################
 #
-# Tests the PortalTestCase
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# NOTE: This is *not* an example TestCase. Do not
-# use this file as a blueprint for your own tests!
+# 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.
 #
-# See testPythonScript.py and testShoppingCart.py for
-# example test cases. See testSkeleton.py for a quick
-# way of getting started.
-#
+##############################################################################
+"""Tests the PortalTestCase
 
-# $Id: testPortalTestCase.py,v 1.30 2005/01/30 14:22:48 shh42 Exp $
+NOTE: This is *not* an example TestCase. Do not
+use this file as a blueprint for your own tests!
 
+See testPythonScript.py and testShoppingCart.py for
+example test cases. See testSkeleton.py for a quick
+way of getting started.
+
+$Id: testPortalTestCase.py,v 1.30 2005/01/30 14:22:48 shh42 Exp $
+"""
+
 import os, sys
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testPythonScript.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testPythonScript.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testPythonScript.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,17 +1,28 @@
+##############################################################################
 #
-# Example ZopeTestCase testing a PythonScript object in the default fixture.
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# Note that you are encouraged to call any of the following methods
-# from your own tests to modify the test user's security credentials:
+# 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.
 #
-#   - setRoles()
-#   - setPermissions()
-#   - login()
-#   - logout()
-#
+##############################################################################
+"""Example ZopeTestCase testing a PythonScript object in the default fixture
 
-# $Id: testPythonScript.py,v 1.9 2004/04/09 12:38:37 shh42 Exp $
+Note that you are encouraged to call any of the following methods
+from your own tests to modify the test user's security credentials:
 
+  - setRoles()
+  - setPermissions()
+  - login()
+  - logout()
+
+$Id: testPythonScript.py,v 1.9 2004/04/09 12:38:37 shh42 Exp $
+"""
+
 import os, sys
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testShoppingCart.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testShoppingCart.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testShoppingCart.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,15 +1,26 @@
+##############################################################################
 #
-# Example ZopeTestCase testing the ShoppingCart example application.
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# Note the use of sessions and how the SESSION object is added to
-# the REQUEST in afterSetUp().
+# 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.
 #
-# You can use zLOG.LOG() if you set up the event log variables first.
-# Handy for debugging and tracing your tests.
-#
+##############################################################################
+"""Example ZopeTestCase testing the ShoppingCart example application.
 
-# $Id: testShoppingCart.py,v 1.11 2005/02/23 17:14:56 shh42 Exp $
+Note the use of sessions and how the SESSION object is added to
+the REQUEST in afterSetUp().
 
+You can use zLOG.LOG() if you set up the event log variables first.
+Handy for debugging and tracing your tests.
+
+$Id: testShoppingCart.py,v 1.11 2005/02/23 17:14:56 shh42 Exp $
+"""
+
 import os, sys
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testSkeleton.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testSkeleton.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testSkeleton.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,7 +1,20 @@
+##############################################################################
 #
-# Skeleton ZopeTestCase
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Skeleton ZopeTestCase
 
+$Id:$
+"""
+
 import os, sys
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testWebserver.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testWebserver.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testWebserver.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,23 +1,34 @@
+##############################################################################
 #
-# Example ZopeTestCase testing web access to a freshly started ZServer.
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# Note that we need to set up the error_log before starting the ZServer.
+# 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.
 #
-# Note further that the test thread needs to explicitly commit its
-# transactions, so the ZServer threads can see modifications made to
-# the ZODB.
-#
-# IF YOU THINK YOU NEED THE WEBSERVER STARTED YOU ARE PROBABLY WRONG!
-# This is only required in very special cases, like when testing
-# ZopeXMLMethods where XSLT processing is done by external tools that
-# need to URL-call back into the Zope server.
-#
-# If you want to write functional unit tests, see the testFunctional.py 
-# example instead.
-#
+##############################################################################
+"""Example ZopeTestCase testing web access to a freshly started ZServer
 
-# $Id: testWebserver.py,v 1.16 2005/02/12 13:11:10 shh42 Exp $
+Note that we need to set up the error_log before starting the ZServer.
 
+Note further that the test thread needs to explicitly commit its
+transactions, so the ZServer threads can see modifications made to
+the ZODB.
+
+IF YOU THINK YOU NEED THE WEBSERVER STARTED YOU ARE PROBABLY WRONG!
+This is only required in very special cases, like when testing
+ZopeXMLMethods where XSLT processing is done by external tools that
+need to URL-call back into the Zope server.
+
+If you want to write functional unit tests, see the testFunctional.py 
+example instead.
+
+$Id: testWebserver.py,v 1.16 2005/02/12 13:11:10 shh42 Exp $
+"""
+
 import os, sys
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testZODBCompat.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testZODBCompat.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testZODBCompat.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,13 +1,24 @@
+##############################################################################
 #
-# Tests ZODB behavior in ZopeTestCase
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# Demonstrates that cut/copy/paste/clone/rename and import/export 
-# work in ZopeTestCase if a subtransaction is commited before performing
-# the respective operations.
+# 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.
 #
+##############################################################################
+"""Tests ZODB behavior in ZopeTestCase
 
-# $Id: testZODBCompat.py,v 1.17 2004/04/09 12:38:37 shh42 Exp $
+Demonstrates that cut/copy/paste/clone/rename and import/export 
+work in ZopeTestCase if a subtransaction is commited before performing
+the respective operations.
 
+$Id: testZODBCompat.py,v 1.17 2004/04/09 12:38:37 shh42 Exp $
+"""
+
 import os, sys
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testZopeTestCase.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testZopeTestCase.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testZopeTestCase.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,16 +1,27 @@
+##############################################################################
 #
-# Tests the ZopeTestCase, eating its own dogfood
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# NOTE: This is *not* an example TestCase. Do not
-# use this file as a blueprint for your own tests!
+# 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.
 #
-# See testPythonScript.py and testShoppingCart.py for
-# example test cases. See testSkeleton.py for a quick
-# way of getting started.
-#
+##############################################################################
+"""Tests the ZopeTestCase, eating its own dogfood
 
-# $Id: testZopeTestCase.py,v 1.25 2005/01/30 14:22:48 shh42 Exp $
+NOTE: This is *not* an example TestCase. Do not
+use this file as a blueprint for your own tests!
 
+See testPythonScript.py and testShoppingCart.py for
+example test cases. See testSkeleton.py for a quick
+way of getting started.
+
+$Id: testZopeTestCase.py,v 1.25 2005/01/30 14:22:48 shh42 Exp $
+"""
+
 import os, sys
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/threadutils.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/threadutils.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/threadutils.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,9 +1,20 @@
+##############################################################################
 #
-# Parts of ZServer support are in this module so they can
-# be imported more selectively.
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Parts of ZServer support are in this module so they can
+be imported more selectively.
 
-# $Id: threadutils.py,v 1.6 2004/08/19 15:31:26 shh42 Exp $
+$Id: threadutils.py,v 1.6 2004/08/19 15:31:26 shh42 Exp $
+"""
 
 from threading import Thread
 from StringIO import StringIO

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/utils.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/utils.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/utils.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,14 +1,30 @@
+##############################################################################
 #
-# Utility functions
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# These functions are designed to be imported and run at
-# module level to add functionality to the test environment.
+# 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.
 #
+##############################################################################
+"""Utility functions
 
-# $Id: utils.py,v 1.21 2005/02/11 09:00:21 shh42 Exp $
+These functions are designed to be imported and run at
+module level to add functionality to the test environment.
 
+$Id: utils.py,v 1.21 2005/02/11 09:00:21 shh42 Exp $
+"""
+
+import os
+import sys
+import time
+import random
 import transaction
 
+
 def setupCoreSessions(app=None):
     '''Sets up the session_data_manager e.a.'''
     from Acquisition import aq_base
@@ -19,7 +35,7 @@
 
     if not hasattr(app, 'temp_folder'):
         from Products.TemporaryFolder.TemporaryFolder import MountedTemporaryFolder
-        tf = MountedTemporaryFolder('temp_folder','Temporary Folder')
+        tf = MountedTemporaryFolder('temp_folder', 'Temporary Folder')
         app._setObject('temp_folder', tf)
         commit = 1
 
@@ -79,8 +95,6 @@
             transaction.commit()
 
 
-import os, time
-
 def importObjectFromFile(container, filename, quiet=0):
     '''Imports an object from a (.zexp) file into the given container.'''
     from ZopeLite import _print
@@ -98,7 +112,6 @@
     '''Starts an HTTP ZServer thread.'''
     global _Z2HOST, _Z2PORT
     if _Z2HOST is None:
-        import random
         _Z2HOST = '127.0.0.1'
         _Z2PORT = random.choice(range(55000, 55500))
         from ZServer import setNumberOfThreads
@@ -111,8 +124,6 @@
     return _Z2HOST, _Z2PORT
 
 
-import sys
-
 def makerequest(app, stdout=sys.stdout):
     '''Wraps the app into a fresh REQUEST.'''
     from ZPublisher.BaseRequest import RequestContainer

Deleted: Zope/trunk/lib/python/Testing/ZopeTestCase/warnhook.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/warnhook.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/warnhook.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,57 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 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.
-#
-##############################################################################
-import warnings
-
-class WarningsHook:
-    """Hook to capture warnings generated by Python.
-
-    The function warnings.showwarning() is designed to be hooked by
-    application code, allowing the application to customize the way it
-    handles warnings.
-
-    This hook captures the unformatted warning information and stored
-    it in a list.  A test can inspect this list after the test is over.
-
-    Issues:
-
-    The warnings module has lots of delicate internal state.  If
-    a warning has been reported once, it won't be reported again.  It
-    may be necessary to extend this class with a mechanism for
-    modifying the internal state so that we can be guaranteed a
-    warning will be reported.
-
-    If Python is run with a warnings filter, e.g. python -Werror,
-    then a test that is trying to inspect a particular warning will
-    fail.  Perhaps this class can be extended to install more-specific
-    filters the test to work anyway.
-    """
-
-    def __init__(self):
-        self.original = None
-        self.warnings = []
-
-    def install(self):
-        self.original = warnings.showwarning
-        warnings.showwarning = self.showwarning
-
-    def uninstall(self):
-        assert self.original is not None
-        warnings.showwarning = self.original
-        self.original = None
-
-    def showwarning(self, message, category, filename, lineno):
-        self.warnings.append((str(message), category, filename, lineno))
-
-    def clear(self):
-        self.warnings = []

Copied: Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest (from rev 29727, Zope/branches/five-integration/lib/python/Testing/ZopeTestCase/zopedoctest)

Copied: Zope/trunk/lib/python/Testing/ZopeTestCase/zopetest (from rev 29727, Zope/branches/five-integration/lib/python/Testing/ZopeTestCase/zopetest)

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/ztc_common.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/ztc_common.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/ztc_common.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1,15 +1,25 @@
+##############################################################################
 #
-# ztc_common.py
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
 #
-# This file must be called from framework.py like so
+# 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.
 #
-#   execfile(os.path.join(os.path.dirname(Testing.__file__),
-#            'ZopeTestCase', 'ztc_common.py'))
-#
+##############################################################################
+"""ztc_common.py
 
-# $Id: ztc_common.py,v 1.14 2004/05/27 15:06:24 shh42 Exp $
+This file must be called from framework.py like so
 
+  execfile(os.path.join(os.path.dirname(Testing.__file__),
+           'ZopeTestCase', 'ztc_common.py'))
 
+$Id: ztc_common.py,v 1.14 2004/05/27 15:06:24 shh42 Exp $
+"""
+
 # Overwrites the default framework() method to expose the
 # TestRunner parameters and add profiler support.
 #

Modified: Zope/trunk/lib/python/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/HTTPRequest.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/lib/python/ZPublisher/HTTPRequest.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -1336,7 +1336,17 @@
     def taintWrapper(self, enabled=TAINTING_ENABLED):
         return enabled and TaintRequestWrapper(self) or self
 
+    # Used by Five
 
+    def getPresentationSkin(self):
+        """see zope.component.interfaces.IPresentationRequest"""
+        return getattr(self, '_presentation_skin', None)
+
+    def setPresentationSkin(self, skin):
+        """see zope.publisher.interfaces.IPublicationRequest"""
+        self._presentation_skin = skin
+
+
 class TaintRequestWrapper:
     def __init__(self, req):
         self._req = req

Modified: Zope/trunk/setup.py
===================================================================
--- Zope/trunk/setup.py	2005-03-30 21:06:56 UTC (rev 29737)
+++ Zope/trunk/setup.py	2005-03-30 22:00:49 UTC (rev 29738)
@@ -166,7 +166,7 @@
         distutils.core.Distribution.__init__(self, attrs)
         self.cmdclass["install"] = ZopeInstall
         self.cmdclass["install_data"] = ZopeInstallData
-        
+
 # presumes this script lives in the base dir
 BASE_DIR=os.path.dirname(os.path.abspath(sys.argv[0]))
 
@@ -502,9 +502,12 @@
     name='Testing',
     author=AUTHOR,
 
-    packages=['Testing', 'Testing.ZopeTestCase'],
+    packages=['Testing', 'Testing.ZopeTestCase',
+              'Testing.ZopeTestCase.zopetest', 'Testing.ZopeTestCase.zopedoctest'],
     data_files=[['Testing', ['Testing/README.txt']],
-                ['Testing/var', ['Testing/var/README.txt']]],
+                ['Testing/var', ['Testing/var/README.txt']],
+                ['Testing/ZopeTestCase/doc', ['Testing/ZopeTestCase/doc/*']],
+                ['Testing/ZopeTestCase/zopedoctest', ['Testing/ZopeTestCase/zopedoctest/*.txt']]],
     )
 
 # ThreadedAsync
@@ -1082,6 +1085,221 @@
     )
 
 
+setup(
+    name='Five',
+    author='Martijn Faassen',
+
+    packages=['Products.Five', 'Products.Five.tests'],
+    data_files=[['Products/Five', ['Products/Five/*']],
+                ['Products/Five/doc', ['Products/Five/doc/*']],
+                ['Products/Five/skel', ['Products/Five/skel/*']],
+                ['Products/Five/tests', ['Products/Five/tests/*']],
+                ],
+    )
+
+
+
+# Zope 3 / Five integration layer support. Note that in addition to the
+# Five package itself, we also pull in several modules from the Zope 3
+# heirarchy: zope, persistent, transaction. Most of this is ripped from
+# the Zope 3 setup.py.
+
+from distutils import dir_util
+from distutils.command.build import build as buildcmd
+from distutils.command.build_ext import build_ext
+from distutils.command.install_lib import install_lib as installcmd
+from distutils.core import setup
+from distutils.dist import Distribution
+from distutils.extension import Extension
+
+if sys.version_info < (2, 3):
+    _setup = setup
+    def setup(**kwargs):
+        if kwargs.has_key("classifiers"):
+            del kwargs["classifiers"]
+        _setup(**kwargs)
+
+
+# A hack to determine if Extension objects support the `depends' keyword arg,
+# which only exists in Python 2.3's distutils.
+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 "depends" in kwargs:
+                del kwargs["depends"]
+            _Extension.__init__(self, name, sources, **kwargs)
+
+
+# We have to snoop for file types that distutils doesn't copy correctly when
+# doing a non-build-in-place.
+EXTS = ['.conf', '.css', '.dtd', '.gif', '.jpg', '.html',
+        '.js',   '.mo',  '.png', '.pt', '.stx', '.ref',
+        '.txt',  '.xml', '.zcml', '.mar', '.in', '.sample',
+        ]
+IGNORE_NAMES = (
+    'CVS', '.svn', # Revision Control Directories
+    )
+
+# This class serves multiple purposes.  It walks the file system looking for
+# auxiliary files that distutils doesn't install properly, and it actually
+# copies those files (when hooked into by distutils).  It also walks the file
+# system looking for candidate packages for distutils to install as normal.
+# The key here is that the package must have an __init__.py file.
+class Finder:
+    def __init__(self, exts, prefix):
+        self._files = []
+        self._pkgs = {}
+        self._exts = exts
+        # We're finding packages in lib/python in the source dir, but we're
+        # copying them directly under build/lib.<plat>.  So we need to lop off
+        # the prefix when calculating the package names from the file names.
+        prefix, rest = os.path.split(prefix)
+        self._plen = len(prefix) + 1
+
+    def visit(self, ignore, dir, files):
+        # Remove ignored filenames
+        for ignore in IGNORE_NAMES:
+            if ignore in files:
+                files.remove(ignore)
+        for file in files:
+            # First see if this is one of the packages we want to add, or if
+            # we're really skipping this package.
+            if '__init__.py' in files:
+                aspkg = dir[self._plen:].replace(os.sep, '.')
+                self._pkgs[aspkg] = True
+            # Add any extra files we're interested in
+            base, ext = os.path.splitext(file)
+            if ext in self._exts:
+                self._files.append(os.path.join(dir, file))
+
+    def copy_files(self, cmd, outputbase):
+        for file in self._files:
+            dest = os.path.join(outputbase, file[self._plen:])
+            # Make sure the destination directory exists
+            dir = os.path.dirname(dest)
+            if not os.path.exists(dir):
+                dir_util.mkpath(dir)
+            cmd.copy_file(file, dest)
+
+    def get_packages(self):
+        return self._pkgs.keys()
+
+def remove_stale_bytecode(arg, dirname, names):
+    names = map(os.path.normcase, names)
+    for name in names:
+        if name.endswith(".pyc") or name.endswith(".pyo"):
+            srcname = name[:-1]
+            if srcname not in names:
+                fullname = os.path.join(dirname, name)
+                print "Removing stale bytecode file", fullname
+                os.unlink(fullname)
+
+# This bit uses the finder to crawl through the zope3 packages we need
+# and Do The Right Thing to arrange for setup for sub-packages.
+z3_packages = ['zope']
+packages = []
+
+for name in z3_packages:
+    basedir = os.path.join(PACKAGES_ROOT, name)
+    finder = Finder(EXTS, basedir)
+    os.path.walk(basedir, finder.visit, None)
+    packages.extend(finder.get_packages())
+
+# Distutils hook classes
+class MyBuilder(buildcmd):
+    def run(self):
+        os.path.walk(os.curdir, remove_stale_bytecode, None)
+        buildcmd.run(self)
+        finder.copy_files(self, self.build_lib)
+
+class MyExtBuilder(build_ext):
+    # Override the default build_ext to remove stale bytecodes.
+    # Technically, removing bytecode has nothing to do with
+    # building extensions, but Zope's the build_ext -i variant
+    # is used to build Zope in place.
+    def run(self):
+        os.path.walk(os.curdir, remove_stale_bytecode, None)
+        build_ext.run(self)
+
+class MyLibInstaller(installcmd):
+    def run(self):
+        installcmd.run(self)
+        finder.copy_files(self, self.install_dir)
+
+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['install'] = ZopeInstall
+        self.cmdclass['build'] = MyBuilder
+        self.cmdclass['build_ext'] = MyExtBuilder
+        self.cmdclass['install_lib'] = MyLibInstaller
+
+
+# All Zope3 extension modules must be listed here.
+ext_modules = [
+
+    Extension("zope.proxy._zope_proxy_proxy",
+              ["zope/proxy/_zope_proxy_proxy.c"],
+              include_dirs = ["zope/proxy"],
+              depends = ["zope/proxy/proxy.h"]),
+
+    Extension("zope.security._proxy", ["zope/security/_proxy.c"],
+              include_dirs = ["zope/proxy"],
+              depends = ["zope/proxy/proxy.h"]),
+
+    Extension("zope.security._zope_security_checker",
+              ["zope/security/_zope_security_checker.c"],
+              include_dirs = [],
+              depends = []),
+
+    Extension("zope.interface._zope_interface_coptimizations",
+              ["zope/interface/_zope_interface_coptimizations.c"]),
+
+    Extension("zope.hookable._zope_hookable",
+              ["zope/hookable/_zope_hookable.c"]),
+
+    Extension("zope.thread._zope_thread",
+              ["zope/thread/_zope_thread.c"]),
+
+    Extension("zope.app.container._zope_app_container_contained",
+              ["zope/app/container/_zope_app_container_contained.c"],
+              include_dirs = ["persistent",
+                              "zope/proxy",
+                              "zope/app/container"],
+              depends = [
+                 "persistent/cPersistence.h",
+                 "zope/proxy/_zope_proxy_proxy.c",
+                 ]),
+
+    ]
+
+# We're using the module docstring as the distutils descriptions.
+doclines = __doc__.split("\n")
+
+setup(name="zopex30",
+      version="X3.0",
+      maintainer="Zope Corporation",
+      maintainer_email="zope3-dev at zope.org",
+      url = "http://dev.zope.org/Zope3/",
+      ext_modules = ext_modules,
+      license = "http://www.zope.org/Resources/ZPL",
+      platforms = ["any"],
+      description = doclines[0],
+      long_description = "\n".join(doclines[2:]),
+      packages = packages,
+      distclass = MyDistribution,
+      )
+
+
+
+
+
 # Call distutils setup with all lib/python packages and modules, and
 # flush setup_info.  Wondering why we run py_modules separately?  So am I.
 # Distutils won't let us specify packages and py_modules in the same call.
@@ -1109,8 +1327,9 @@
 os.chdir(BASE_DIR)
 
 def skel_visit(skel, dirname, names):
-    if "CVS" in names:
-        names.remove("CVS")
+    for ignore in IGNORE_NAMES:
+        if ignore in names:
+            names.remove(ignore)
     L = []
     for name in names:
         if os.path.isfile(os.path.join(dirname, name)):



More information about the Zope-Checkins mailing list