[Checkins] SVN: grokproject/trunk/src/grokproject/ Update project
template for eggified grok.
Philipp von Weitershausen
philikon at philikon.de
Thu Jul 12 09:11:58 EDT 2007
Log message for revision 77732:
Update project template for eggified grok.
Changed:
U grokproject/trunk/src/grokproject/__init__.py
_U grokproject/trunk/src/grokproject/template/
U grokproject/trunk/src/grokproject/template/buildout.cfg_tmpl
U grokproject/trunk/src/grokproject/template/setup.py_tmpl
U grokproject/trunk/src/grokproject/template/src/+package+/configure.zcml
A grokproject/trunk/src/grokproject/template/src/+package+/ftesting.zcml_tmpl
A grokproject/trunk/src/grokproject/template/src/+package+/testing.py_tmpl
-=-
Modified: grokproject/trunk/src/grokproject/__init__.py
===================================================================
--- grokproject/trunk/src/grokproject/__init__.py 2007-07-12 13:08:21 UTC (rev 77731)
+++ grokproject/trunk/src/grokproject/__init__.py 2007-07-12 13:11:57 UTC (rev 77732)
@@ -1,7 +1,9 @@
import sys
import os.path
import optparse
-import ConfigParser
+import shutil
+import tempfile
+import pkg_resources
from paste.script import templates, command
from paste.script.templates import var, NoDefault
@@ -28,32 +30,6 @@
raise command.BadCommand('Bad module name: %s' % module)
return vars
- def post(self, command, output_dir, vars):
- if 'zope3' in vars:
- # This means the user supplied the --with-zope3 parameter
- # and has a pre-installed Zope 3 lying around. Let's edit
- # buildout.cfg so that it doesn't download Zope 3 but uses
- # the existing one.
- buildout_cfg = os.path.join(os.path.abspath(output_dir),
- 'buildout.cfg')
- cfg = ConfigParser.ConfigParser()
- cfg.read(buildout_cfg)
-
- # remove 'zope3' from the list of parts as we don't have
- # to build Zope 3 anymore
- parts = cfg.get('buildout', 'parts').split()
- parts.remove('zope3')
- cfg.set('buildout', 'parts', ' '.join(parts))
-
- # add a 'location' attribute to the 'zope3' section that
- # points to the Zope 3 installation. For clarity, we also
- # remove all other things from the section.
- for name in cfg.options('zope3'):
- cfg.remove_option('zope3', name)
- cfg.set('zope3', 'location', vars['zope3'])
-
- cfg.write(open(buildout_cfg, 'w'))
-
def main():
usage = "usage: %prog [options] PROJECT"
parser = optparse.OptionParser(usage=usage)
@@ -64,10 +40,6 @@
help="Import project to given repository location (this "
"will also create the standard trunk/ tags/ branches/ "
"hierarchy)")
- parser.add_option('--with-zope3', dest="zope3", default=None,
- help="Location of an existing Zope 3 installation. If "
- "provided, grokproject will not download and install "
- "Zope 3 itself.")
options, args = parser.parse_args()
if len(args) != 1:
parser.print_usage()
@@ -82,27 +54,37 @@
extra_args = []
if options.repos is not None:
extra_args.extend(['--svn-repository', options.repos])
- if options.zope3 is not None:
- zope3 = os.path.expanduser(options.zope3)
- # TODO do some sanity checks here to see if the directory
- # actually exists and is a Zope 3 installation
-
- # add the path to the Zope 3 installation to the variables so
- # that the template has access to it.
- extra_args.append('zope3=%s' % zope3)
exit_code = runner.run(['-t', 'grokproject', project] + extra_args)
# TODO exit_code
if options.no_buildout:
return
- # bootstrap the buildout
os.chdir(project)
- bootstrap_py = os.path.join(os.getcwd(), 'bootstrap', 'bootstrap.py')
- assert os.spawnle(os.P_WAIT, sys.executable, sys.executable,
- bootstrap_py, os.environ) == 0
- # run the buildout
- bin_buildout = os.path.join(os.getcwd(), 'bin', 'buildout')
- assert os.spawnle(os.P_WAIT, sys.executable, sys.executable, bin_buildout,
- os.environ) == 0
+ try:
+ import zc.buildout.buildout
+ except ImportError:
+ print "Downloading zc.buildout..."
+
+ # Install buildout into a temporary location
+ import setuptools.command.easy_install
+ tmpdir = tempfile.mkdtemp()
+ sys.path.append(tmpdir)
+ setuptools.command.easy_install.main(['-mNxd', tmpdir, 'zc.buildout'])
+
+ # Add downloaded buildout to PYTHONPATH by requiring it
+ # through setuptools (this dance is necessary because the
+ # temporary installation was done as multi-version).
+ ws = pkg_resources.working_set
+ ws.add_entry(tmpdir)
+ ws.require('zc.buildout')
+
+ import zc.buildout.buildout
+ zc.buildout.buildout.main(['bootstrap'])
+ shutil.rmtree(tmpdir)
+ else:
+ zc.buildout.buildout.main(['bootstrap'])
+
+ print "Invoking zc.buildout..."
+ zc.buildout.buildout.main(['install'])
Property changes on: grokproject/trunk/src/grokproject/template
___________________________________________________________________
Name: svn:externals
- bootstrap svn://svn.zope.org/repos/main/zc.buildout/trunk/bootstrap
Modified: grokproject/trunk/src/grokproject/template/buildout.cfg_tmpl
===================================================================
--- grokproject/trunk/src/grokproject/template/buildout.cfg_tmpl 2007-07-12 13:08:21 UTC (rev 77731)
+++ grokproject/trunk/src/grokproject/template/buildout.cfg_tmpl 2007-07-12 13:11:57 UTC (rev 77732)
@@ -1,52 +1,61 @@
[buildout]
develop = .
-parts = zope3 data instance test
+parts = app data instance test
+find-links = http://download.zope.org/distribution/
[zope3]
-recipe = zc.recipe.cmmi
-extra_options = --with-python=$${buildout:executable} --force
-url = http://www.zope.org/Products/Zope3/3.3.1/Zope-3.3.1.tgz
+# this dead chicken is needed by some other recipe(s)
+location =
[data]
recipe = zc.recipe.filestorage
+[app]
+recipe = zc.zope3recipes:app
+eggs = ${egg}
+site.zcml = <include package="${package}" />
+ <include package="zope.app.twisted" />
+
+ <securityPolicy
+ component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+
+ <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="${user}"
+ password_manager="Plain Text"
+ password="${passwd}"
+ />
+
+ <!-- Replace the following directive if you don't want
+ public access -->
+ <grant permission="zope.View"
+ principal="zope.Anybody" />
+ <grant permission="zope.app.dublincore.view"
+ principal="zope.Anybody" />
+
+ <role id="zope.Manager" title="Site Manager" />
+ <role id="zope.Member" title="Site Member" />
+ <grantAll role="zope.Manager" />
+ <grant role="zope.Manager"
+ principal="zope.manager" />
+
+[data]
+recipe = zc.recipe.filestorage
+
[instance]
-recipe = zc.recipe.zope3instance
-database = data
-user = ${user}:${passwd}
-eggs = setuptools
- grok
- ${package}
+recipe = zc.zope3recipes:instance
+application = app
+zope.conf = $${data:zconfig}
-zcml = zope.annotation
- zope.copypastemove
- zope.formlib
- zope.i18n-meta
- zope.i18n.locales
- zope.publisher
- zope.security-meta
- zope.size
- zope.traversing
- zope.traversing.browser
- zope.app
- zope.app-meta
- zope.app.securitypolicy
- zope.app.securitypolicy-meta
- zope.app.authentication
- zope.app.catalog
- zope.app.intid
- zope.app.keyreference
- zope.app.twisted
- grok
- grok-meta
- ${package}
-
[test]
recipe = zc.recipe.testrunner
-eggs = ${package}
-extra-paths = $${zope3:location}/lib/python
- $${zope3:location}/src
-working-directory = parts/instance
-defaults = ['--tests-pattern', '^f?tests$$',
- '-v'
- ]
+eggs = ${egg}
+defaults = ['--tests-pattern', '^f?tests$$', '-v']
Modified: grokproject/trunk/src/grokproject/template/setup.py_tmpl
===================================================================
--- grokproject/trunk/src/grokproject/template/setup.py_tmpl 2007-07-12 13:08:21 UTC (rev 77731)
+++ grokproject/trunk/src/grokproject/template/setup.py_tmpl 2007-07-12 13:11:57 UTC (rev 77732)
@@ -20,9 +20,9 @@
zip_safe=${repr(bool(zip_safe))|False},
install_requires=['setuptools',
'grok',
- # -*- Extra requirements: -*-
+ # Add extra requirements here
],
entry_points="""
- # -*- Entry points: -*-
+ # Add entry points here
""",
)
Modified: grokproject/trunk/src/grokproject/template/src/+package+/configure.zcml
===================================================================
--- grokproject/trunk/src/grokproject/template/src/+package+/configure.zcml 2007-07-12 13:08:21 UTC (rev 77731)
+++ grokproject/trunk/src/grokproject/template/src/+package+/configure.zcml 2007-07-12 13:11:57 UTC (rev 77732)
@@ -1 +1,5 @@
-<grok package="." xmlns="http://namespaces.zope.org/grok" />
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:grok="http://namespaces.zope.org/grok">
+ <include package="grok" />
+ <grok:grok package="." />
+</configure>
Added: grokproject/trunk/src/grokproject/template/src/+package+/ftesting.zcml_tmpl
===================================================================
--- grokproject/trunk/src/grokproject/template/src/+package+/ftesting.zcml_tmpl (rev 0)
+++ grokproject/trunk/src/grokproject/template/src/+package+/ftesting.zcml_tmpl 2007-07-12 13:11:57 UTC (rev 77732)
@@ -0,0 +1,34 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="${package}"
+ package="${package}"
+ >
+
+ <include package="grok" />
+
+ <!-- Typical functional testing security setup -->
+ <securityPolicy
+ component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+ />
+
+ <unauthenticatedPrincipal
+ id="zope.anybody"
+ title="Unauthenticated User"
+ />
+ <grant
+ permission="zope.View"
+ principal="zope.anybody"
+ />
+
+ <principal
+ id="zope.mgr"
+ title="Manager"
+ login="mgr"
+ password="mgrpw"
+ />
+
+ <role id="zope.Manager" title="Site Manager" />
+ <grantAll role="zope.Manager" />
+ <grant role="zope.Manager" principal="zope.mgr" />
+
+</configure>
Added: grokproject/trunk/src/grokproject/template/src/+package+/testing.py_tmpl
===================================================================
--- grokproject/trunk/src/grokproject/template/src/+package+/testing.py_tmpl (rev 0)
+++ grokproject/trunk/src/grokproject/template/src/+package+/testing.py_tmpl 2007-07-12 13:11:57 UTC (rev 77732)
@@ -0,0 +1,7 @@
+import os.path
+import ${package}
+from zope.app.testing.functional import ZCMLLayer
+
+ftesting_zcml = os.path.join(
+ os.path.dirname(${package}.__file__), 'ftesting.zcml')
+FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer')
More information about the Checkins
mailing list