[IPython-user] readline and leopard revisited

Ludwig Schwardt ludwig.schwardt@gmail....
Thu Jan 17 06:37:14 CST 2008


Hi,

After a few useful hints from Ville and a Japanese forum
(http://www.python.jp/pipermail/python-ml-jp/2007-October/004150.html),
I reworked my readline extension build process. It now builds a
statically linked extension module which is installed as a Python egg.

It seems to work with the system-installed Python 2.5.1 on Leopard
10.5.1. IPython 0.8.1 correctly picks up the new version, and now has
tab completion and ctrl-r search.

I attach a "lite" version of the extension - just unpack, add
readline-5.2.tar.gz from somewhere, and run ./build.sh. A full version
could be sent on request, which includes the readline tarball for
about 2MB extra. Both versions include all recent readline patches.
Especially patch 12 is relevant, as this fixes configure support for
Leopard. The build script contains some commented-out lines for
enabling a 4-way universal build based on the 10.5 SDK, like the rest
of the system Python (not required, it seems).

Ville: You spotted the correct reason for my troubles - I was being
too clever and ended up linking against the system readline instead of
the real one, leading to some insidious behaviour...

Enjoy and let me know of any problems.
Ludwig

P.S. If you don't like eggs, it is reasonably straightforward to fix:

1. Unpack pyreadline-2.5.1.tar.gz

2. In pyreadline-2.5.1/setup.py, change the 3 lines:

import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, Extension

    to:

from distutils.core import setup, Extension

    Also comment out the second-last line:

zip_safe=False,

3. Recreate the tarball and run ./build.sh, which now installs to site-packages.

4. Add a file 'sitecustomize.py' to site-packages, which contains
(change the path to something appropriate):

import imp
imp.load_dynamic('readline', '/Library/Python/2.5/site-packages/readline.so')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyreadline-leopard-lite.tar.gz
Type: application/x-gzip
Size: 24010 bytes
Desc: not available
Url : http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20080117/9644bc55/attachment-0001.gz 


More information about the IPython-user mailing list