[Pythonmac-SIG] HOWTO build local 2.4 on Leopard (was Re: newbie Mac switcher trying to set up django on Intel MacBook Pro Tiger)

Gary Poster gary at zope.com
Mon Jan 7 20:59:07 CET 2008


On Jan 3, 2008, at 1:28 PM, Tobias Rodäbel wrote:

> BTW, we had a very inspiring discussion on the zope3-dev
> list last summer regarding system python for *development*. Most
> people there prefer a separate python tree for each (zope) project. http://www.mail-archive.com/zope3-dev@zope.org/msg08490.html

FWIW, in this vein, if you want to build a clean local non-framework  
Python 2.4, here are the instructions I've been providing in-company.   
They aggregate and clean up some of the bits I've seen in blogs and  
elsewhere.  Suggested improvements welcome.

===================
Developing on a Mac
===================

First you need macports.  Go to macports.org and download the newest
version.  It doesn't seem to set up the manual path correctly, so after
the installation add this to your ~/.profile (or in a similar place):

export MANPATH=/opt/local/man:$MANPATH

You'll need a new terminal session (or other shell magic if you know it)
for these changes to take effect.  The easiest thing to do is close the
shell you are working in and open a new one.

Now you need a local Python, so you don't mess up the system one.
Download a source distribution of Python 2.4.  You may have your own
approach as to where to put things, but I'll go with this pattern in
this document: ~/src will hold expanded source trees, ~/opt will hold
our local Python, and we'll develop in ~/dev.

We will need readline and zlib from macports.

    sudo port install readline
    sudo port install zlib

Now we'll do the usual dance, with a couple of ugly extra steps.

1. ./configure --prefix=/Users/gary/dev/py LDFLAGS=-L/opt/local/lib  
OPT=-I/opt/local/include
2. add ``#define SETPGRP_HAVE_ARG 1`` to pyconfig.h
3. make
4. make install


...then I go on to talk about project-specific stuff.

I'm not intending to get involved in a "use system Python or not"  
discussion, just want to help out those who want to do this bit

Gary


More information about the Pythonmac-SIG mailing list