[Checkins] SVN: zc.catalog/trunk/ make the browser subpackage an optional dependency. as a result, projects that do not need the ZMI views to be registered, will not pull in zope.app.* packages anymore.

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Oct 18 04:52:56 EDT 2010


Log message for revision 117624:
  make the browser subpackage an optional dependency. as a result, projects that do not need the ZMI views to be registered, will not pull in zope.app.* packages anymore.

Changed:
  U   zc.catalog/trunk/CHANGES.txt
  U   zc.catalog/trunk/buildout.cfg
  U   zc.catalog/trunk/setup.py
  U   zc.catalog/trunk/src/zc/catalog/browser/configure.zcml
  U   zc.catalog/trunk/src/zc/catalog/browser/ftesting.zcml
  U   zc.catalog/trunk/src/zc/catalog/browser/tests.py
  U   zc.catalog/trunk/src/zc/catalog/configure.zcml

-=-
Modified: zc.catalog/trunk/CHANGES.txt
===================================================================
--- zc.catalog/trunk/CHANGES.txt	2010-10-18 08:02:02 UTC (rev 117623)
+++ zc.catalog/trunk/CHANGES.txt	2010-10-18 08:52:55 UTC (rev 117624)
@@ -5,9 +5,27 @@
 The 1.2 line (and higher) supports Zope 3.4/ZODB 3.8.  The 1.1 line supports
 Zope 3.3/ZODB 3.7.
 
-1.4.6 (unreleased)
-------------------
+1.5 (unreleased)
+----------------
 
+- The package's ``configure.zcml`` does not include the browser subpackage's
+  ``configure.zcml`` anymore.
+
+  This, together with ``browser`` and ``test_browser`` ``extras_require``,
+  decouples the browser view registrations from the main code. As a result
+  projects that do not need the ZMI views to be registered are not pulling in
+  the zope.app.* dependencies anymore.
+
+  To enable the ZMI views for your project, you will have to do two things:
+
+  * list ``zc.catalog [browser]`` as a ``install_requires``.
+
+  * have your project's ``configure.zcml`` include the ``zc.catalog.browser``
+    subpackage.
+
+- Only include the browser tests whenever the dependencies for the browser
+  tests are available.
+
 - Python2.7 test fix.
 
 

Modified: zc.catalog/trunk/buildout.cfg
===================================================================
--- zc.catalog/trunk/buildout.cfg	2010-10-18 08:02:02 UTC (rev 117623)
+++ zc.catalog/trunk/buildout.cfg	2010-10-18 08:52:55 UTC (rev 117624)
@@ -2,11 +2,18 @@
 extends =
     http://download.zope.org/zopetoolkit/index/1.0c3/zopeapp-versions.cfg
     http://download.zope.org/zopetoolkit/index/1.0c3/ztk-versions.cfg
-parts = test
+parts =
+  test
+  test_no_browser
 versions = versions
 develop = .
 
 [test]
 recipe = zc.recipe.testrunner
+eggs = zc.catalog [test, browser, test_browser]
+defaults = "--exit-with-status".split()
+
+[test_no_browser]
+recipe = zc.recipe.testrunner
 eggs = zc.catalog [test]
 defaults = "--exit-with-status".split()

Modified: zc.catalog/trunk/setup.py
===================================================================
--- zc.catalog/trunk/setup.py	2010-10-18 08:02:02 UTC (rev 117623)
+++ zc.catalog/trunk/setup.py	2010-10-18 08:52:55 UTC (rev 117624)
@@ -66,31 +66,40 @@
       package_dir = {'': 'src'},
       namespace_packages=['zc'],
       extras_require=dict(
-           test=['zope.app.authentication',
-                 'zope.app.catalog',
-                 'zope.app.server',
-                 'zope.app.testing',
-                 'zope.app.zcmlfiles',
-                 'zope.intid',
-                 'zope.keyreference',
-                 'zope.login',
-                 'zope.securitypolicy',
-                 'zope.testbrowser',
-                 'zope.testing',
-                 ]),
-      install_requires=['ZODB3',
-                        'pytz',
-                        'setuptools',
-                        'zope.catalog',
-                        'zope.component',
-                        'zope.container',
-                        'zope.i18nmessageid',
-                        'zope.index>=3.5.1',
-                        'zope.interface',
-                        'zope.publisher >= 3.12',
-                        'zope.schema',
-                        'zope.security',
-                        ],
+          test=[
+              'zope.intid',
+              'zope.keyreference',
+              'zope.login',
+              'zope.securitypolicy',
+              'zope.testbrowser',
+              'zope.testing',
+              ],
+          browser=[
+              'zope.app.form',
+              'zope.browsermenu',
+              ],
+          test_browser=[
+              'zope.app.appsetup',
+              'zope.app.authentication',
+              'zope.app.catalog',
+              'zope.app.server',
+              'zope.app.testing',
+              'zope.app.zcmlfiles',
+              ]),
+      install_requires=[
+          'ZODB3',
+          'pytz',
+          'setuptools',
+          'zope.catalog',
+          'zope.component',
+          'zope.container',
+          'zope.i18nmessageid',
+          'zope.index>=3.5.1',
+          'zope.interface',
+          'zope.publisher >= 3.12',
+          'zope.schema',
+          'zope.security',
+          ],
       include_package_data = True,
       zip_safe = False,
       )

Modified: zc.catalog/trunk/src/zc/catalog/browser/configure.zcml
===================================================================
--- zc.catalog/trunk/src/zc/catalog/browser/configure.zcml	2010-10-18 08:02:02 UTC (rev 117623)
+++ zc.catalog/trunk/src/zc/catalog/browser/configure.zcml	2010-10-18 08:52:55 UTC (rev 117624)
@@ -5,6 +5,10 @@
    >
 
   <!-- UI for SetIndex -->
