[Checkins] SVN: zc.zope3recipes/trunk/ make tests pass with newer buildouts

Fred Drake cvs-admin at zope.org
Tue Feb 5 20:25:08 UTC 2013


Log message for revision 129138:
  make tests pass with newer buildouts

Changed:
  U   zc.zope3recipes/trunk/buildout.cfg
  U   zc.zope3recipes/trunk/zc/zope3recipes/README.txt
  U   zc.zope3recipes/trunk/zc/zope3recipes/recipes.py
  U   zc.zope3recipes/trunk/zc/zope3recipes/tests.py

-=-
Modified: zc.zope3recipes/trunk/buildout.cfg
===================================================================
--- zc.zope3recipes/trunk/buildout.cfg	2013-02-05 17:01:37 UTC (rev 129137)
+++ zc.zope3recipes/trunk/buildout.cfg	2013-02-05 20:25:07 UTC (rev 129138)
@@ -1,7 +1,11 @@
 [buildout]
 parts = test
 develop = .
+versions = versions
 
 [test]
 recipe = zc.recipe.testrunner
 eggs = zc.zope3recipes [tests]
+
+[versions]
+zc.recipe.testrunner = 1.3.0

Modified: zc.zope3recipes/trunk/zc/zope3recipes/README.txt
===================================================================
--- zc.zope3recipes/trunk/zc/zope3recipes/README.txt	2013-02-05 17:01:37 UTC (rev 129137)
+++ zc.zope3recipes/trunk/zc/zope3recipes/README.txt	2013-02-05 20:25:07 UTC (rev 129138)
@@ -97,7 +97,7 @@
     import zope.app.twisted.main
     <BLANKLINE>
     if __name__ == '__main__':
-        zope.app.twisted.main.main()
+        sys.exit(zope.app.twisted.main.main())
 
 Here, unlike the above example the location path is not included
 in ``sys.path``.  Similarly debugzope script is also changed:
@@ -118,7 +118,7 @@
     import zc.zope3recipes.debugzope
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main)
+        sys.exit(zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main))
 
 The ``initialization`` setting can be used to provide a bit of
 additional code that will be included in the runzope and debugzope
@@ -165,7 +165,7 @@
     import zope.app.twisted.main
     <BLANKLINE>
     if __name__ == '__main__':
-        zope.app.twisted.main.main()
+        sys.exit(zope.app.twisted.main.main())
 
     >>> cat('parts', 'myapp', 'debugzope')
     #!/usr/local/bin/python2.4
@@ -184,7 +184,7 @@
     import zc.zope3recipes.debugzope
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main)
+        sys.exit(zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main))
 
 If the additional initialization for debugzope needs to be different
 from that of runzope, the ``debug-initialization`` setting can be used.
@@ -234,7 +234,7 @@
     import zc.zope3recipes.debugzope
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main)
+        sys.exit(zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main))
 
 The runzope script still uses the ``initialization`` setting::
 
@@ -252,7 +252,7 @@
     import zope.app.twisted.main
     <BLANKLINE>
     if __name__ == '__main__':
-        zope.app.twisted.main.main()
+        sys.exit(zope.app.twisted.main.main())
 
 Setting ``debug-initialization`` to an empty string suppresses the
 ``initialization`` setting for the debugzope script:
@@ -298,7 +298,7 @@
     import zc.zope3recipes.debugzope
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main)
+        sys.exit(zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main))
 
 
 Relative paths
@@ -362,7 +362,7 @@
     import zope.app.twisted.main
     <BLANKLINE>
     if __name__ == '__main__':
-        zope.app.twisted.main.main()
+        sys.exit(zope.app.twisted.main.main())
 
 Similarly, debugzope script has relative paths.
 
@@ -389,7 +389,7 @@
     import zc.zope3recipes.debugzope
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main)
+        sys.exit(zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main))
 
 
 Building Zope 3 Applications (from Zope 3 checkouts/tarballs)
@@ -512,7 +512,7 @@
     import zope.app.twisted.main
     <BLANKLINE>
     if __name__ == '__main__':
-        zope.app.twisted.main.main()
+        sys.exit(zope.app.twisted.main.main())
 
 It includes in it's path the eggs we specified in the configuration
 file, along with their dependencies. Note that we haven't specified a
@@ -551,7 +551,7 @@
     import zc.zope3recipes.debugzope
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main)
+        sys.exit(zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main))
 
 Note that the runzope shown above uses the default, twisted-based
 server components.  It's possible to specify which set of server
@@ -614,7 +614,7 @@
     import zope.app.twisted.main
     <BLANKLINE>
     if __name__ == '__main__':
-        zope.app.twisted.main.main()
+        sys.exit(zope.app.twisted.main.main())
 
 We can also specify the ZServer servers explicitly:
 
@@ -670,7 +670,7 @@
     import zope.app.server.main
     <BLANKLINE>
     if __name__ == '__main__':
-        zope.app.server.main.main()
+        sys.exit(zope.app.server.main.main())
 
 The debugzope script has also been modified to take this into account.
 
@@ -691,7 +691,7 @@
     import zc.zope3recipes.debugzope
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.debugzope.debug(main_module=zope.app.server.main)
+        sys.exit(zc.zope3recipes.debugzope.debug(main_module=zope.app.server.main))
 
 
 Relative paths
