[Zope3-checkins] SVN: zdaemon/trunk/ convert to a zc.buildout-based buildout

Fred L. Drake, Jr. fdrake at gmail.com
Fri Sep 22 23:39:06 EDT 2006


Log message for revision 70352:
  convert to a zc.buildout-based buildout

Changed:
  _U  zdaemon/trunk/
  U   zdaemon/trunk/README.txt
  A   zdaemon/trunk/bootstrap.py
  A   zdaemon/trunk/buildout.cfg
  A   zdaemon/trunk/setup.py
  _U  zdaemon/trunk/src/
  U   zdaemon/trunk/src/zdaemon/tests/testzdoptions.py
  U   zdaemon/trunk/src/zdaemon/tests/testzdrun.py
  D   zdaemon/trunk/src/zope/

-=-

Property changes on: zdaemon/trunk
___________________________________________________________________
Name: svn:ignore
   - *so
*.pyc
build

   + .installed.cfg
build
develop-eggs
dist
eggs
bin
parts


Modified: zdaemon/trunk/README.txt
===================================================================
--- zdaemon/trunk/README.txt	2006-09-22 16:51:33 UTC (rev 70351)
+++ zdaemon/trunk/README.txt	2006-09-23 03:39:04 UTC (rev 70352)
@@ -1,5 +1,5 @@
-zdaemon Package REZDME
-======================
+``zdaemon`` process controller
+==============================
 
 Overview
 --------

Added: zdaemon/trunk/bootstrap.py
===================================================================
--- zdaemon/trunk/bootstrap.py	2006-09-22 16:51:33 UTC (rev 70351)
+++ zdaemon/trunk/bootstrap.py	2006-09-23 03:39:04 UTC (rev 70352)
@@ -0,0 +1,48 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id: bootstrap.py 68905 2006-06-29 10:46:56Z jim $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                     ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+    os.P_WAIT, sys.executable, sys.executable,
+    '-c', 'from setuptools.command.easy_install import main; main()',
+    '-mqNxd', tmpeggs, 'zc.buildout',
+    {'PYTHONPATH':
+     ws.find(pkg_resources.Requirement.parse('setuptools')).location
+     },
+    ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)


Property changes on: zdaemon/trunk/bootstrap.py
___________________________________________________________________
Name: svn:mime-type
   + text/x-python
Name: svn:eol-style
   + native

Added: zdaemon/trunk/buildout.cfg
===================================================================
--- zdaemon/trunk/buildout.cfg	2006-09-22 16:51:33 UTC (rev 70351)
+++ zdaemon/trunk/buildout.cfg	2006-09-23 03:39:04 UTC (rev 70352)
@@ -0,0 +1,8 @@
+[buildout]
+develop = .
+parts = test
+find-links = http://download.zope.org/distribution/
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = zdaemon


Property changes on: zdaemon/trunk/buildout.cfg
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: zdaemon/trunk/setup.py
===================================================================
--- zdaemon/trunk/setup.py	2006-09-22 16:51:33 UTC (rev 70351)
+++ zdaemon/trunk/setup.py	2006-09-23 03:39:04 UTC (rev 70352)
@@ -0,0 +1,21 @@
+try:
+    from setuptools import setup
+except ImportError:
+    from distutils.core import setup
+
+setup(
+    name="zdaemon",
+    version="1.3",
+    url="http://svn.zope.org/zdaemon",
+    license="ZPL 2.1",
+    description="daemon process control library and tools",
+    long_description=open("README.txt").read(),
+    author="Zope Corporation and Contributors",
+    author_email="zope3-dev at zope.org",
+
+    packages=["zdaemon", "zdaemon.tests"],
+    package_dir={"": "src"},
+    include_package_data=True,
+    install_requires=["ZConfig", "zope.testing"],
+    zip_safe=False,
+    )


Property changes on: zdaemon/trunk/setup.py
___________________________________________________________________
Name: svn:mime-type
   + text/x-python
Name: svn:eol-style
   + native


Property changes on: zdaemon/trunk/src
___________________________________________________________________
Name: svn:externals
   - ZConfig -r 39096 svn://svn.zope.org/repos/main/ZConfig/trunk/ZConfig

Name: svn:ignore
   + zdaemon.egg-info


Modified: zdaemon/trunk/src/zdaemon/tests/testzdoptions.py
===================================================================
--- zdaemon/trunk/src/zdaemon/tests/testzdoptions.py	2006-09-22 16:51:33 UTC (rev 70351)
+++ zdaemon/trunk/src/zdaemon/tests/testzdoptions.py	2006-09-23 03:39:04 UTC (rev 70352)
@@ -79,18 +79,34 @@
             self.assertEqual(options.configfile, configfile)
 
     def test_help(self):
-        for arg in "-h", "--h", "--help":
-            options = self.OptionsClass()
-            try:
-                self.save_streams()
-                try:
-                    options.realize([arg])
-                finally:
-                    self.restore_streams()
-            except SystemExit, err:
-                self.assertEqual(err.code, 0)
-            else:
-                self.fail("%s didn't call sys.exit()" % repr(arg))
+        # __main__.__doc__ is used as the default source of the help
+        # text; specific text can also be provided in the `doc`
+        # keyword arg to `realize()`.  It must be provided in one of
+        # those places.
+        import __main__
+        old_doc = __main__.__doc__
+        __main__.__doc__ = "Example help text 1."
+        try:
+            for arg in "-h", "--h", "--help":
+                for doc in (None, "Example help text 2."):
+                    options = self.OptionsClass()
+                    try:
+                        self.save_streams()
+                        try:
+                            if doc:
+                                options.realize([arg], doc=doc)
+                            else:
+                                options.realize([arg])
+                        finally:
+                            self.restore_streams()
+                    except SystemExit, err:
+                        self.assertEqual(err.code, 0)
+                    else:
+                        self.fail("%s didn't call sys.exit()" % repr(arg))
+                    helptext = self.stdout.getvalue()
+                    self.assertEqual(helptext, doc or __main__.__doc__)
+        finally:
+            __main__.__doc__ = old_doc
 
     def test_unrecognized(self):
         # Check that we get an error for an unrecognized option

Modified: zdaemon/trunk/src/zdaemon/tests/testzdrun.py
===================================================================
--- zdaemon/trunk/src/zdaemon/tests/testzdrun.py	2006-09-22 16:51:33 UTC (rev 70351)
+++ zdaemon/trunk/src/zdaemon/tests/testzdrun.py	2006-09-23 03:39:04 UTC (rev 70352)
@@ -131,8 +131,11 @@
 ##         self.expect = "Sent SIGTERM\nSent SIGTERM; will exit later\n"
 
     def testHelp(self):
+        # XXX We shouldn't mutate and leave our change in!
+        import __main__
+        if not __main__.__doc__:
+            __main__.__doc__ = "Example help text."
         self._run("-h")
-        import __main__
         self.expect = __main__.__doc__
 
     def testOptionsSysArgv(self):



More information about the Zope3-Checkins mailing list