##// END OF EJS Templates
Now IPython works with OS X 10.5 (Leopards) libedit based readline module.
bgranger -
Show More
@@ -6,7 +6,7 Requires Python 2.3 or newer.
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 2846 2007-10-24 14:44:48Z vivainio $
9 $Id: iplib.py 2854 2007-11-01 20:19:34Z bgranger $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
@@ -1321,11 +1321,15 want to merge them back into the new files.""" % locals()
1321 self.readline_startup_hook = readline.set_startup_hook
1321 self.readline_startup_hook = readline.set_startup_hook
1322
1322
1323 # Load user's initrc file (readline config)
1323 # Load user's initrc file (readline config)
1324 # Or if libedit is used, load editrc.
1324 inputrc_name = os.environ.get('INPUTRC')
1325 inputrc_name = os.environ.get('INPUTRC')
1325 if inputrc_name is None:
1326 if inputrc_name is None:
1326 home_dir = get_home_dir()
1327 home_dir = get_home_dir()
1327 if home_dir is not None:
1328 if home_dir is not None:
1328 inputrc_name = os.path.join(home_dir,'.inputrc')
1329 inputrc_name = '.inputrc'
1330 if readline.uses_libedit:
1331 inputrc_name = '.editrc'
1332 inputrc_name = os.path.join(home_dir, inputrc_name)
1329 if os.path.isfile(inputrc_name):
1333 if os.path.isfile(inputrc_name):
1330 try:
1334 try:
1331 readline.read_init_file(inputrc_name)
1335 readline.read_init_file(inputrc_name)
@@ -1340,6 +1344,10 want to merge them back into the new files.""" % locals()
1340 self.set_completer()
1344 self.set_completer()
1341
1345
1342 # Configure readline according to user's prefs
1346 # Configure readline according to user's prefs
1347 # This is only done if GNU readline is being used. If libedit
1348 # is being used (as on Leopard) the readline config is
1349 # not run as the syntax for libedit is different.
1350 if not readline.uses_libedit:
1343 for rlcommand in self.rc.readline_parse_and_bind:
1351 for rlcommand in self.rc.readline_parse_and_bind:
1344 readline.parse_and_bind(rlcommand)
1352 readline.parse_and_bind(rlcommand)
1345
1353
@@ -29,6 +29,19 if sys.platform == 'win32' and have_readline:
29 print "Failed GetOutputFile"
29 print "Failed GetOutputFile"
30 have_readline = False
30 have_readline = False
31
31
32 # Test to see if libedit is being used instead of GNU readline.
33 # Thanks to Boyd Waters for this patch.
34 uses_libedit = False
35 if sys.platform == 'darwin' and have_readline:
36 import commands
37 (status, result) = commands.getstatusoutput( "otool -L %s | grep libedit" % _rl.__file__ )
38 if status == 0 and len(result) > 0:
39 # we are bound to libedit - new in Leopard
40 _rl.parse_and_bind("bind ^I rl_complete")
41 print "Leopard libedit detected."
42 uses_libedit = True
43
44
32 # the clear_history() function was only introduced in Python 2.4 and is
45 # the clear_history() function was only introduced in Python 2.4 and is
33 # actually optional in the readline API, so we must explicitly check for its
46 # actually optional in the readline API, so we must explicitly check for its
34 # existence. Some known platforms actually don't have it. This thread:
47 # existence. Some known platforms actually don't have it. This thread:
@@ -1,3 +1,8
1 2007-11-01 Brian Granger <ellisonbg@gmail.com>
2
3 * iplib.py, rlineimpl.py: Applied Body Water's patches to get IPython
4 working with OS X 10.5 libedit implementation of readline.
5
1 2007-10-24 Ville Vainio <vivainio@gmail.com>
6 2007-10-24 Ville Vainio <vivainio@gmail.com>
2
7
3 * iplib.py(user_setup): To route around buggy installations where
8 * iplib.py(user_setup): To route around buggy installations where
General Comments 0
You need to be logged in to leave comments. Login now