Mac OS X development environment

This page contains instructions on how to set up a Zope development environment with ZTM Topic Maps on Apple Mac OS X (10.5 – Leopard) operating systems.

Warning

While you can use this for production environments by not running in debug mode, this is not recommended.

Production environments should probably be configured differently, but since we have not yet operated any ZTM 3 websites on Mac OS X Server we can not provide recommendations.

The primary problem is that you depend on PyPI which is essentially a dynamic package assembly.

XCode

Many of ZTM’s dependencies do not provide binary packages for Mac OS X. You therefore need to install a compiler which Apple happily provides.

You can find Apple’s developer tools on the second DVD that came with your machine or just download it from Apple’s developer website

Compile your own Python

We recommend compiling your own Python interpreter instead of using the built-in version. Both it and the MacPorts version have too many problems.

Unicode libraries for internationalization

This part is really cumbersome, but required to get localized sorting with ztm.topicmaps.

To correctly sort strings in Unicode a special process called collation is used. This functionality is provided by the zope.ucol package. Unfortunately it requires libraries that are not installed by Mac OS X.

The easiest way to get it is to install the MacPorts system (which you should have done anyway if you intend to do any development on your Mac OS X).

Follow the Macports installation instructions.

Then start Terminal.app and install ICU like this:

$ sudo port install icu

Finally you need to tell the compiler and linker where it can find ICU:

$ export C_INCLUDE_PATH=/opt/local/include
$ export LIBRARY_PATH=/opt/local/lib

Note

If you close terminal before this running buildout after adding ZTM below compiling zope.ucol will fail.

setuptools

Setuptools is a nice extension of distutils, the standard way to distribute Python packages. Its primary benefit is that it understands eggs and works with python.orgs Package Index (PyPI).

You can install setuptools like this to get the handy easy_install script:

$ curl --silent http://peak.telecommunity.com/dist/ez_setup.py | sudo python

Remember to enter your password when requested. (Installing it might need administrator-permissions which sudo temporarily grants you.)

Getting zopeproject

zopeproject is a script that sets up a simple website that publishes Zope through a WSGI pipeline with at Paste web server

It must be installed like this from the console:

$ easy_install zopeproject

Running zopeproject

Projects are just folders and can be placed anywhere. Below we call the folder mysite, but you can use more or less anything. Just remember to avoid spaces in the path.:

$ cd   # To go to the home folder
$ zopeproject mysite

Follow the on-screen instructions. Just use the default location for the Eggs-directory if you do not know what that means.

Make sure you remember the administrator account’s login name and password. :-)

Note

The eggs-directory is just a shared cache where setuptools will check before trying to download a package again.

Waiting

Now let buildout do its job.

Expect this to take some time depending on how fast your internet-connection is.

Testing your server

Before getting ZTM you should test your server:

$ cd mysite
$ bin/paster serve debug.ini
Your server is now running at localhost:8080

You can test your instance by pointing your browser to http://localhost:8080

Try logging in by clicking log in in the upper right corner.

Entering the administrator accounts login name and password you typed in above will take you to Zope’s Management Interface (ZMI).

Installing ZTM

Next we need to tell the zope project to include ZTM.

Start your text-editor and open ~/mysite/buildout.cfg.

Look for the [buildout] section and add the following line below it:

find-links = http://ztmproject.org/snapshots/

Next look for the [app] section and add the ztm.publishing and ztm.demonstration as eggs:

[app]
eggs = testsite
       ...[snipped other eggs]...
       ztm.publishing
       ztm.demonstration
       ...[snipped other eggs]...

You have now told the build system that the next time it runs it should try to find the packages ztm.publishing and ztm.demonstration and their dependencies.

First you need to stop the running server. This is done by focusing the console window and holding down Ctrl while pressing c. Now you can run the build system and look for updates like this:

$ bin/buildout -n

Once again you need to wait a short while for it to download more packages and complete.

Note

Occasionally the update finishes without printing a newline. Press enter to check if no new lines has been printed for a while.

The final edit should is in the ~/mysite/site.zcml which tells Zope to load the package configuration:

<configuration>
  ...
  <include package="ztm.publishing"/>
  <include package="ztm.demonstration"/>
  ...
</configuration>

Starting ZTM

Now start the server in debug mode again with:

$ bin/paster serve debug.ini

And go to http://localhost:8080/ again and log in as administrator.

Next click [top] in the top left corner. The left column should now have the ability to create a Topic Map object. (It might have been translated depending on your browser settings.)

Add the topic map and give it a name. We just call it topicmap by convention.

Et Voilá, you have installed ZTM 3, created your first topic map and you are ready to fill it with topics!

Note

Another option when creating an isolated development environment is to use virtualenv.

Note

Compiling lxml without macports: http://gist.github.com/167784

© Copyright 2009-2010, ztmproject.org. Created using Sphinx 0.6.3.