[Checkins] SVN: zope3book/trunk/code/ Added example code in various chapters
Baiju M
baiju.m.mail at gmail.com
Sun Feb 22 22:25:21 EST 2009
Log message for revision 97125:
Added example code in various chapters
Changed:
A zope3book/trunk/code/
A zope3book/trunk/code/01_introduction/
A zope3book/trunk/code/02_getting_started/
A zope3book/trunk/code/02_getting_started/others/
A zope3book/trunk/code/02_getting_started/others/default.cfg
A zope3book/trunk/code/02_getting_started/stage1/
A zope3book/trunk/code/02_getting_started/stage1/ticketcollector/
A zope3book/trunk/code/02_getting_started/stage1/ticketcollector/bootstrap/
A zope3book/trunk/code/02_getting_started/stage1/ticketcollector/bootstrap/bootstrap.py
A zope3book/trunk/code/02_getting_started/stage1/ticketcollector/buildout.cfg
A zope3book/trunk/code/02_getting_started/stage1/ticketcollector/setup.py
A zope3book/trunk/code/02_getting_started/stage1/ticketcollector/src/
A zope3book/trunk/code/02_getting_started/stage1/ticketcollector/src/ticketcollector/
A zope3book/trunk/code/02_getting_started/stage1/ticketcollector/src/ticketcollector/__init__.py
A zope3book/trunk/code/02_getting_started/stage2/
A zope3book/trunk/code/02_getting_started/stage2/ticketcollector/
A zope3book/trunk/code/02_getting_started/stage2/ticketcollector/bootstrap/
A zope3book/trunk/code/02_getting_started/stage2/ticketcollector/bootstrap/bootstrap.py
A zope3book/trunk/code/02_getting_started/stage2/ticketcollector/buildout.cfg
A zope3book/trunk/code/02_getting_started/stage2/ticketcollector/setup.py
A zope3book/trunk/code/02_getting_started/stage2/ticketcollector/src/
A zope3book/trunk/code/02_getting_started/stage2/ticketcollector/src/ticketcollector/
A zope3book/trunk/code/02_getting_started/stage2/ticketcollector/src/ticketcollector/__init__.py
A zope3book/trunk/code/02_getting_started/stage2/ticketcollector/src/ticketcollector/application.zcml
A zope3book/trunk/code/02_getting_started/stage3/
A zope3book/trunk/code/02_getting_started/stage3/ticketcollector/
A zope3book/trunk/code/02_getting_started/stage3/ticketcollector/bootstrap/
A zope3book/trunk/code/02_getting_started/stage3/ticketcollector/bootstrap/bootstrap.py
A zope3book/trunk/code/02_getting_started/stage3/ticketcollector/buildout.cfg
A zope3book/trunk/code/02_getting_started/stage3/ticketcollector/setup.py
A zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/
A zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/
A zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/__init__.py
A zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/application.zcml
A zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/browser.py
A zope3book/trunk/code/03_development_tools/
A zope3book/trunk/code/03_development_tools/stage1/
A zope3book/trunk/code/03_development_tools/stage1/explore-zope.component/
A zope3book/trunk/code/03_development_tools/stage1/explore-zope.component/bootstrap/
A zope3book/trunk/code/03_development_tools/stage1/explore-zope.component/bootstrap/bootstrap.py
A zope3book/trunk/code/03_development_tools/stage1/explore-zope.component/buildout.cfg
A zope3book/trunk/code/03_development_tools/stage2/
A zope3book/trunk/code/03_development_tools/stage2/hello/
A zope3book/trunk/code/03_development_tools/stage2/hello/bootstrap/
A zope3book/trunk/code/03_development_tools/stage2/hello/bootstrap/bootstrap.py
A zope3book/trunk/code/03_development_tools/stage2/hello/buildout.cfg
A zope3book/trunk/code/03_development_tools/stage2/hello/setup.py
A zope3book/trunk/code/03_development_tools/stage2/hello/src/
A zope3book/trunk/code/03_development_tools/stage2/hello/src/hello/
A zope3book/trunk/code/03_development_tools/stage2/hello/src/hello/__init__.py
A zope3book/trunk/code/03_development_tools/stage2/hello/src/hello/say.py
A zope3book/trunk/code/04_interfaces/
A zope3book/trunk/code/05_component_architecture/
-=-
Added: zope3book/trunk/code/02_getting_started/others/default.cfg
===================================================================
--- zope3book/trunk/code/02_getting_started/others/default.cfg (rev 0)
+++ zope3book/trunk/code/02_getting_started/others/default.cfg 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,4 @@
+[buildout]
+newest = false
+eggs-directory = /home/baiju/eggs
+find-links = http://download.zope.org/ppix
Added: zope3book/trunk/code/02_getting_started/stage1/ticketcollector/bootstrap/bootstrap.py
===================================================================
--- zope3book/trunk/code/02_getting_started/stage1/ticketcollector/bootstrap/bootstrap.py (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage1/ticketcollector/bootstrap/bootstrap.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# 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 75593 2007-05-06 21:11:27Z jim $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+try:
+ import pkg_resources
+except ImportError:
+ 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
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ 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)
Added: zope3book/trunk/code/02_getting_started/stage1/ticketcollector/buildout.cfg
===================================================================
--- zope3book/trunk/code/02_getting_started/stage1/ticketcollector/buildout.cfg (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage1/ticketcollector/buildout.cfg 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,10 @@
+[buildout]
+develop = .
+parts = py
+extends = http://download.zope.org/zope3.4/3.4.0/versions.cfg
+versions = versions
+
+[py]
+recipe = zc.recipe.egg
+eggs = ticketcollector
+interpreter = python
Added: zope3book/trunk/code/02_getting_started/stage1/ticketcollector/setup.py
===================================================================
--- zope3book/trunk/code/02_getting_started/stage1/ticketcollector/setup.py (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage1/ticketcollector/setup.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,17 @@
+from setuptools import setup, find_packages
+
+setup(
+ name='ticketcollector',
+ version='0.1',
+
+ packages=find_packages('src'),
+ package_dir={'': 'src'},
+
+ install_requires=['setuptools',
+ 'zope.app.zcmlfiles',
+ 'zope.app.twisted',
+ 'zope.app.securitypolicy',
+ ],
+ include_package_data=True,
+ zip_safe=False,
+ )
Added: zope3book/trunk/code/02_getting_started/stage1/ticketcollector/src/ticketcollector/__init__.py
===================================================================
--- zope3book/trunk/code/02_getting_started/stage1/ticketcollector/src/ticketcollector/__init__.py (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage1/ticketcollector/src/ticketcollector/__init__.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1 @@
+#Python package\n
Added: zope3book/trunk/code/02_getting_started/stage2/ticketcollector/bootstrap/bootstrap.py
===================================================================
--- zope3book/trunk/code/02_getting_started/stage2/ticketcollector/bootstrap/bootstrap.py (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage2/ticketcollector/bootstrap/bootstrap.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# 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 75593 2007-05-06 21:11:27Z jim $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+try:
+ import pkg_resources
+except ImportError:
+ 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
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ 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)
Added: zope3book/trunk/code/02_getting_started/stage2/ticketcollector/buildout.cfg
===================================================================
--- zope3book/trunk/code/02_getting_started/stage2/ticketcollector/buildout.cfg (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage2/ticketcollector/buildout.cfg 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,22 @@
+[buildout]
+develop = .
+parts = ticketcollectorapp instance
+extends = http://download.zope.org/zope3.4/3.4.0/versions.cfg
+versions = versions
+
+[zope3]
+location =
+
+[ticketcollectorapp]
+recipe = zc.zope3recipes:app
+site.zcml =
+ <include package="ticketcollector" file="application.zcml" />
+eggs = ticketcollector
+
+[instance]
+recipe = zc.zope3recipes:instance
+application = ticketcollectorapp
+zope.conf = ${database:zconfig}
+
+[database]
+recipe = zc.recipe.filestorage
Added: zope3book/trunk/code/02_getting_started/stage2/ticketcollector/setup.py
===================================================================
--- zope3book/trunk/code/02_getting_started/stage2/ticketcollector/setup.py (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage2/ticketcollector/setup.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,17 @@
+from setuptools import setup, find_packages
+
+setup(
+ name='ticketcollector',
+ version='0.1',
+
+ packages=find_packages('src'),
+ package_dir={'': 'src'},
+
+ install_requires=['setuptools',
+ 'zope.app.zcmlfiles',
+ 'zope.app.twisted',
+ 'zope.app.securitypolicy',
+ ],
+ include_package_data=True,
+ zip_safe=False,
+ )
Added: zope3book/trunk/code/02_getting_started/stage2/ticketcollector/src/ticketcollector/__init__.py
===================================================================
--- zope3book/trunk/code/02_getting_started/stage2/ticketcollector/src/ticketcollector/__init__.py (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage2/ticketcollector/src/ticketcollector/__init__.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1 @@
+#Python package\n
Added: zope3book/trunk/code/02_getting_started/stage2/ticketcollector/src/ticketcollector/application.zcml
===================================================================
--- zope3book/trunk/code/02_getting_started/stage2/ticketcollector/src/ticketcollector/application.zcml (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage2/ticketcollector/src/ticketcollector/application.zcml 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,55 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="zope"
+ >
+<include package="zope.app.securitypolicy" file="meta.zcml" />
+
+<include package="zope.app.zcmlfiles" />
+<include package="zope.app.authentication" />
+<include package="zope.app.securitypolicy" />
+<include package="zope.app.twisted" />
+
+<securityPolicy
+ component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+
+<role id="zope.Anonymous" title="Everybody"
+ description="All users have this role implicitly" />
+<role id="zope.Manager" title="Site Manager" />
+<role id="zope.Member" title="Site Member" />
+
+<grant permission="zope.View"
+ role="zope.Anonymous" />
+<grant permission="zope.app.dublincore.view"
+ role="zope.Anonymous" />
+
+<grantAll role="zope.Manager" />
+
+<unauthenticatedPrincipal
+ id="zope.anybody"
+ title="Unauthenticated User" />
+
+<unauthenticatedGroup
+ id="zope.Anybody"
+ title="Unauthenticated Users" />
+
+<authenticatedGroup
+ id="zope.Authenticated"
+ title="Authenticated Users" />
+
+<everybodyGroup
+ id="zope.Everybody"
+ title="All Users" />
+
+<principal
+ id="zope.manager"
+ title="Manager"
+ login="admin"
+ password_manager="Plain Text"
+ password="admin"
+ />
+
+<grant
+ role="zope.Manager"
+ principal="zope.manager" />
+
+</configure>
Added: zope3book/trunk/code/02_getting_started/stage3/ticketcollector/bootstrap/bootstrap.py
===================================================================
--- zope3book/trunk/code/02_getting_started/stage3/ticketcollector/bootstrap/bootstrap.py (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage3/ticketcollector/bootstrap/bootstrap.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# 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 75593 2007-05-06 21:11:27Z jim $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+try:
+ import pkg_resources
+except ImportError:
+ 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
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ 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)
Added: zope3book/trunk/code/02_getting_started/stage3/ticketcollector/buildout.cfg
===================================================================
--- zope3book/trunk/code/02_getting_started/stage3/ticketcollector/buildout.cfg (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage3/ticketcollector/buildout.cfg 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,19 @@
+[buildout]
+develop = .
+parts = ticketcollectorapp instance
+
+[zope3]
+location =
+
+[ticketcollectorapp]
+recipe = zc.zope3recipes:app
+site.zcml = <include package="ticketcollector" file="application.zcml" />
+eggs = ticketcollector
+
+[instance]
+recipe = zc.zope3recipes:instance
+application = ticketcollectorapp
+zope.conf = ${database:zconfig}
+
+[database]
+recipe = zc.recipe.filestorage
Added: zope3book/trunk/code/02_getting_started/stage3/ticketcollector/setup.py
===================================================================
--- zope3book/trunk/code/02_getting_started/stage3/ticketcollector/setup.py (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage3/ticketcollector/setup.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,17 @@
+from setuptools import setup, find_packages
+
+setup(
+ name='ticketcollector',
+ version='0.1',
+
+ packages=find_packages('src'),
+ package_dir={'': 'src'},
+
+ install_requires=['setuptools',
+ 'zope.app.zcmlfiles',
+ 'zope.app.twisted',
+ 'zope.app.securitypolicy',
+ ],
+ include_package_data=True,
+ zip_safe=False,
+ )
Added: zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/__init__.py
===================================================================
--- zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/__init__.py (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/__init__.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1 @@
+#Python package\n
Added: zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/application.zcml
===================================================================
--- zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/application.zcml (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/application.zcml 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,63 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ i18n_domain="zope"
+ >
+<include package="zope.app.securitypolicy" file="meta.zcml" />
+
+<include package="zope.app.zcmlfiles" />
+<include package="zope.app.authentication" />
+<include package="zope.app.securitypolicy" />
+<include package="zope.app.twisted" />
+
+<securityPolicy
+ component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+
+<role id="zope.Anonymous" title="Everybody"
+ description="All users have this role implicitly" />
+<role id="zope.Manager" title="Site Manager" />
+<role id="zope.Member" title="Site Member" />
+
+<grant permission="zope.View"
+ role="zope.Anonymous" />
+<grant permission="zope.app.dublincore.view"
+ role="zope.Anonymous" />
+
+<grantAll role="zope.Manager" />
+
+<unauthenticatedPrincipal
+ id="zope.anybody"
+ title="Unauthenticated User" />
+
+<unauthenticatedGroup
+ id="zope.Anybody"
+ title="Unauthenticated Users" />
+
+<authenticatedGroup
+ id="zope.Authenticated"
+ title="Authenticated Users" />
+
+<everybodyGroup
+ id="zope.Everybody"
+ title="All Users" />
+
+<principal
+ id="zope.manager"
+ title="Manager"
+ login="admin"
+ password_manager="Plain Text"
+ password="admin"
+ />
+
+<grant
+ role="zope.Manager"
+ principal="zope.manager" />
+
+<browser:page
+ for="*"
+ name="hello"
+ permission="zope.Public"
+ class="ticketcollector.browser.HelloView"
+/>
+
+</configure>
Added: zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/browser.py
===================================================================
--- zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/browser.py (rev 0)
+++ zope3book/trunk/code/02_getting_started/stage3/ticketcollector/src/ticketcollector/browser.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,15 @@
+from zope.publisher.browser import BrowserView
+
+class HelloView(BrowserView):
+
+ def __call__(self):
+ return """
+ <html>
+ <head>
+ <title>Hello World</title>
+ </head>
+ <body>
+ Hello World
+ </body>
+ </html>
+ """
Added: zope3book/trunk/code/03_development_tools/stage1/explore-zope.component/bootstrap/bootstrap.py
===================================================================
--- zope3book/trunk/code/03_development_tools/stage1/explore-zope.component/bootstrap/bootstrap.py (rev 0)
+++ zope3book/trunk/code/03_development_tools/stage1/explore-zope.component/bootstrap/bootstrap.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# 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 75593 2007-05-06 21:11:27Z jim $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+try:
+ import pkg_resources
+except ImportError:
+ 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
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ 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)
Added: zope3book/trunk/code/03_development_tools/stage1/explore-zope.component/buildout.cfg
===================================================================
--- zope3book/trunk/code/03_development_tools/stage1/explore-zope.component/buildout.cfg (rev 0)
+++ zope3book/trunk/code/03_development_tools/stage1/explore-zope.component/buildout.cfg 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,8 @@
+#Buildout configuration
+[buildout]
+parts = py
+
+[py]
+recipe = zc.recipe.egg
+interpreter = mypython
+eggs = zope.component
Added: zope3book/trunk/code/03_development_tools/stage2/hello/bootstrap/bootstrap.py
===================================================================
--- zope3book/trunk/code/03_development_tools/stage2/hello/bootstrap/bootstrap.py (rev 0)
+++ zope3book/trunk/code/03_development_tools/stage2/hello/bootstrap/bootstrap.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# 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 75593 2007-05-06 21:11:27Z jim $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+try:
+ import pkg_resources
+except ImportError:
+ 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
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ 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)
Added: zope3book/trunk/code/03_development_tools/stage2/hello/buildout.cfg
===================================================================
--- zope3book/trunk/code/03_development_tools/stage2/hello/buildout.cfg (rev 0)
+++ zope3book/trunk/code/03_development_tools/stage2/hello/buildout.cfg 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,10 @@
+#Buildout configuration
+[buildout]
+develop = .
+parts = py
+
+[py]
+recipe = zc.recipe.egg
+scripts = print_hello
+eggs = hello
+
Added: zope3book/trunk/code/03_development_tools/stage2/hello/setup.py
===================================================================
--- zope3book/trunk/code/03_development_tools/stage2/hello/setup.py (rev 0)
+++ zope3book/trunk/code/03_development_tools/stage2/hello/setup.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,16 @@
+from setuptools import setup, find_packages
+
+setup(
+ name='hello',
+ version='0.1',
+
+ packages=find_packages('src'),
+ package_dir={'': 'src'},
+
+ install_requires=['setuptools',
+ ],
+ entry_points = {'console_scripts':
+ ['print_hello = hello.say:say_hello']},
+ include_package_data=True,
+ zip_safe=False,
+ )
Added: zope3book/trunk/code/03_development_tools/stage2/hello/src/hello/__init__.py
===================================================================
--- zope3book/trunk/code/03_development_tools/stage2/hello/src/hello/__init__.py (rev 0)
+++ zope3book/trunk/code/03_development_tools/stage2/hello/src/hello/__init__.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1 @@
+#Python package
Added: zope3book/trunk/code/03_development_tools/stage2/hello/src/hello/say.py
===================================================================
--- zope3book/trunk/code/03_development_tools/stage2/hello/src/hello/say.py (rev 0)
+++ zope3book/trunk/code/03_development_tools/stage2/hello/src/hello/say.py 2009-02-23 03:25:20 UTC (rev 97125)
@@ -0,0 +1,2 @@
+def say_hello():
+ print "Hello"
More information about the Checkins
mailing list