[Pythonmac-SIG] Re: Readline on the Mac
Andrew Straw
andrew.straw@adelaide.edu.au
Sat, 8 Mar 2003 15:05:56 +1030
I've gotten readline to work doing this:
1) Use the setup.py listed below (slightly modified from one Bill
Bumgartner posted several months ago)
2) Download and un-tgz the GNU readline package in /path/to/readline
3) Get the python source code for your current version of python in
/path/to/python
4) follow the following commands:
mkdir my_python_readline_module_src
cd my_python_readline_module_src
# copy the setup.py (listed below) into this directory
# point ./readline/readline.h to the readline.h you just downloaded
ln -s /path/to/readline readline
# point ./readline.c to the readline.c from the Python source
ln -s /path/to/python/Modules/readline.c readline.c
sudo python setup.py install
========== setup.py ================
#!/usr/bin/env python
from distutils.core import setup, Extension
import os
import sys
if not (sys.platform == 'darwin') or \
not
os.path.exists('/System/Library/PrivateFrameworks/readline.framework'):
print "no point running this on a system other than OS X w/dev
tools."
sys.exit(1)
setup (name = "readline",
description = "readline package for OS X python",
author = "readline.c came straight from Python source",
author_email = "bbum@codefab.com",
url = "http://www.python.org",
ext_modules = [ Extension("readline",
["readline.c"],
include_dirs=['.'],
extra_compile_args=[
"-g",
"-O0",
"-DMACOSX",
],
extra_link_args=[
'-g',
'-F/System/Library/PrivateFrameworks/',
'-framework',
'readline'
])
]
)
======== end of setup.py =============
PS My version of /System/Library/PrivateFrameworks/readline.framework/
doesn't have the Headers directory, which is why you have to download
the GNU headers.
PPS How does Apple deal with the GPL-ness of readline? I don't see any
mention of GNU or the GPL in the PrivateFrameworks version. Maybe
they've got a private, non-GNU, readline-compatible library? If so,
why don't they make their own headers? (Maybe because it would be
difficult/impossible to make a readline header without violating the
copyright?)
On Thursday, March 6, 2003, at 04:03 AM, Rob Managan wrote:
> I finally answered my own question!
>
> I am able to use the framework version of readline with standard Unix
> apps when I put these sym links in
>
> ln -s /System/Library/PrivateFrameworks/readline.framework/Headers
> readline
> ln -s /System/Library/PrivateFrameworks/readline.framework/readline
> /usr/local/lib/libreadline.a
>
> This gives the #include <readline/readline.h> syntax that is needed.
> The second line lets my old makefile find the library.
>
>>
>> I know I tried this with one of my unix programs that uses readline
>> and I could not straighten out how to point to the headers and stuff
>> consistently. For Unix it wanted the headers in a readline directory
>> and I could not figure out to coerce that from the framework setup
>> which was different.
>>
>
> --
> *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-
> Rob Managan <mailto://managan@llnl.gov>
> LLNL ph: 925-423-0903
> P.O. Box 808, L-095 FAX: 925-422-3389
> Livermore, CA 94551-0808
>
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>