+  <include package="zope.app.form.browser" file="meta.zcml" />
+  <include package="zope.app.form.browser"/>
+  <include package="zope.browsermenu" file="meta.zcml" />
+  <include package="zope.browsermenu"/>
 
   <addform
       name="AddSetIndex"

Modified: zc.catalog/trunk/src/zc/catalog/browser/ftesting.zcml
===================================================================
--- zc.catalog/trunk/src/zc/catalog/browser/ftesting.zcml	2010-10-18 08:02:02 UTC (rev 117623)
+++ zc.catalog/trunk/src/zc/catalog/browser/ftesting.zcml	2010-10-18 08:52:55 UTC (rev 117624)
@@ -5,23 +5,16 @@
     i18n_domain="zc.catalog"
     >
 
-  <include
-      zcml:condition="installed zope.app.zcmlfiles"
-      package="zope.app.zcmlfiles"
-      />
-  <include
-      zcml:condition="not-installed zope.app.zcmlfiles"
-      package="zope.app"
-      />
-
+  <include package="zope.app.zcmlfiles" />
   <include package="zope.app.authentication" />
   <include package="zope.app.server" />
   <include package="zope.keyreference" />
   <include package="zope.intid" />
   <include package="zope.app.catalog" />
   <include package="zope.login" />
-  <include package="zc.catalog" />
 
+  <include package="zc.catalog" />
+  <include package="zc.catalog.browser" />
   <subscriber handler="zc.catalog.browser.tests.initializeIntIds" />
 
   <!-- Security -->
@@ -48,7 +41,6 @@
 
   <grantAll role="zope.Manager" />
 
-
   <unauthenticatedPrincipal id="zope.anybody" title="Unauthenticated User" />
 
   <principal id="zope.mgr" title="Manager" login="mgr" password="mgrpw" />

Modified: zc.catalog/trunk/src/zc/catalog/browser/tests.py
===================================================================
--- zc.catalog/trunk/src/zc/catalog/browser/tests.py	2010-10-18 08:02:02 UTC (rev 117623)
+++ zc.catalog/trunk/src/zc/catalog/browser/tests.py	2010-10-18 08:52:55 UTC (rev 117624)
@@ -18,45 +18,46 @@
 import doctest
 import os.path
 import unittest
-
 import transaction
-
-import zope.app.appsetup.bootstrap
-import zope.app.appsetup.interfaces
-import zope.app.testing.functional
 import zope.intid
 import zope.intid.interfaces
 
+try:
+    # Only include the functional tests whenever the required dependencies
+    # are installed.
+    import zope.app.appsetup.bootstrap
+    import zope.app.appsetup.interfaces
+    import zope.app.testing.functional
 
-here = os.path.dirname(os.path.realpath(__file__))
+    here = os.path.dirname(os.path.realpath(__file__))
 
-ZcCatalogLayer = zope.app.testing.functional.ZCMLLayer(
-    os.path.join(here, "ftesting.zcml"), __name__, "ZcCatalogLayer")
+    ZcCatalogLayer = zope.app.testing.functional.ZCMLLayer(
+        os.path.join(here, "ftesting.zcml"), __name__, "ZcCatalogLayer")
 
+    @zope.component.adapter(
+        zope.app.appsetup.interfaces.IDatabaseOpenedWithRootEvent)
+    def initializeIntIds(event):
+        db, connection, root, root_folder = (
+            zope.app.appsetup.bootstrap.getInformationFromEvent(event))
+        sm = root_folder.getSiteManager()
+        intids = zope.intid.IntIds()
+        sm["default"]["test-int-ids"] = intids
+        sm.registerUtility(
+            intids,
+            zope.intid.interfaces.IIntIds)
+        transaction.commit()
+        connection.close()
 
- at zope.component.adapter(
-    zope.app.appsetup.interfaces.IDatabaseOpenedWithRootEvent)
-#
-def initializeIntIds(event):
-    db, connection, root, root_folder = (
-        zope.app.appsetup.bootstrap.getInformationFromEvent(event))
-    sm = root_folder.getSiteManager()
-    intids = zope.intid.IntIds()
-    sm["default"]["test-int-ids"] = intids
-    sm.registerUtility(
-        intids,
-        zope.intid.interfaces.IIntIds)
-    transaction.commit()
-    connection.close()
+    def test_suite():
+        suite = zope.app.testing.functional.FunctionalDocFileSuite(
+            "README.txt",
+            optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE)
+        suite.layer = ZcCatalogLayer
+        return suite
 
+except (ImportError,), e:
+    def test_suite():
+        return unittest.TestSuite()
 
-def test_suite():
-    suite = zope.app.testing.functional.FunctionalDocFileSuite(
-        "README.txt",
-        optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE)
-    suite.layer = ZcCatalogLayer
-    return suite
-
-
 if __name__ == "__main__":
     unittest.main(defaultTest="test_suite")

Modified: zc.catalog/trunk/src/zc/catalog/configure.zcml
===================================================================
--- zc.catalog/trunk/src/zc/catalog/configure.zcml	2010-10-18 08:02:02 UTC (rev 117623)
+++ zc.catalog/trunk/src/zc/catalog/configure.zcml	2010-10-18 08:52:55 UTC (rev 117624)
@@ -69,9 +69,4 @@
         />
   </class>
 
-  <include
-      zcml:condition="installed zope.app.form"
-      package=".browser"
-      />
-
 </configure>



More information about the checkins mailing list