Mac OS X

by Alexander Limi — last modified Feb 20, 2010 04:16 PM
The collective.xdv buildout on Mac OS X

Prerequisites

At the moment, on Mac OS X, you will need to compile lxml and for this you'll need gcc. You'll find this in the XCode tools that come with your Mac CDs (but are not pre-installed). If you have upgraded your OS recently, make sure that you have also upgraded XCode.

Note: For the sake of your sanity, only try this on an up-to-date version of Plone (3.3.*) .

The buildout.cfg

Locate the file buildout.cfg in the root of your Plone instance directory on the file system, and open it in a text editor. 

The Dependencies

Locate the section that looks like this:

# extends = http://dist.plone.org/release/3.3/versions.cfg
extends = versions.cfg
versions = versions

It may also have a URL in the "extends" section, similar to the commented-out first line, depending on whether you pull the Plone configuration from the network or locally.

To add collective.xdv to our setup, we need some slightly different versions of a couple of the packages, so we extend the base config with a version list from the good-py service, so change this part of the configuration so it looks like this:

extends = versions.cfg
          http://good-py.appspot.com/release/collective.xdv/1.0
versions = versions

What happens here is that the dependency list for collective.xdv specifies some new versions for you via the good-py URL. This way, you don't have to worry about getting the right versions, Buildout will handle it for you.

The eggs

Next step is to add the actual collective.xdv add-on to the "eggs" section of buildout.cfg. Look for the section that looks like this:

eggs =
    Plone

This section might have additional lines if you have other add-ons already installed. Just add the collective.xdv on a separate line, like this:

eggs =
    Plone
    collective.xdv [Zope2.10]

The [Zope2.10] is an "extra" which, in this case, tells buildout to get some additional functionality to work with Plone 3. If you are using Plone 4 you can omit this.

The additional egg is ZPublisherEventsBackport - if buildout ignores the "extra" command, then simply add this egg to your eggs list.

lxml

Mac OSX has issues with the lxml binary egg (a requirement of collective.xdv) which can make installation of collective.xdv quite problematic. The recommended approach is to add an additional part to your buildout.cfg to specifically deal with lxml.

First of all you add the name of your new part to the parts section of buildout.cfg (by convention we call it "lxml"). If you're using the buildout.cfg that came with the installer versions of Plone, then scroll down until you find the warning about dragons, and you should find the list of parts fairly soon after that. Insert lxml fairly high up the list.

[buildout]

....

# Beyond here there be dragons!

parts =

lxml

Then locate a place where you can create your new part (prefaced with its name in square brackets). A good place to put it is just above your zope2 section:

[lxml]
recipe = z3c.recipe.staticlxml
egg = lxml
force = false

# This section installs the components of Zope 2.
....

 Finally you need to tell Buildout which version of lxml to use and also to get the very latest version of zc.buildout to make sure it runs the staticlxml recipe properly. You may already have a [versions] part. If not, add it to your buildout.cfg - just above your [lxml] part would be a good place.

[versions]
lxml = 2.2.2
zc.buildout =

 Now save your buildout.cfg and you're ready to run buildout.