@@ -757,7 +757,7 @@
     import zope.app.server.main
     <BLANKLINE>
     if __name__ == '__main__':
-        zope.app.server.main.main()
+        sys.exit(zope.app.server.main.main())
 
 The debugzope script also has relative paths.
 
@@ -785,7 +785,7 @@
     import zc.zope3recipes.debugzope
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.debugzope.debug(main_module=zope.app.server.main)
+        sys.exit(zc.zope3recipes.debugzope.debug(main_module=zope.app.server.main))
 
 
 Legacy Functional Testing Support
@@ -1568,12 +1568,12 @@
     import zc.zope3recipes.ctl
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.ctl.main([
+        sys.exit(zc.zope3recipes.ctl.main([
             '/sample-buildout/parts/myapp/debugzope',
             '/sample-buildout/parts/instance/zope.conf',
             '-C', '/sample-buildout/parts/instance/zdaemon.conf',
             ]+sys.argv[1:]
-            )
+            ))
 
 Some configuration sections can include a key multiple times; the ZEO
 client section works this way.  When a key is given multiple times,
@@ -2458,12 +2458,12 @@
     import zc.zope3recipes.ctl
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.ctl.main([
+        sys.exit(zc.zope3recipes.ctl.main([
             join(base, 'parts/myapp/debugzope'),
             join(base, 'parts/instance/zope.conf'),
             '-C', join(base, 'parts/instance/zdaemon.conf'),
             ]+sys.argv[1:]
-            )
+            ))
 
 
 zope.conf recipe
@@ -2703,7 +2703,6 @@
     ...
 
 
-
 Offline recipe
 ==============
 
@@ -3162,7 +3161,7 @@
     import paste.script.command
     <BLANKLINE>
     if __name__ == '__main__':
-        paste.script.command.run(['serve']+sys.argv[1:])
+        sys.exit(paste.script.command.run(['serve']+sys.argv[1:]))
 
 
     >>> cat('parts', 'instance', 'zope.conf')

Modified: zc.zope3recipes/trunk/zc/zope3recipes/recipes.py
===================================================================
--- zc.zope3recipes/trunk/zc/zope3recipes/recipes.py	2013-02-05 17:01:37 UTC (rev 129137)
+++ zc.zope3recipes/trunk/zc/zope3recipes/recipes.py	2013-02-05 20:25:07 UTC (rev 129138)
@@ -41,6 +41,11 @@
     WIN = True
 
 
+def get_executable(section):
+    # Support older multi-python buildouts, and newer mono-python buildouts.
+    return section.get("executable") or sys.executable
+
+
 class Application(object):
 
     def __init__(self, buildout, name, options):
@@ -99,7 +104,7 @@
 
             zc.buildout.easy_install.scripts(
                 reqs,
-                ws, options['executable'], dest,
+                ws, get_executable(options), dest,
                 scripts=scripts,
                 extra_paths=extra_paths.split(),
                 arguments=arguments,
@@ -120,7 +125,7 @@
             arguments = 'main_module=%s' % server_module
             zc.buildout.easy_install.scripts(
                 [('debugzope', 'zc.zope3recipes.debugzope', 'debug')],
-                ws, options['executable'], dest,
+                ws, get_executable(options), dest,
                 extra_paths = options['extra-paths'].split(),
                 initialization = initialization,
                 arguments = arguments,
@@ -480,7 +485,7 @@
             if WIN:
                 zc.buildout.easy_install.scripts(
                     [(rc, 'zc.zope3recipes.winctl', 'main')],
-                    ws, options['executable'], options['bin-directory'],
+                    ws, get_executable(options), options['bin-directory'],
                     extra_paths=[this_loc],
                     arguments=arguments,
                     relative_paths=self.egg._relative_paths,
@@ -488,7 +493,7 @@
             else:
                 zc.buildout.easy_install.scripts(
                     [(rc, 'zc.zope3recipes.ctl', 'main')],
-                    ws, options['executable'], options['bin-directory'],
+                    ws, get_executable(options), options['bin-directory'],
                     extra_paths=[this_loc],
                     arguments=arguments,
                     relative_paths=self.egg._relative_paths,
@@ -710,7 +715,7 @@
             self.environment = dict(buildout[env])
         else:
             self.environment = {}
-        options["executable"] = self.app["executable"]
+        options["executable"] = get_executable(self.app)
         zope_conf = buildout[options["zope.conf"]]
         options["zope.conf-location"] =  zope_conf["location"]
         script = options.get("script")

Modified: zc.zope3recipes/trunk/zc/zope3recipes/tests.py
===================================================================
--- zc.zope3recipes/trunk/zc/zope3recipes/tests.py	2013-02-05 17:01:37 UTC (rev 129137)
+++ zc.zope3recipes/trunk/zc/zope3recipes/tests.py	2013-02-05 20:25:07 UTC (rev 129138)
@@ -242,6 +242,10 @@
     (re.compile('-\S+-py\d[.]\d(-\S+)?.egg'),
      '-pyN.N.egg',
     ),
+    # Turn "distribute" into "setuptools" so the tests can pass with either:
+    (re.compile(r'\bdistribute-pyN\.N\.egg'),
+     'setuptools-pyN.N.egg',
+    ),
     ])
 
 



More information about the checkins mailing list