How to install Python with Buildout
We have now arrived at the pinnacle task for this chapter—installing Python with Buildout.
From now on, we will not provide any operating system-specific instructions, but you can expect the examples in the rest of this book to work on all supported operating systems, unless otherwise stipulated.
Remember, we are still trying to satisfy the requirement of Python 2.4 across all the three operating systems.
Running the first buildout
In the code bundle for this chapter, you will find a file called 01-background-python.cfg
, which contains the following:
[buildout] parts = python-buildout [python-buildout] recipe = infrae.subversion location = src urls = http://svn.plone.org/svn/collective/buildout/python/src/ python-buildout
(If you have not done so already, download the book examples from https://www.packtpub.com/plone-3-3-site-administration/book and unzip them into your home directory.)
Change directories to the extracted buildout directory and type:
$ buildout –c 01-background-python.cfg
You should see:
$ buildout -c 01-background-python.cfg Got infrae.subversion 1.4.5. Getting distribution for 'py'. install_dir /Users/aclark/Developer/plone-site-admin/buildout/eggs/tmpbIk70j Got py 1.3.0. /Users/aclark/Developer/plone-site-admin/buildout/eggs/infrae.subversion-1.4.5-py2.6.egg/infrae/subversion/Common.py:4: DeprecationWarning: the sets module is deprecated from sets import Set # For python 2.3 compatibility Installing python-buildout.
Running the second buildout
Inside the buildout/src/python-buildout
directory, there is a file called python24.cfg
.
This is the buildout that will download and build Python 2.4 for us. All we need to do is run it:
$ buildout –c src/python-buildout/python24.cfg
Early on, you may encounter an error about a missing downloads
directory:
While: Installing python-2.4-build. Error: The directory: '/Users/aclark/Developer/plone-site-admin/buildout/src/python-buildout/downloads' to be used as a download cache doesn't exist.
If so, just create the directory and then re-run the buildout
command.
You should see:
$ buildout -c src/python-buildout/python24.cfg Unused options for buildout: 'base-parts'. Updating opt. opt: Running …
Installing python-2.4-build. python-2.4-build: Downloading http://www.python.org/ftp/python/2.4.6/Python-2.4.6.tar.bz2 python-2.4-build: Unpacking and configuring python-2.4-build: Updating environment: CFLAGS=-arch x86_64 … Installed /Users/aclark/Developer/plone-site-admin/buildout/src/python-buildout/python-2.4/lib/python2.4/site-packages/PIL-1.1.6-py2.4-macosx-10.6-i386.egg Processing dependencies for PIL==1.1.6 Finished processing dependencies for PIL==1.1.6 Unused options for python-2.4-PIL: 'update-command'. Installing python-2.4-test. Unused options for python-2.4-test: 'update-script'. $
Verify that Python works
To verify that Python works, type:
$ src/python-buildout/parts/opt/bin/python2.4
You should see:
$ src/python-buildout/parts/opt/bin/python2.4 Python 2.4.6 (#1, May 9 2010, 02:12:47) [GCC 4.2.1 (Apple Inc. build 5659)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>
At this point, we have Python 2.4.6 installed on both Ubuntu Linux and Mac OS X, and Python 2.4.4 installed on Windows.
All of our targeted operating systems now have a version of Python capable of running Plone 3.3.
In addition, we have installed a C compiler and Subversion client.
Our computers are now ready to build Plone 3.3:
That is all for this chapter, great job! It's all downhill from here.