Skip to content. | Skip to navigation

Personal tools

>>> ''.join(word[:3].lower() for word in 'David Isaac Glick'.split())



You are here: Home / Blog / A buildout for Plone 2.0.5

A buildout for Plone 2.0.5

by David Glick posted Apr 28, 2009 06:13 PM
At ONE/Northwest we're always looking for ways to improve and streamline our system administration tasks. Recently, we've been working on converting all our old Zope instances to be buildout-based (to make it easier to recreate the environment for local testing of changes or in case the instance needs to move to another server). Here are some tips based on things we've learned in the process of putting together our buildout for Plone 2.0.5 ...

Use the right Python

Plone 2.0.5 is based on Zope 2.7, which requires Python 2.3 rather than Python 2.4 like modern versions of Zope. (We tested using Python 2.4 and it seems to work okay; however Zope 2.7's RestrictedPython has not been audited in Python 2.4 and there's no guarantee that users with the rights to edit scripts won't be able to do something nasty.)

I installed Python 2.3 using macports, then made sure to bootstrap and run my buildout using Python 2.3. Buildout initially complained about the 'subprocess' module being missing, but I was able to work around this by copying from my Python 2.4 libs (/opt/local/lib/python2.4/ in my case) into the Python 2.3 libs.

Update: Recent versions of plone.recipe.zope2install use some Python generators which aren't compatible with Python 2.3, so I had to pin this egg to version 3.2.

Fry up some products

In a classic Zope installation you keep all your products in one Products directory. In buildout they are typically spread between several different product directories. In the case of Zope 2.7, we were seeing an issue where it only found products located in a Products directory at the root of the buildout, even if we listed additional directories. To work around this, I used collective.recipe.omelette to symlink the various buildout-generated products dirs into the main Products dir that Zope finds. Always nice to find a new use for a tool I designed for a completely different problem!

We do our development on OS X which uses a case insensitive filesystem, so I started using /svnproducts as a replacement for the /products dir that is often found in buildouts, since this would otherwise conflict with the auto-generated /Products.

Your configuration is no good here

Unfortunately the zope.conf that the plone.recipe.zope2instance recipe generates contains a couple bits of configuration (verbose-security and default-zpublisher-encoding) that cause Zope 2.7 to barf, since they were not added until later versions of Zope. To work around this, we used sed (via the plone.recipe.command recipe) to remove the offending bits.

The buildout

I ripped out the bits specific to our own systems and ended up with the following, which incorporates the above learnings. If I didn't mess up while abridging it, it even works!

parts =
versions = versions

plone.recipe.zope2install = 3.2

recipe = plone.recipe.distros
urls =
nested-packages = Plone-2.0.5.tar.gz
version-suffix-packages = Plone-2.0.5.tar.gz

recipe = plone.recipe.zope2install
url =
fake-zope-eggs = false

# Archetypes and kupu are not strictly required, but here's how to get them if you need them.
recipe = plone.recipe.distros
urls =
nested-packages =
version-suffix-packages =

recipe = collective.recipe.omelette
eggs =
packages =
    ${buildout:directory}/svnproducts .
    ${buildout:directory}/parts/productdistros .
    ${buildout:directory}/parts/plone .
location = ${buildout:directory}/Products

recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
user = admin:admin
http-address = 8080
debug-mode = on
verbose-security = on
products =

recipe = plone.recipe.command
command =   
    sed -i '' 's/verbose-security/#verbose-security/' ${buildout:directory}/parts/instance/etc/zope.conf
    sed -i '' 's/default-zpublisher-encoding/#default-zpublisher-encoding/' ${buildout:directory}/parts/instance/etc/zope.conf
update-command = ${fixer:command}

Many thanks to my colleague Jon Baldivieso who did some of the initial work on this buildout.

Update 5/1/2009: Added fake-zope-eggs = false to avoid trying to build fake eggs from a directory that doesn't exist in Zope 2.7.

Update 8/21/2009: Pinned plone.recipe.zope2install to version 3.2, as newer versions use Python generators that aren't compatible with Python 2.3.

Roman says:
Sep 29, 2010 03:18 PM
I've found additional problems:

* use the old[…]/
  and/or pin the zc.buildout version to something older then zc.buildout
  1.4. Recent versions use the decorator syntax, which is not supported
  in Python2.3

* pin zc.recipe.egg to an older version (1.2.2 perhaps), which otherwise
  depends on a newer zc.buildout version

* pin plone.recipe.zope2instance to an earlier version (3.0 perhaps)
Jean Jordaan says:
Oct 31, 2010 09:09 PM
When I run this buildout, I get eggs/Zope2-2.12.12-py2.4-linux-i686.egg/ instead of 2.7.7, and the run dies with plone.recipe.zope2instance-4.0.5-py2.4.egg/plone/recipe/zope2instance/", line 5, in ?
    from hashlib import sha1
ImportError: No module named hashlib

I'll try pinning some things ..